diff --git a/CMakeLists.txt b/CMakeLists.txt index 184dfa3..8aa70df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}") set(META_APP_DESCRIPTION "Common C++ classes and routines used by my applications such as argument parser, IO and conversion utilities") set(META_VERSION_MAJOR 4) set(META_VERSION_MINOR 6) -set(META_VERSION_PATCH 1) +set(META_VERSION_PATCH 2) # find required 3rd party libraries include(3rdParty) diff --git a/cmake/modules/TestTarget.cmake b/cmake/modules/TestTarget.cmake index 2d8f5aa..f96abf2 100644 --- a/cmake/modules/TestTarget.cmake +++ b/cmake/modules/TestTarget.cmake @@ -5,6 +5,8 @@ if(TEST_CONFIG_DONE) message(FATAL_ERROR "Can not include TestTarget module when tests are already configured.") endif() +option(EXCLUDE_TESTS_FROM_ALL "specifies whether to exclude tests from the \"all\" target (enabled by default)" ON) + # always link test applications against c++utilities and cppunit find_library(CPP_UNIT_LIB cppunit) @@ -27,7 +29,12 @@ if(CPP_UNIT_LIB) endif() # add test executable, but exclude it from the "all target" - add_executable(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_tests EXCLUDE_FROM_ALL ${TEST_HEADER_FILES} ${TEST_SRC_FILES}) + if(EXCLUDE_TESTS_FROM_ALL) + set(TESTS_EXCLUSION EXCLUDE_FROM_ALL) + else() + unset(TESTS_EXCLUSION) + endif() + add_executable(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_tests ${TESTS_EXCLUSION} ${TEST_HEADER_FILES} ${TEST_SRC_FILES}) # test applications of my projects always use c++utilities and cppunit if(NOT META_PROJECT_TYPE OR "${META_PROJECT_TYPE}" STREQUAL "library") # default project type is library diff --git a/doc/buildvariables.md b/doc/buildvariables.md index 401c076..4c9d255 100644 --- a/doc/buildvariables.md +++ b/doc/buildvariables.md @@ -36,6 +36,8 @@ None of these are enabled or set by default, unless stated otherwise. * `LOGGING_ENABLED=ON/OFF`: enables further loggin in some applications * `FORCE_OLD_ABI=ON/OFF`: forces use of old C++ ABI (sets `_GLIBCXX_USE_CXX11_ABI=0`) +* `EXCLUDE_TESTS_FROM_ALL=ON/OFF`: excludes tests from the all target + (enabled by default) #### Windows specific * `USE_NATIVE_FILE_BUFFER=ON/OFF`: use native function to open file streams