CMake: Introduce QtFeatureCommon.cmake

This file provides common feature-functionality is supposed to be
included by QtFeature.cmake and QtProcessConfigureArgs.cmake.

Change-Id: Ifb483c2a9c4014d240c2a4d6ff07b5c0ceee9c3a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-08-12 09:17:21 +02:00
parent fb8aea60bd
commit fdd61b3a7b
3 changed files with 12 additions and 10 deletions

View File

@ -355,6 +355,7 @@ qt_copy_or_install(FILES
cmake/QtCompilerOptimization.cmake
cmake/QtConfigDependencies.cmake.in
cmake/QtFeature.cmake
cmake/QtFeatureCommon.cmake
cmake/QtFinishPrlFile.cmake
cmake/QtFindWrapHelper.cmake
cmake/QtFindWrapConfigExtra.cmake.in

View File

@ -1,3 +1,5 @@
include(QtFeatureCommon)
function(qt_feature_module_begin)
qt_parse_all_arguments(arg "qt_feature_module_begin"
"NO_MODULE;ONLY_EVALUATE_FEATURES"
@ -35,16 +37,6 @@ function(qt_feature_module_begin)
set(__QtFeature_define_definitions "" PARENT_SCOPE)
endfunction()
function(qt_feature_normalize_name name out_var)
# Normalize the feature name to something CMake can deal with.
if(name MATCHES "c\\+\\+")
string(REGEX REPLACE "[^a-zA-Z0-9_]" "x" name "${name}")
else()
string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" name "${name}")
endif()
set(${out_var} "${name}" PARENT_SCOPE)
endfunction()
function(qt_feature feature)
set(original_name "${feature}")
qt_feature_normalize_name("${feature}" feature)

View File

@ -0,0 +1,9 @@
function(qt_feature_normalize_name name out_var)
# Normalize the feature name to something CMake can deal with.
if(name MATCHES "c\\+\\+")
string(REGEX REPLACE "[^a-zA-Z0-9_]" "x" name "${name}")
else()
string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" name "${name}")
endif()
set(${out_var} "${name}" PARENT_SCOPE)
endfunction()