/usr/share/dune/cmake/modules/DuneTestMacros.cmake is in libdune-common-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # Module provides macros that allow for on demand test building.
# In DUNE tests are not built by make all but by make test.
#
# Provides the following macros:
#
# test_dep()
#
# Finds all directories called test and creates a dependency for
# testing that calls builds the tests for this directory.
#
#
# add_directory_test_target(_target)
#
# Creates a custom target for building
# the tests in the current directory.
#
# The target name will be the path of the
# current directory relative to ${CMAKE_BINARY_DIR}
# with all slashes replaced by underlines.
# E.g. for dune/istl/test the target will be dune_istl_test.
#
macro(test_dep)
dune_common_script_dir(SCRIPT_DIR)
get_filename_component(RELPATH "${CMAKE_SOURCE_DIR}" REALPATH)
execute_process(COMMAND ${CMAKE_COMMAND} -D RELPATH=${RELPATH} -P ${SCRIPT_DIR}/FindFiles.cmake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE _res ERROR_VARIABLE _dirs)
foreach(_dir ${_dirs})
string(REGEX REPLACE "([^ \t\n]+)[ \n\t]*$" "\\1" _dir ${_dir})
set_property(DIRECTORY ${_dir} PROPERTY TEST_INCLUDE_FILE ${CMAKE_BINARY_DIR}/${_dir}/BuildTests.cmake)
endforeach(_dir ${_dirs})
endmacro(test_dep)
macro(get_directory_test_target _target _dir)
string(REPLACE "${CMAKE_BINARY_DIR}" "" _relative_dir "${_dir}")
string(REPLACE "/" "_" ${_target} "${_relative_dir}")
endmacro(get_directory_test_target _target _dir)
#
# - Create a custom target for building
# the tests in the current directory.
#
# The target name will be the path of the
# current directory relative to ${CMAKE_BINARY_DIR}
# with all slashes replaced by underlines.
# E.g. for dune/istl/test the target will be dune_istl_test.
#
macro(add_directory_test_target _target)
get_directory_test_target(${_target} "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_target(${${_target}})
dune_common_script_dir(SCRIPT_DIR)
configure_file(${SCRIPT_DIR}/BuildTests.cmake.in BuildTests.cmake @ONLY)
endmacro(add_directory_test_target)
|