Warning, /office/kexi/cmake/modules/KexiAddTests.cmake is written in an unsupported language. File is not indexed.

0001 # Additional CMake macros
0002 #
0003 # Copyright (C) 2015-2017 Jarosław Staniek <staniek@kde.org>
0004 #
0005 # Redistribution and use is allowed according to the terms of the BSD license.
0006 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0007 #
0008 # Note: the file must be included before KDEInstallDirs or add_tests() won't fully work
0009 
0010 if(__kexi_add_tests)
0011   return()
0012 endif()
0013 set(__kexi_add_tests YES)
0014 
0015 include(KexiAddSimpleOption)
0016 include(MacroBoolTo01)
0017 
0018 # Adds BUILD_TESTING option to enable all kinds of tests. If enabled, build in autotests/
0019 # and tests/ subdirectory is enabled. If optional argument ARG1 is ON, building tests will
0020 # be ON by default. Otherwise building tests will be OFF. ARG1 is OFF by default.
0021 # If tests are OFF, BUILD_COVERAGE is set to OFF.
0022 # If tests are on BUILD_TESTING macro is defined.
0023 macro(kexi_add_tests)
0024   if(KDE_INSTALL_TARGETS_DEFAULT_ARGS)
0025       message(FATAL_ERROR "Include before KDEInstallDirs!")
0026   endif()
0027   if (NOT "${ARG1}" STREQUAL "ON")
0028     set(_SET OFF)
0029   endif()
0030   simple_option(BUILD_TESTING "Build tests" ${_SET}) # override default from CTest.cmake
0031   if(BUILD_TESTING)
0032     add_definitions(-DBUILD_TESTING)
0033     include(CTest)
0034   else()
0035     set(BUILD_COVERAGE OFF)
0036     simple_option(BUILD_COVERAGE "Build test coverage (disabled because BUILD_TESTING is OFF)" OFF)
0037   endif()
0038 
0039   # only with COMPILING_TESTS definition will all the FOO_TEST_EXPORT macros do something
0040   # TODO: check if this can be moved to only those places which make use of it,
0041   # to reduce global compiler definitions that would trigger a recompile of
0042   # everything on a change (like adding/removing tests to/from the build)
0043   macro_bool_to_01(BUILD_TESTING COMPILING_TESTS)
0044 endmacro()