Warning, /frameworks/extra-cmake-modules/modules/ECMMarkAsTest.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2012 Stephen Kelly <steveire@gmail.com>
0002 # SPDX-FileCopyrightText: 2012 Alex Neundorf <neundorf@kde.org>
0003 #
0004 # SPDX-License-Identifier: BSD-3-Clause
0005
0006 #[=======================================================================[.rst:
0007 ECMMarkAsTest
0008 -------------
0009
0010 Marks a target as only being required for tests.
0011
0012 ::
0013
0014 ecm_mark_as_test(<target1> [<target2> [...]])
0015
0016 This will cause the specified targets to not be built unless either
0017 ``BUILD_TESTING`` is set to ``ON`` or the user invokes the ``buildtests`` target.
0018
0019 ``BUILD_TESTING`` is created as a cache variable by the CTest module and by the
0020 :kde-module:`KDECMakeSettings` module.
0021
0022 Since pre-1.0.0.
0023 #]=======================================================================]
0024
0025 if (NOT BUILD_TESTING)
0026 if(NOT TARGET buildtests)
0027 add_custom_target(buildtests)
0028 endif()
0029 endif()
0030
0031 function(ecm_mark_as_test)
0032 if (NOT BUILD_TESTING)
0033 foreach(_target ${ARGN})
0034 set_target_properties(${_target}
0035 PROPERTIES
0036 EXCLUDE_FROM_ALL TRUE
0037 )
0038 add_dependencies(buildtests ${_target})
0039 endforeach()
0040 endif()
0041 endfunction()