diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-13 15:35:26 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-13 14:59:55 +0000 |
commit | cfcd50875b84273942709f224a1cf37fa70b41b7 (patch) | |
tree | 5c38796a008bf67a58e5d86d8a7bd5ca4b1d32d2 | |
parent | 60c2f9f3b4603398674dfb8ec9020a7920c64eb2 (diff) |
Try to find Test package before calling add_subdirectory(src)
in qt_build_repo().
This is important for qtdeclarative for example, which builds QmlTest
functionality in ./src, and thus needs Test lib to be available.
Change-Id: I84326d79844526f2f177c19de30bab0c858773e3
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index eeba186a70..b2b262d05c 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -69,6 +69,13 @@ endmacro() macro(qt_build_repo) qt_build_repo_begin(${ARGN}) + # If testing is enabled, try to find the qtbase Test package. + # Do this before adding src, because there might be test related conditions + # in source. + if (BUILD_TESTING) + find_package(Qt5 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test) + endif() + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists.txt") add_subdirectory(src) endif() @@ -80,7 +87,6 @@ macro(qt_build_repo) endif() if (BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt") - find_package(Qt5 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test Xml) add_subdirectory(tests) endif() |