Другой способ установки флагов

This commit is contained in:
Andrei Astafev 2020-06-25 12:22:35 +03:00
parent 954b27fa27
commit ef788f6cc5

View File

@ -58,10 +58,10 @@ function(common_target_properties target)
check_cxx_compiler_flag(-flto CXX_HAS_LTO_FLAG) check_cxx_compiler_flag(-flto CXX_HAS_LTO_FLAG)
check_cxx_compiler_flag(-fno-fat-lto-objects CXX_HAS_NO_FAT_LTO_FLAG) check_cxx_compiler_flag(-fno-fat-lto-objects CXX_HAS_NO_FAT_LTO_FLAG)
if(CXX_HAS_LTO_FLAG) if(CXX_HAS_LTO_FLAG)
target_compile_options(${target} PUBLIC "-flto") target_compile_options(${target} PUBLIC "$<$<CONFIG:RELEASE>:-flto>")
set_target_properties(${target} PROPERTIES LINK_FLAGS_RELEASE "-flto") set_target_properties(${target} PROPERTIES LINK_FLAGS_RELEASE "-flto")
if(CXX_HAS_NO_FAT_LTO_FLAG) if(CXX_HAS_NO_FAT_LTO_FLAG)
target_compile_options(${target} PUBLIC "-fno-fat-lto-objects") target_compile_options(${target} PUBLIC "$<$<CONFIG:RELEASE>:-fno-fat-lto-objects>")
set_target_properties(${target} PROPERTIES LINK_FLAGS_RELEASE "-fno-fat-lto-objects") set_target_properties(${target} PROPERTIES LINK_FLAGS_RELEASE "-fno-fat-lto-objects")
endif() endif()
endif() endif()