Allow passing LTCG as an init_target argument.
This commit is contained in:
parent
609e21643b
commit
f4c7f67d60
1 changed files with 24 additions and 10 deletions
|
|
@ -12,17 +12,31 @@ function(init_target_folder target_name folder_name)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(init_target target_name) # init_target(my_target folder_name)
|
function(init_target target_name) # init_target(my_target [cxx_std_..] [ltcg] folder_name)
|
||||||
if (ARGC GREATER 1)
|
set(argslist ${ARGV})
|
||||||
if (${ARGV1} STREQUAL cxx_std_14 OR ${ARGV1} STREQUAL cxx_std_11 OR ${ARGV1} STREQUAL cxx_std_17)
|
list(REMOVE_AT argslist 0)
|
||||||
target_compile_features(${target_name} PRIVATE ${ARGV1})
|
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()
|
else()
|
||||||
target_compile_features(${target_name} PRIVATE ${MAXIMUM_CXX_STANDARD})
|
init_target_folder(${target_name} ${entry})
|
||||||
init_target_folder(${target_name} ${ARGV1})
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
endforeach()
|
||||||
target_compile_features(${target_name} PRIVATE ${MAXIMUM_CXX_STANDARD})
|
target_compile_features(${target_name} PRIVATE ${standard})
|
||||||
endif()
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
set_target_properties(${target_name} PROPERTIES
|
set_target_properties(${target_name} PROPERTIES
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
|
@ -43,7 +57,7 @@ endfunction()
|
||||||
|
|
||||||
# This code is not supposed to run on build machine, only on target machine.
|
# This code is not supposed to run on build machine, only on target machine.
|
||||||
function(init_non_host_target target_name)
|
function(init_non_host_target target_name)
|
||||||
init_target(${target_name})
|
init_target(${ARGV})
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set_target_properties(${target_name} PROPERTIES
|
set_target_properties(${target_name} PROPERTIES
|
||||||
OSX_ARCHITECTURES "${DESKTOP_APP_MAC_ARCH}"
|
OSX_ARCHITECTURES "${DESKTOP_APP_MAC_ARCH}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue