Allow to disable excluding tests from all target

experiment/smaller_static_bins
Martchus 6 years ago
parent 89e79275e0
commit fdbe874bcd
  1. 2
      CMakeLists.txt
  2. 9
      cmake/modules/TestTarget.cmake
  3. 2
      doc/buildvariables.md

@ -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)

@ -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

@ -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

Loading…
Cancel
Save