1 ############################################
3 # How to build bsdtar_test
5 ############################################
6 IF(ENABLE_TAR AND ENABLE_TEST)
7 SET(bsdtar_test_SOURCES
23 test_strip_components.c
28 IF(WIN32 AND NOT CYGWIN)
29 LIST(APPEND bsdtar_test_SOURCES ../bsdtar_windows.c)
30 LIST(APPEND bsdtar_test_SOURCES ../bsdtar_windows.h)
31 ENDIF(WIN32 AND NOT CYGWIN)
36 ADD_EXECUTABLE(bsdtar_test ${bsdtar_test_SOURCES})
37 SET_PROPERTY(TARGET bsdtar_test PROPERTY COMPILE_DEFINITIONS LIST_H)
40 # Generate list.h by grepping DEFINE_TEST() lines out of the C sources.
42 GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
43 ${CMAKE_CURRENT_LIST_FILE} ${bsdtar_test_SOURCES})
44 SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
45 ${CMAKE_CURRENT_BINARY_DIR})
47 # list.h has a line DEFINE_TEST(testname) for every
48 # test. We can use that to define the tests for cmake by
49 # defining a DEFINE_TEST macro and reading list.h in.
50 MACRO (DEFINE_TEST _testname)
52 NAME bsdtar_${_testname}
53 COMMAND bsdtar_test -vv
54 -p $<TARGET_FILE:bsdtar>
55 -r ${CMAKE_CURRENT_SOURCE_DIR}
57 ENDMACRO (DEFINE_TEST _testname)
59 INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
61 # Experimental new test handling
62 ADD_CUSTOM_TARGET(run_bsdtar_test
63 COMMAND bsdtar_test -p ${BSDTAR} -r ${CMAKE_CURRENT_SOURCE_DIR})
64 ADD_DEPENDENCIES(run_bsdtar_test bsdtar)
65 ADD_DEPENDENCIES(run_all_tests run_bsdtar_test)
67 ENDIF (ENABLE_TAR AND ENABLE_TEST)