summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-05-24 19:18:21 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-05-28 17:02:38 +0000
commit3122e7c01a2ea163ba3c571e43e2ed7f768d27b5 (patch)
tree94163c375e232c3ea2f1e8b6b3da58a26c147726 /cmake
parentd843bceb0cf6ab5178fea43c194493d843665fdf (diff)
Fix qt_build_repo to be more robust
Check for the existence of CMakeLists.txt files before trying to call add_subdirectory on examples, tests and src folders. Change-Id: I7be76de5f7520c1dd181c610fd1dc2200ac74672 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index 6f0708bd80..125c8aba92 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -61,18 +61,17 @@ endmacro()
macro(qt_build_repo)
qt_build_repo_begin(${ARGN})
- if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src")
+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists.txt")
add_subdirectory(src)
endif()
- if (BUILD_TESTING)
+ 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()
- if (BUILD_EXAMPLES)
- # TODO: Implement me
- #add_subdirectory(examples)
+ if (BUILD_EXAMPLES AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt")
+ add_subdirectory(examples)
endif()
qt_build_repo_end()