Make target_*_options_if_exists actually work
This commit is contained in:
parent
32257877e0
commit
cd12cb93ea
3 changed files with 11 additions and 6 deletions
|
|
@ -4,7 +4,7 @@
|
|||
# For license and copyright information please follow this link:
|
||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
|
||||
target_compile_options_if_exists(common_options
|
||||
target_compile_options(common_options
|
||||
INTERFACE
|
||||
$<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing>
|
||||
-Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20
|
||||
|
|
@ -18,11 +18,14 @@ INTERFACE
|
|||
)
|
||||
|
||||
if (DESKTOP_APP_SPECIAL_TARGET)
|
||||
target_compile_options_if_exists(common_options
|
||||
target_compile_options(common_options
|
||||
INTERFACE
|
||||
$<$<NOT:$<CONFIG:Debug>>:-Ofast>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-g>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-flto>
|
||||
)
|
||||
target_compile_options_if_exists(common_options
|
||||
INTERFACE
|
||||
-fstack-protector-all
|
||||
-fstack-clash-protection
|
||||
-pipe
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ function(target_compile_options_if_exists target_name)
|
|||
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
||||
set(writing_now ${entry})
|
||||
else()
|
||||
check_cxx_compiler_flag(${entry} flag_exists)
|
||||
if (flag_exists)
|
||||
string(MAKE_C_IDENTIFIER ${entry} entry_identifier)
|
||||
check_cxx_compiler_flag(${entry} DESKTOP_APP_${entry_identifier}_EXISTS)
|
||||
if (DESKTOP_APP_${entry_identifier}_EXISTS)
|
||||
if ("${writing_now}" STREQUAL "PRIVATE")
|
||||
list(APPEND private_options ${entry})
|
||||
elseif ("${writing_now}" STREQUAL "PUBLIC")
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ function(target_link_options_if_exists target_name)
|
|||
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
||||
set(writing_now ${entry})
|
||||
else()
|
||||
check_cxx_compiler_flag(${entry} flag_exists)
|
||||
if (flag_exists)
|
||||
string(MAKE_C_IDENTIFIER ${entry} entry_identifier)
|
||||
check_cxx_compiler_flag(${entry} DESKTOP_APP_${entry_identifier}_EXISTS)
|
||||
if (DESKTOP_APP_${entry_identifier}_EXISTS)
|
||||
if ("${writing_now}" STREQUAL "PRIVATE")
|
||||
list(APPEND private_options ${entry})
|
||||
elseif ("${writing_now}" STREQUAL "PUBLIC")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue