summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-10-05 11:09:07 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-10-08 23:15:31 +0200
commitf19668ce652844efbcd8cb675729b709163c3653 (patch)
tree9b6aa8d17a78d189fc66aab2044c2aeff4617286 /util/cmake/pro2cmake.py
parente5183c49dd0f1cc0698755e6821dce2805571e45 (diff)
Don't use libs in /usr/local for configure tests by default on macOS
Since commit f3c7d22dd04afe8d889585fb5d6426f3d4591e74 we do not use libraries from /usr/local and other non-system locations on macOS. But our configure tests still did. This led to discrepancies between find_package calls in configure tests and the Qt project itself. Mentioned commit removed /usr/local and friends from CMAKE_SYSTEM_PREFIX_PATH. But we can't pass this variable to the configure tests, because CMake sets it up and overwrites our value. Pass CMAKE_SYSTEM_PREFIX_PATH and CMAKE_SYSTEM_FRAMEWORK_PATH as QT_CONFIGURE_TEST_CMAKE_SYSTEM_{PREFIX|FRAMEWORK}_PATH variables to tests. Tests with separate project files that call find_package() must add code like this after the project() command: if(DEFINED QT_CONFIGURE_TEST_CMAKE_SYSTEM_PREFIX_PATH) set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIGURE_TEST_CMAKE_SYSTEM_PREFIX_PATH}") endif() if(DEFINED QT_CONFIGURE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH) set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIGURE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}") endif() Adjust pro2cmake accordingly. Task-number: QTBUG-97076 Change-Id: Iac1622768d1200e6ea63be569eef12b7eada6c76 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-xutil/cmake/pro2cmake.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index e3e46df549..1cba1a6935 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -4507,6 +4507,13 @@ def handle_config_test_project(scope: Scope, cm_fh: IO[str]):
f"cmake_minimum_required(VERSION 3.16)\n"
f"project(config_test_{project_name} LANGUAGES C CXX)\n"
"""
+if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH)
+ set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}")
+endif()
+if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH)
+ set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}")
+endif()
+
foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES})
find_package(${p})
endforeach()