File: CMakeLists.txt

package info (click to toggle)
lizardfs 3.12.0+dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 8,064 kB
  • sloc: cpp: 91,899; sh: 9,341; python: 3,878; ansic: 3,109; pascal: 128; makefile: 57
file content (33 lines) | stat: -rw-r--r-- 1,477 bytes parent folder | download | duplicates (3)
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
include_directories(${GTEST_INCLUDE_DIRS})

# Create automatically generated list of test cases
add_custom_target(list_of_test_cases
  COMMAND ls ${CMAKE_CURRENT_SOURCE_DIR}/test_suites
    | xargs -IXXX echo "class XXX : public BashTestingSuite {};"
    > test_suites.h.tmp
  COMMAND ${CMAKE_COMMAND} -E copy_if_different test_suites.h.tmp test_suites.h

  COMMAND find ${CMAKE_CURRENT_SOURCE_DIR}/test_suites/ -name test_*.sh
    | sed -e "s/[.]sh$//"
    | awk -F/ "{print $(NF-1) \",\" $NF}"
    | xargs -IXXX echo "add_test_case(XXX)"
    > test_cases.h.tmp
  COMMAND ${CMAKE_COMMAND} -E copy_if_different test_cases.h.tmp test_cases.h

  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  VERBATIM)
set_source_files_properties(lizardfs-tests.cc PROPERTIES
  OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test_cases.h
  OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test_suites.h)

# Create constants.sh file
configure_file(set_lizardfs_constants.sh.in set_lizardfs_constants.sh @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/set_lizardfs_constants.sh DESTINATION ${BIN_SUBDIR})

# Build executable running all the test cases
include_directories(${CMAKE_CURRENT_BINARY_DIR}) # test_cases.h is located here
add_definitions(-DTEST_DATA_PATH=/usr/share/lizardfs)
add_executable(lizardfs-tests lizardfs-tests.cc)
add_dependencies(lizardfs-tests list_of_test_cases)
target_link_libraries(lizardfs-tests gtest_main)
install(TARGETS lizardfs-tests RUNTIME DESTINATION ${BIN_SUBDIR})