diff options
author | Samuli Piippo <samuli.piippo@qt.io> | 2022-07-06 16:00:14 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-07-26 17:35:54 +0000 |
commit | eee2246f3aa6fbcfa2b8a2e179e6b45c0d299f26 (patch) | |
tree | 96966775f57d15b991f31b7eaaacb65efc3279b1 /cmake | |
parent | 0cdc0ea4c2f193676b2388f8d3a39b697cd25f85 (diff) |
CMake: prepend build dir for examples build
In cross-compilation, the CMAKE_FIND_ROOT_PATH will have path to the
host Qt and examples build will pick up wrong Qt6Config.cmake unless
the build dir path is prepended.
Fixes: QTBUG-104270
Change-Id: I7fc7499369a2e5446e1c5257155f81c72716fef7
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 18ed6a8979a1f1910f1285b5b2e5a28c397b37aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index 944a4fef99..4c4adaac0f 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -709,7 +709,7 @@ endfunction() # Mean to be called when configuring examples as part of the main build tree, as well as for CMake # tests (tests that call CMake to try and build CMake applications). macro(qt_internal_set_up_build_dir_package_paths) - list(APPEND CMAKE_PREFIX_PATH "${QT_BUILD_DIR}") + list(PREPEND CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake") # Make sure the CMake config files do not recreate the already-existing targets set(QT_NO_CREATE_TARGETS TRUE) endmacro() @@ -791,15 +791,15 @@ macro(qt_examples_build_begin) # Examples that are built as part of the Qt build need to use the CMake config files from the # build dir, because they are not installed yet in a prefix build. - # Appending to CMAKE_PREFIX_PATH helps find the initial Qt6Config.cmake. - # Appending to QT_EXAMPLES_CMAKE_PREFIX_PATH helps find components of Qt6, because those + # Prepending to CMAKE_PREFIX_PATH helps find the initial Qt6Config.cmake. + # Prepending to QT_EXAMPLES_CMAKE_PREFIX_PATH helps find components of Qt6, because those # find_package calls use NO_DEFAULT_PATH, and thus CMAKE_PREFIX_PATH is ignored. - # Appending to CMAKE_FIND_ROOT_PATH ensures the components are found while cross-compiling + # Prepending to CMAKE_FIND_ROOT_PATH ensures the components are found while cross-compiling # without setting CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH. if(NOT QT_IS_EXTERNAL_EXAMPLES_BUILD OR NOT __qt_all_examples_ported_to_external_projects) qt_internal_set_up_build_dir_package_paths() - list(APPEND CMAKE_FIND_ROOT_PATH "${QT_BUILD_DIR}") - list(APPEND QT_EXAMPLES_CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake") + list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_BUILD_DIR}") + list(PREPEND QT_EXAMPLES_CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake") endif() # Because CMAKE_INSTALL_RPATH is empty by default in the repo project, examples need to have |