Re-enable global /LTCG on Windows.
With /LTCGOUT: empty path it should not try generating .iobj file, and work on both 32 bit and 64 bit build with all static libs.
This commit is contained in:
parent
aa1e0d84b9
commit
17951fb650
2 changed files with 17 additions and 16 deletions
|
|
@ -12,40 +12,29 @@ function(init_target_folder target_name folder_name)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
function(init_target target_name) # init_target(my_target [cxx_std_..] [ltcg] folder_name)
|
||||
function(init_target target_name) # init_target(my_target [cxx_std_..] folder_name)
|
||||
set(argslist ${ARGV})
|
||||
list(REMOVE_AT argslist 0)
|
||||
set(standard ${MAXIMUM_CXX_STANDARD})
|
||||
foreach (entry ${argslist})
|
||||
if (${entry} STREQUAL cxx_std_14 OR ${entry} STREQUAL cxx_std_11 OR ${entry} STREQUAL cxx_std_17)
|
||||
set(standard ${entry})
|
||||
elseif (${entry} STREQUAL ltcg)
|
||||
if (WIN32 AND NOT build_win64 AND DESKTOP_APP_SPECIAL_TARGET)
|
||||
target_compile_options(${target_name}
|
||||
PRIVATE
|
||||
$<IF:$<CONFIG:Debug>,,/GL>
|
||||
)
|
||||
target_link_options(${target_name}
|
||||
PRIVATE
|
||||
$<IF:$<CONFIG:Debug>,,/LTCG>
|
||||
)
|
||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$<IF:$<CONFIG:Debug>,,/LTCG>")
|
||||
endif()
|
||||
else()
|
||||
init_target_folder(${target_name} ${entry})
|
||||
endif()
|
||||
endforeach()
|
||||
target_compile_features(${target_name} PRIVATE ${standard})
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
if (WIN32 AND DESKTOP_APP_SPECIAL_TARGET)
|
||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$<IF:$<CONFIG:Debug>,,/LTCG>")
|
||||
endif()
|
||||
|
||||
target_link_libraries(${target_name} PRIVATE desktop-app::common_options)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES
|
||||
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES
|
||||
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES
|
||||
MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>
|
||||
)
|
||||
if (DESKTOP_APP_SPECIAL_TARGET)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
|
|
|
|||
|
|
@ -55,6 +55,18 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||
/LARGEADDRESSAWARE # Allow more than 2 GB in 32 bit application.
|
||||
)
|
||||
endif()
|
||||
|
||||
if (DESKTOP_APP_SPECIAL_TARGET)
|
||||
target_compile_options(common_options
|
||||
INTERFACE
|
||||
$<IF:$<CONFIG:Debug>,,/GL>
|
||||
)
|
||||
target_link_options(common_options
|
||||
INTERFACE
|
||||
$<IF:$<CONFIG:Debug>,,/LTCG>
|
||||
$<IF:$<CONFIG:Debug>,,/LTCGOUT:>
|
||||
)
|
||||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_definitions(common_options
|
||||
INTERFACE
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue