summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-10-12 17:15:12 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-13 01:00:17 +0000
commitba8b039995f6a1850b4f52e2bcde67fbea535be2 (patch)
treeaa30a3866473a0039e2ba40260522ec90b02dbc5
parent54e212fdb63a4b4e8b2b77cb087d54a5c4a64aea (diff)
CMake: Fix config tests not finding module-provided CMake packages
This amends commit 165e01d5d51d16377542c1b3ffbc22f03fb75e97. Above commit broke the code that adds "${PROJECT_SOURCE_DIR}/cmake" to CMAKE_MODULE_PATH. The semicolon that separates entries of CMAKE_MODULE_PATH must be escaped. Otherwise, the semicolon separates elements of the flags list. Additionally, fix the QT_AVOID_CUSTOM_PLATFORM_MODULES code path which lacked the addition of "${PROJECT_SOURCE_DIR}/cmake". Change-Id: I72f78cf066cabe6b0002dce1aa0294aa0dc9cbf0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 8b09c9d6902dd49a665df8a02ecef8c5a7a4639e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--cmake/QtFeature.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index a4832a896b..2c262146ab 100644
--- a/cmake/QtFeature.cmake
+++ b/cmake/QtFeature.cmake
@@ -801,14 +801,19 @@ function(qt_config_compile_test name)
# If the repo has its own cmake modules, include those in the module path, so that various
# find_package calls work.
if(EXISTS "${PROJECT_SOURCE_DIR}/cmake")
+ set(must_append_module_path_flag TRUE)
set(flags_copy "${flags}")
set(flags)
foreach(flag IN LISTS flags_copy)
if(flag MATCHES "^-DCMAKE_MODULE_PATH:STRING=")
- set(flag "${flag};${PROJECT_SOURCE_DIR}/cmake")
+ set(must_append_module_path_flag FALSE)
+ set(flag "${flag}\\;${PROJECT_SOURCE_DIR}/cmake")
endif()
list(APPEND flags "${flag}")
endforeach()
+ if(must_append_module_path_flag)
+ list(APPEND flags "-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/cmake")
+ endif()
endif()
# Pass which packages need to be found.