Skip to content

Commit

Permalink
Only use lld with Clang on Linux. Fixes #25
Browse files Browse the repository at this point in the history
  • Loading branch information
jwtowner committed Jun 30, 2024
1 parent 6a326fa commit 58ff0ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND (UNIX AND NOT APPLE))
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
endif()
Expand Down Expand Up @@ -67,18 +67,19 @@ function(setup_executable_target target_name)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(${target_name} PRIVATE -stdlib=libc++ -Wextra-semi-stmt -Wshadow-all)
target_link_options(${target_name} PRIVATE -stdlib=libc++ -fuse-ld=lld)
target_link_options(${target_name} PRIVATE -stdlib=libc++)
if (UNIX AND NOT APPLE)
target_link_libraries(${target_name} PRIVATE c++ c++abi m)
endif()
target_link_options(${target_name} PRIVATE -fuse-ld=lld)
endif()
endif()
if (MSVC)
target_compile_options(${target_name} PRIVATE
/W4 /permissive /sdl /utf-8 /Za /Zc:__cplusplus /Zc:rvalueCast /Zc:inline
/Zc:strictStrings /Zc:throwingNew /Zc:referenceBinding /Zc:wchar_t)
target_link_options(${target_name} PRIVATE
$<$<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>>:/OPT:REF /OPT:ICF>)
endif()
endif()
endfunction()

option(BUILD_TESTS "Build tests" ON)
Expand Down

0 comments on commit 58ff0ea

Please sign in to comment.