summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-10-12 17:15:12 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-10-13 00:50:03 +0200
commit8b09c9d6902dd49a665df8a02ecef8c5a7a4639e (patch)
treee5ddd71506d29dcdc8f9d4190f262f454812fe67 /cmake
parent0098e0ca86b69cfbd89528977dadb2ac3e616eed (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". Pick-to: 6.2 Change-Id: I72f78cf066cabe6b0002dce1aa0294aa0dc9cbf0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtFeature.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index a99edcb9bc..c5e882649c 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.