mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-13 03:30:42 +02:00
cmake: Respect user-provided configuration-specific flags
This commit is contained in:
parent
de90b47ea0
commit
edde96376a
@ -19,6 +19,10 @@ if(POLICY CMP0171)
|
|||||||
cmake_policy(SET CMP0171 NEW)
|
cmake_policy(SET CMP0171 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# When adjusting CMake flag variables, we must not override those explicitly
|
||||||
|
# set by the user. These are a subset of the CACHE_VARIABLES property.
|
||||||
|
get_directory_property(precious_variables CACHE_VARIABLES)
|
||||||
|
|
||||||
#=============================
|
#=============================
|
||||||
# Project / Package metadata
|
# Project / Package metadata
|
||||||
#=============================
|
#=============================
|
||||||
|
@ -105,14 +105,13 @@ function(remove_cxx_flag_from_all_configs flag)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(replace_cxx_flag_in_config config old_flag new_flag)
|
function(replace_cxx_flag_in_config config old_flag new_flag)
|
||||||
string(TOUPPER "${config}" config_uppercase)
|
string(TOUPPER "CMAKE_CXX_FLAGS_${config}" var_name)
|
||||||
string(REGEX REPLACE "(^| )${old_flag}( |$)" "\\1${new_flag}\\2" new_flags "${CMAKE_CXX_FLAGS_${config_uppercase}}")
|
if("${var_name}" IN_LIST precious_variables)
|
||||||
set(CMAKE_CXX_FLAGS_${config_uppercase} "${new_flags}" PARENT_SCOPE)
|
return()
|
||||||
set(CMAKE_CXX_FLAGS_${config_uppercase} "${new_flags}"
|
endif()
|
||||||
CACHE STRING
|
string(REGEX REPLACE "(^| )${old_flag}( |$)" "\\1${new_flag}\\2" ${var_name} "${${var_name}}")
|
||||||
"Flags used by the CXX compiler during ${config_uppercase} builds."
|
set(${var_name} "${${var_name}}" PARENT_SCOPE)
|
||||||
FORCE
|
set_property(CACHE ${var_name} PROPERTY VALUE "${${var_name}}")
|
||||||
)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
set_default_config(RelWithDebInfo)
|
set_default_config(RelWithDebInfo)
|
||||||
|
Loading…
Reference in New Issue
Block a user