cmake: build repo helpers - fine-grained test/example options
the tests/examples could only be enabled globally. when working on a specific repo, it's beneficial to disable tests/examples for other projects to reduce project sizes (and cmake configure/generate times) Change-Id: I0026ba87b667d427043cc8eb1baa6c28b2046dd7 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 25b89f2c88cdfc98bfa462949531a33f7ef50996) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
8501df2c09
commit
bd17f3f370
@ -203,15 +203,8 @@ endif()
|
||||
|
||||
qt_build_repo_post_process()
|
||||
|
||||
if(QT_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
|
||||
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
|
||||
endif()
|
||||
endif()
|
||||
qt_build_repo_impl_tests()
|
||||
|
||||
qt_build_repo_end()
|
||||
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS AND QT_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
qt_build_repo_impl_examples()
|
||||
|
@ -428,9 +428,13 @@ endmacro()
|
||||
|
||||
macro(qt_build_repo_impl_tests)
|
||||
if (QT_BUILD_TESTS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt")
|
||||
add_subdirectory(tests)
|
||||
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
|
||||
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
|
||||
option(QT_BUILD_TESTS_PROJECT_${PROJECT_NAME} "Configure tests for project ${PROJECT_NAME}" TRUE)
|
||||
|
||||
if (QT_BUILD_TESTS_PROJECT_${PROJECT_NAME})
|
||||
add_subdirectory(tests)
|
||||
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
|
||||
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
@ -440,7 +444,11 @@ macro(qt_build_repo_impl_examples)
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt"
|
||||
AND NOT QT_BUILD_STANDALONE_TESTS)
|
||||
message(STATUS "Configuring examples.")
|
||||
add_subdirectory(examples)
|
||||
|
||||
option(QT_BUILD_EXAMPLES_PROJECT_${PROJECT_NAME} "Configure examples for project ${PROJECT_NAME}" TRUE)
|
||||
if (QT_BUILD_EXAMPLES_PROJECT_${PROJECT_NAME})
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user