/usr/share/wibble/test.cmake is in libwibble-dev 1.1-2.
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 | macro( wibble_add_test name )
string( REPLACE ".test.h" ".cpp" SOURCES "${ARGN}" )
set( SOURCES ";${SOURCES}" )
string( REPLACE "/" "_" SOURCES "${SOURCES}" )
string( REPLACE ":" "_" SOURCES "${SOURCES}" )
set( src_prefix "${CMAKE_CURRENT_BINARY_DIR}/${name}-generated-" )
string( REPLACE ";" ";${src_prefix}" SOURCES "${SOURCES}" )
string( REGEX REPLACE "^;" "" SOURCES "${SOURCES}" )
set( main "${src_prefix}main.cpp" )
if( NOT WIBBLE_TEST_GENRUNNER )
include( FindPerl )
set( generator
"${PERL_EXECUTABLE}" "${wibble_SOURCE_DIR}/test-genrunner.pl" )
set( generator_dep"${wibble_SOURCE_DIR}/test-genrunner.pl" )
else( NOT WIBBLE_TEST_GENRUNNER )
set( generator ${WIBBLE_TEST_GENRUNNER} )
set( generator_dep ${generator} )
endif( NOT WIBBLE_TEST_GENRUNNER )
set( HDRS "${ARGN}" )
list( LENGTH SOURCES SOURCE_N )
math( EXPR SOURCE_N "${SOURCE_N} - 1" )
foreach( i RANGE ${SOURCE_N} )
LIST( GET HDRS ${i} HDR )
LIST( GET SOURCES ${i} SRC )
add_custom_command(
OUTPUT ${SRC}
DEPENDS ${generator_dep} ${HDR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${generator} header ${HDR} > ${SRC}
)
endforeach( i )
add_custom_command(
OUTPUT ${main}
DEPENDS ${generator_dep} ${ARGN}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${generator} main ${ARGN} > ${main}
)
set_source_files_properties( ${SOURCES} ${main} PROPERTIES GENERATED ON )
add_executable( ${name} ${SOURCES} ${main} )
endmacro( wibble_add_test )
# TODO the LD_LIBRARY_PATH may need to be set more elaborately
macro( wibble_check_target tgt )
add_custom_target( unit_${tgt}
COMMAND sh -c "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR} ${WIBBLE_WRAP_TESTS} ${CMAKE_CURRENT_BINARY_DIR}/${tgt}"
VERBATIM
DEPENDS ${ARGV} )
add_dependencies( unit unit_${tgt} )
endmacro( wibble_check_target )
|