From d61ca95fc09531479e3d9343bf55d77065844c28 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 21 May 2019 09:04:27 +0200 Subject: [PATCH] Simplify top-level CMakeLists.txt for modules Implement some aspects of qt_parts.prf to simplify the top-level CMakeLists.txt for repositories that follow the common qt structure (src, tools, tests, examples). Change-Id: Ia35f4e9207e92c1cf0406353561b0cc52dcb0e59 Reviewed-by: Liang Qi Reviewed-by: Alexandru Croitor --- .../QtBuildInternalsConfig.cmake | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index 34e40365caf..767a9dc45fe 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -53,3 +53,23 @@ macro(qt_build_repo_end) RUNTIME_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) endmacro() + +macro(qt_build_repo) + qt_build_repo_begin(${ARGN}) + + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src") + add_subdirectory(src) + endif() + + if (BUILD_TESTING) + find_package(Qt5 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test Xml) + add_subdirectory(tests) + endif() + + if (BUILD_EXAMPLES) + # TODO: Implement me + #add_subdirectory(examples) + endif() + + qt_build_repo_end() +endmacro()