summaryrefslogtreecommitdiffstats
path: root/cmake/QtFeatureCommon.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/QtFeatureCommon.cmake')
-rw-r--r--cmake/QtFeatureCommon.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/QtFeatureCommon.cmake b/cmake/QtFeatureCommon.cmake
new file mode 100644
index 0000000000..9b49d4fcac
--- /dev/null
+++ b/cmake/QtFeatureCommon.cmake
@@ -0,0 +1,12 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+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()