Fix Cmake macro that disables unit tests when invoked as a subproject

This commit is contained in:
S David 2024-05-11 16:28:11 -04:00
parent 1bae9c555c
commit d2e421ba76
2 changed files with 6 additions and 5 deletions

View File

@ -49,13 +49,14 @@ function(set_artifact_dir path)
endfunction()
function(disable_tests_if_subproject)
if (NOT DEFINED PROJECT_NAME)
option(BUILD_TESTING "Build and run unit tests" ON)
else()
option(BUILD_TESTING "Build and run unit tests" OFF)
option(BUILD_TESTING "Build unit tests" ON)
if (DEFINED PROJECT_NAME)
set(BUILD_TESTING OFF PARENT_SCOPE)
endif()
endfunction()
function(use_ccache)
option(USE_CCACHE
[=[Use ccache compiler cache to speed up builds.

View File

@ -13,7 +13,7 @@ disable_tests_if_subproject()
#git_setup_submodules()
project(QJsonModel
VERSION 0.0.6
VERSION 0.0.7
LANGUAGES C CXX
# Save this for later:
# HOMEPAGE_URL <URL>