Warning, /libraries/kreport/cmake/modules/KReportAddTests.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(__kreport_add_tests)
0011 return()
0012 endif()
0013 set(__kreport_add_tests YES)
0014
0015 include(KReportAddSimpleOption)
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(kreport_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 set(BUILD_COVERAGE OFF)
0035 simple_option(BUILD_COVERAGE "Build test coverage (disabled because BUILD_TESTING is OFF)" OFF)
0036 endif()
0037 endmacro()