summaryrefslogtreecommitdiffstats
path: root/cmake
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 /cmake
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 'cmake')
-rw-r--r--cmake/QtFeature.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index 3a366f05ae..a99edcb9bc 100644
--- a/cmake/QtFeature.cmake
+++ b/cmake/QtFeature.cmake
@@ -875,6 +875,18 @@ function(qt_config_compile_test name)
endif()
endif()
+ # Pass override values for CMAKE_SYSTEM_{PREFIX|FRAMEWORK}_PATH.
+ if(DEFINED QT_CMAKE_SYSTEM_PREFIX_PATH_BACKUP)
+ set(path_list ${CMAKE_SYSTEM_PREFIX_PATH})
+ string(REPLACE ";" "\\;" path_list "${path_list}")
+ list(APPEND flags "-DQT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH=${path_list}")
+ endif()
+ if(DEFINED QT_CMAKE_SYSTEM_FRAMEWORK_PATH_BACKUP)
+ set(path_list ${CMAKE_SYSTEM_FRAMEWORK_PATH})
+ string(REPLACE ";" "\\;" path_list "${path_list}")
+ list(APPEND flags "-DQT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH=${path_list}")
+ endif()
+
if(NOT arg_CMAKE_FLAGS)
set(arg_CMAKE_FLAGS "")
endif()
@@ -1016,6 +1028,9 @@ function(qt_get_platform_try_compile_vars out_var)
list(APPEND flags_cmd_line "-DCMAKE_OSX_SYSROOT:STRING=${QT_UIKIT_SDK}")
endif()
endif()
+ if(QT_NO_USE_FIND_PACKAGE_SYSTEM_ENVIRONMENT_PATH)
+ list(APPEND flags_cmd_line "-DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH:BOOL=OFF")
+ endif()
set("${out_var}" "${flags_cmd_line}" PARENT_SCOPE)
endfunction()