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:36:27 +0000 |
commit | 213590f8ea7ec70ed69380e3f010d488549efe4a (patch) | |
tree | 75c59e76af6f400377f846a58aef9bbc4f91e578 | |
parent | c7a731d9875dfbca8128deb8ae746618f83d111a (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>
-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 6ade39fc8d..1eb3de0128 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -732,7 +732,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() @@ -814,15 +814,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 |