Skip to content

Commit 58ff0ea

Browse files
committed
Only use lld with Clang on Linux. Fixes #25
1 parent 6a326fa commit 58ff0ea

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if(NOT CMAKE_BUILD_TYPE)
1717
set(CMAKE_BUILD_TYPE Release)
1818
endif()
1919

20-
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
20+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND (UNIX AND NOT APPLE))
2121
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
2222
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
2323
endif()
@@ -67,18 +67,19 @@ function(setup_executable_target target_name)
6767
endif()
6868
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
6969
target_compile_options(${target_name} PRIVATE -stdlib=libc++ -Wextra-semi-stmt -Wshadow-all)
70-
target_link_options(${target_name} PRIVATE -stdlib=libc++ -fuse-ld=lld)
70+
target_link_options(${target_name} PRIVATE -stdlib=libc++)
7171
if (UNIX AND NOT APPLE)
7272
target_link_libraries(${target_name} PRIVATE c++ c++abi m)
73-
endif()
73+
target_link_options(${target_name} PRIVATE -fuse-ld=lld)
74+
endif()
7475
endif()
7576
if (MSVC)
7677
target_compile_options(${target_name} PRIVATE
7778
/W4 /permissive /sdl /utf-8 /Za /Zc:__cplusplus /Zc:rvalueCast /Zc:inline
7879
/Zc:strictStrings /Zc:throwingNew /Zc:referenceBinding /Zc:wchar_t)
7980
target_link_options(${target_name} PRIVATE
8081
$<$<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>>:/OPT:REF /OPT:ICF>)
81-
endif()
82+
endif()
8283
endfunction()
8384

8485
option(BUILD_TESTS "Build tests" ON)

0 commit comments

Comments
 (0)