CMake: Use CMAKE_LINKER_TYPE on CMake >= 3.29

This commit is contained in:
Andrew Kaster 2024-06-07 15:18:33 -06:00 committed by Andreas Kling
parent 18abd54247
commit 1af9e44130
Notes: sideshowbarker 2024-07-17 06:40:35 +09:00

View file

@ -19,8 +19,14 @@ if (NOT APPLE AND NOT LAGOM_USE_LINKER)
endif()
if (LAGOM_USE_LINKER)
# FIXME: Move to only setting CMAKE_LINKER_TYPE once we drop support for CMake < 3.29
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.29)
string(TOUPPER ${LAGOM_USE_LINKER} linker_type)
set(CMAKE_LINKER_TYPE ${linker_type})
else()
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()
endif()