From f19668ce652844efbcd8cb675729b709163c3653 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 5 Oct 2021 11:09:07 +0200 Subject: 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 Reviewed-by: Alexandru Croitor --- cmake/QtFeature.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'cmake') 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() -- cgit v1.2.3