summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-09-05 18:17:00 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-09-06 09:33:38 +0000
commit6c00d9075e19c949e6cf5b401fc4e42784fd5bf0 (patch)
tree5890a9fd456f50ed11fcf8c33f18bd3b7c00af9a /cmake
parent9c1b7802d7f118b55ccc04dab74e1ee19e6d429f (diff)
Use $$source_path/qtbase/cmake modules when doing non-prefix builds
This is similar to qmake, where the .prf files from the source location of qtbase/mkspecs are used in a non-prefix build. This means that if a developer changes the source QtBuild.cmake, and then runs make in qtdeclarative, cmake will reconfigure qtdeclarative because the timestamp of QtBuild.cmake changed. Before this change you first had to make && make install in the qtbase build directory, before qtdeclarative saw the modified QtBuild.cmake. This change also makes the module paths be prepended to CMAKE_MODULE_PATH instead of appended, which means they will take precedence to any path provided via command line. Change-Id: I9178d5183a95b3b67bfe1b1fe91d3d3371ffe5c5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake17
1 files changed, 14 insertions, 3 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index 1ebd321753..c7c6f757a4 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -13,13 +13,24 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/QtBuildInternalsExtra.cmake")
endif()
macro(qt_set_up_build_internals_paths)
- # Set up the paths for the modules.
+ # Set up the paths for the cmake modules located in the build dir. Prepend, so the paths are
+ # least important compared to the source dir ones, but more important than command line
+ # provided ones.
set(QT_CMAKE_MODULE_PATH "${QT_BUILD_INTERNALS_PATH}/../${QT_CMAKE_EXPORT_NAMESPACE}")
- list(APPEND CMAKE_MODULE_PATH ${QT_CMAKE_MODULE_PATH})
+ list(PREPEND CMAKE_MODULE_PATH "${QT_CMAKE_MODULE_PATH}")
+
+ # When doing a non-prefix build, prepend the qtbase source cmake directory to CMAKE_MODULE_PATH,
+ # so that if a change is done in cmake/QtBuild.cmake, it gets automatically picked up when
+ # building qtdeclarative, rather than having to build qtbase first (which will copy
+ # QtBuild.cmake to the build dir). This is similar to qmake non-prefix builds, where the
+ # source qtbase/mkspecs directory is used.
+ if(NOT QT_WILL_INSTALL)
+ list(PREPEND CMAKE_MODULE_PATH "${QT_SOURCE_TREE}/cmake")
+ endif()
# If the repo has its own cmake modules, include those in the module path.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
- list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+ list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
endif()
endmacro()