1
0
Fork 0

Allow LTO with clang

Seem to work fine
This commit is contained in:
Ilya Fedin 2021-07-29 19:59:28 +04:00 committed by John Preston
parent 2661c92394
commit f7ccab0e7c
2 changed files with 12 additions and 10 deletions

View file

@ -40,12 +40,8 @@ if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_options(common_options INTERFACE -g0)
target_link_options(common_options INTERFACE -g0)
else()
target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g>)
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g>)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-flto>)
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-flto -fuse-linker-plugin>)
endif()
target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto>)
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>)
endif()
endif()

View file

@ -96,10 +96,16 @@ else()
report_bad_special_target()
endif()
endif()
if (DESKTOP_APP_SPECIAL_TARGET AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
set(CMAKE_NM "gcc-nm")
if (DESKTOP_APP_SPECIAL_TARGET)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
set(CMAKE_NM "gcc-nm")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_AR "llvm-ar")
set(CMAKE_RANLIB "llvm-ranlib")
set(CMAKE_NM "llvm-nm")
endif()
endif()
endif()