2023-09-05 05:40:57 +00:00
|
|
|
# Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
# Copyright (c) 2023, Daniel Bertalan <dani@danielbertalan.dev>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
#
|
|
|
|
|
2023-10-11 18:27:07 +00:00
|
|
|
if (NOT APPLE AND NOT LAGOM_USE_LINKER)
|
2023-09-05 05:40:57 +00:00
|
|
|
find_program(LLD_LINKER NAMES "ld.lld")
|
|
|
|
if (LLD_LINKER)
|
2023-10-11 18:27:07 +00:00
|
|
|
message(STATUS "Using LLD to link Lagom.")
|
|
|
|
set(LAGOM_USE_LINKER "lld" CACHE STRING "" FORCE)
|
2023-09-05 05:40:57 +00:00
|
|
|
else()
|
|
|
|
find_program(MOLD_LINKER NAMES "ld.mold")
|
|
|
|
if (MOLD_LINKER)
|
2023-10-11 18:27:07 +00:00
|
|
|
message(STATUS "Using mold to link Lagom.")
|
|
|
|
set(LAGOM_USE_LINKER "mold" CACHE STRING "" FORCE)
|
2023-09-05 05:40:57 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2023-10-11 18:27:07 +00:00
|
|
|
if (LAGOM_USE_LINKER)
|
2023-09-05 05:40:57 +00:00
|
|
|
set(LINKER_FLAG "-fuse-ld=${LAGOM_USE_LINKER}")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAG}")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAG}")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAG}")
|
|
|
|
endif()
|