summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-03-25 16:08:26 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-04-05 13:39:38 +0200
commita31b51f835bf1b0d8af4206448bc34404db6ccdf (patch)
tree4aa3717c36e9a284322b37c9457e62e239c85f02 /cmake
parent1d4479add8b2ae6cb04ac232b0d7c85d81ad7467 (diff)
CMake: Allow specifying custom install dir for non-EP examples
Originally, QT_INTERNAL_EXAMPLES_INSTALL_PREFIX was added to control the installation of examples when they are built as ExternalProjects, and was not considered for the non-EP case because we hoped to switch entirely to EP-based building. Due to some unsolved issues regarding using EP builds in CI, add the ability to control the installation of non-EP examples. This will be used in the CI to allow removing the hacky INSTALL_EXAMPLEDIR and INSTALL_EXAMPLESDIR assignments in example projects. It is also likely that we will not deprecate the non-EP based building, because it is useful for IDE integration (EP targets are not as developer-friendly to work with in an IDE in regards to rebuilding). Amends 98c89c8cc1c5ceb4bfbb5f5ed6c96ecdbab99afa Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: I02264aaa1daa2c80bb9ef3d02b1831b4ca5d2b84 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 9a18facc66d729a7d9d0a186da49b4b7251fda8b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index f937f4551a..f09417b333 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -896,8 +896,15 @@ unset(CMAKE_INSTALL_PREFIX)
# Override the install prefix in the subdir cmake_install.cmake, so that
# relative install(TARGETS DESTINATION) calls in example projects install where we tell them to.
- set(CMAKE_INSTALL_PREFIX
- "${CMAKE_INSTALL_PREFIX}/${INSTALL_EXAMPLESDIR}/${example_rel_path}")
+ # Allow customizing the installation path of the examples. Will be used in CI.
+ if(QT_INTERNAL_EXAMPLES_INSTALL_PREFIX)
+ set(qt_example_install_prefix "${QT_INTERNAL_EXAMPLES_INSTALL_PREFIX}")
+ else()
+ set(qt_example_install_prefix "${CMAKE_INSTALL_PREFIX}/${INSTALL_EXAMPLESDIR}")
+ endif()
+ file(TO_CMAKE_PATH "${qt_example_install_prefix}" qt_example_install_prefix)
+
+ set(CMAKE_INSTALL_PREFIX "${qt_example_install_prefix}/${example_rel_path}")
# Make sure unclean example projects have their INSTALL_EXAMPLEDIR set to "."
# Won't have any effect on example projects that don't use INSTALL_EXAMPLEDIR.