diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e3f9cb6..aa33d4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,18 @@ endif() if(ENABLE_LTO) add_compile_options(-O3 -flto) add_link_options(-flto) - set(CMAKE_AR "gcc-ar") + + if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) + find_program(LLD ld.lld) + if (LLD) + add_link_options(-fuse-ld=lld) + else() + add_link_options(-fuse-linker-plugin) + endif() + set(CMAKE_AR "llvm-ar") + else() + set(CMAKE_AR "gcc-ar") + endif() set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_C_ARCHIVE_FINISH true) set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>") |