diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 048dd44..0aa558d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,9 +20,25 @@ else() option(ENABLE_LTO "Enable link-time optimization" OFF) endif() +if (CMAKE_BUILD_TYPE STREQUAL Debug) + add_compile_options(-Og) +endif() + if(ENABLE_LTO) add_compile_options(-O3 -flto) - set(CMAKE_AR "gcc-ar") + add_link_options(-flto) + + 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>") |