1############################################ 2# 3# How to build bsdcpio_test 4# 5############################################ 6IF(ENABLE_CPIO AND ENABLE_TEST) 7 SET(bsdcpio_test_SOURCES 8 ../cmdline.c 9 ../../libarchive_fe/err.c 10 ../../libarchive_fe/pathmatch.c 11 main.c 12 test.h 13 test_0.c 14 test_basic.c 15 test_cmdline.c 16 test_format_newc.c 17 test_gcpio_compat.c 18 test_option_B_upper.c 19 test_option_C_upper.c 20 test_option_J_upper.c 21 test_option_L_upper.c 22 test_option_Z_upper.c 23 test_option_a.c 24 test_option_c.c 25 test_option_d.c 26 test_option_f.c 27 test_option_help.c 28 test_option_l.c 29 test_option_lzma.c 30 test_option_m.c 31 test_option_t.c 32 test_option_u.c 33 test_option_version.c 34 test_option_y.c 35 test_option_z.c 36 test_owner_parse.c 37 test_passthrough_dotdot.c 38 test_passthrough_reverse.c 39 test_pathmatch.c 40 ) 41 IF(WIN32 AND NOT CYGWIN) 42 LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.h) 43 ENDIF(WIN32 AND NOT CYGWIN) 44 45 # 46 # Register target 47 # 48 ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES}) 49 SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS LIST_H) 50 51 # 52 # Generate list.h by grepping DEFINE_TEST() lines out of the C sources. 53 # 54 GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h 55 ${CMAKE_CURRENT_LIST_FILE} ${bsdcpio_test_SOURCES}) 56 SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES 57 ${CMAKE_CURRENT_BINARY_DIR}) 58 59 # list.h has a line DEFINE_TEST(testname) for every 60 # test. We can use that to define the tests for cmake by 61 # defining a DEFINE_TEST macro and reading list.h in. 62 MACRO (DEFINE_TEST _testname) 63 ADD_TEST_28( 64 NAME bsdcpio_${_testname} 65 COMMAND bsdcpio_test -vv 66 -p $<TARGET_FILE:bsdcpio> 67 -r ${CMAKE_CURRENT_SOURCE_DIR} 68 ${_testname}) 69 ENDMACRO (DEFINE_TEST _testname) 70 71 INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h) 72 73 # Experimental new test handling 74 ADD_CUSTOM_TARGET(run_bsdcpio_test 75 COMMAND bsdcpio_test -p ${BSDCPIO} -r ${CMAKE_CURRENT_SOURCE_DIR}) 76 ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio) 77 ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test) 78ENDIF(ENABLE_CPIO AND ENABLE_TEST) 79 80