Skip to content

Commit

Permalink
Fix Cmake macro that disables unit tests when invoked as a subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
s-daveb committed May 11, 2024
1 parent 1bae9c5 commit d2e421b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions CMake/BuildProperties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit d2e421b

Please sign in to comment.