summaryrefslogtreecommitdiffstats
path: root/Modules/Platform
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2024-03-11 17:10:43 (GMT)
committerBrad King <brad.king@kitware.com>2024-03-13 15:13:21 (GMT)
commit801ae06952fc090d07c666b1e56573cae648f599 (patch)
treed99cc5103040c2900f914fd385fbe40a584df612 /Modules/Platform
parent939ac5287e9a04398a8eb01243e14e00d13d38ef (diff)
downloadCMake-801ae06952fc090d07c666b1e56573cae648f599.zip
CMake-801ae06952fc090d07c666b1e56573cae648f599.tar.gz
CMake-801ae06952fc090d07c666b1e56573cae648f599.tar.bz2
LINKER_TYPE: Support MOLD only on GCC versions that support it
Fixes: #25748
Diffstat (limited to 'Modules/Platform')
-rw-r--r--Modules/Platform/Linux-GNU.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake
index c3878eb..24bf1bb 100644
--- a/Modules/Platform/Linux-GNU.cmake
+++ b/Modules/Platform/Linux-GNU.cmake
@@ -20,5 +20,8 @@ macro(__linux_compiler_gnu lang)
set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd")
set(CMAKE_${lang}_USING_LINKER_GOLD "-fuse-ld=gold")
- set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
+ if(NOT CMAKE_${lang}_COMPILER_ID STREQUAL "GNU"
+ OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1")
+ set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
+ endif()
endmacro()