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 <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-05-21 09:04:27 +02:00
parent a859cb508c
commit d61ca95fc0

View File

@ -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()