Allow to disable excluding tests from all target

This commit is contained in:
Martchus 2017-03-23 20:31:57 +01:00
parent 89e79275e0
commit fdbe874bcd
3 changed files with 11 additions and 2 deletions

View File

@ -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_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_MAJOR 4)
set(META_VERSION_MINOR 6) set(META_VERSION_MINOR 6)
set(META_VERSION_PATCH 1) set(META_VERSION_PATCH 2)
# find required 3rd party libraries # find required 3rd party libraries
include(3rdParty) include(3rdParty)

View File

@ -5,6 +5,8 @@ if(TEST_CONFIG_DONE)
message(FATAL_ERROR "Can not include TestTarget module when tests are already configured.") message(FATAL_ERROR "Can not include TestTarget module when tests are already configured.")
endif() 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 # always link test applications against c++utilities and cppunit
find_library(CPP_UNIT_LIB cppunit) find_library(CPP_UNIT_LIB cppunit)
@ -27,7 +29,12 @@ if(CPP_UNIT_LIB)
endif() endif()
# add test executable, but exclude it from the "all target" # 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 # 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 if(NOT META_PROJECT_TYPE OR "${META_PROJECT_TYPE}" STREQUAL "library") # default project type is library

View File

@ -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 * `LOGGING_ENABLED=ON/OFF`: enables further loggin in some applications
* `FORCE_OLD_ABI=ON/OFF`: forces use of old C++ ABI * `FORCE_OLD_ABI=ON/OFF`: forces use of old C++ ABI
(sets `_GLIBCXX_USE_CXX11_ABI=0`) (sets `_GLIBCXX_USE_CXX11_ABI=0`)
* `EXCLUDE_TESTS_FROM_ALL=ON/OFF`: excludes tests from the all target
(enabled by default)
#### Windows specific #### Windows specific
* `USE_NATIVE_FILE_BUFFER=ON/OFF`: use native function to open file streams * `USE_NATIVE_FILE_BUFFER=ON/OFF`: use native function to open file streams