Load RunCMake variables from cache
Allow to define variables used in `ConfigureBuildQt` at configure time. The preference is local var -> environment var -> cache var -> default. Change-Id: Ib4bc4f31b3764a6c734e24562d18418560c3a8a8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
0583292728
commit
f7af48b07e
@ -20,10 +20,21 @@ endfunction()
|
|||||||
|
|
||||||
# Query the var name from the CMake cache or the environment or use a default value.
|
# Query the var name from the CMake cache or the environment or use a default value.
|
||||||
function(get_cmake_or_env_or_default out_var var_name_to_check default_value)
|
function(get_cmake_or_env_or_default out_var var_name_to_check default_value)
|
||||||
|
# Load the cache variables from the build dir containing the ConfigueBuildQt test
|
||||||
|
# RunCMake_BINARY_DIR is not actually created at this point so we have to normalize the path
|
||||||
|
cmake_path(SET actual_BINARY_DIR NORMALIZE "${RunCMake_BINARY_DIR}/..")
|
||||||
|
load_cache("${actual_BINARY_DIR}"
|
||||||
|
READ_WITH_PREFIX CACHE_VAL_ "${var_name_to_check}"
|
||||||
|
)
|
||||||
if(${var_name_to_check})
|
if(${var_name_to_check})
|
||||||
|
# This is set within the script, highest priority
|
||||||
set(value "${var_name_to_check}")
|
set(value "${var_name_to_check}")
|
||||||
elseif(DEFINED ENV{${var_name_to_check}})
|
elseif(DEFINED ENV{${var_name_to_check}})
|
||||||
|
# This may be used to change parameters at ctest runtime
|
||||||
set(value "$ENV{${var_name_to_check}}")
|
set(value "$ENV{${var_name_to_check}}")
|
||||||
|
elseif(DEFINED CACHE_VAL_${var_name_to_check})
|
||||||
|
# These parameters are set at configure time
|
||||||
|
set(value "${CACHE_VAL_${var_name_to_check}}")
|
||||||
else()
|
else()
|
||||||
set(value "${default_value}")
|
set(value "${default_value}")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user