Warning, /libraries/kdb/cmake/modules/KDbAddTests.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(__kdb_add_tests)
0011   return()
0012 endif()
0013 set(__kdb_add_tests YES)
0014 
0015 include(KDbAddSimpleOption)
0016 
0017 # Adds BUILD_TESTING option to enable all kinds of tests. If enabled, build in autotests/
0018 # and tests/ subdirectory is enabled. If optional argument ARG1 is ON, building tests will
0019 # be ON by default. Otherwise building tests will be OFF. ARG1 is OFF by default.
0020 # If tests are OFF, BUILD_COVERAGE is set to OFF.
0021 # If tests are on BUILD_TESTING macro is defined.
0022 macro(kdb_add_tests)
0023   if(KDE_INSTALL_TARGETS_DEFAULT_ARGS)
0024       message(FATAL_ERROR "Include before KDEInstallDirs!")
0025   endif()
0026   if (NOT "${ARG1}" STREQUAL "ON")
0027     set(_SET OFF)
0028   endif()
0029   simple_option(BUILD_TESTING "Build tests" ${_SET}) # override default from CTest.cmake
0030   if(BUILD_TESTING)
0031     add_definitions(-DBUILD_TESTING)
0032     include(CTest)
0033   else()
0034     if (BUILD_COVERAGE)
0035         set(BUILD_COVERAGE OFF)
0036         message(STATUS "Building with gcov support disabled because BUILD_TESTING is OFF")
0037     endif()
0038   endif()
0039 endmacro()