aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2020-05-10 23:30:55 +0200
committerGitHub <noreply@github.com>2020-05-10 23:30:55 +0200
commita7a286371a31f832234a8a241c216180b3fd6e3d (patch)
treec1a1f6f4728a2bce5bbc698e969150a611572553 /CMakeLists.txt
parentbc9c989f61b0f7e346d7bd688b4af8480bd3264b (diff)
parent675b3f882ff1c0cc66a34e571a64e028f269f4bc (diff)
Merge pull request #622 from nadiaholmquist/fix/clang-build
Fix building with Clang
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
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>")