File: CMakeLists.txt

package info (click to toggle)
mpich 4.3.0%2Breally4.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 419,120 kB
  • sloc: ansic: 1,215,557; cpp: 74,755; javascript: 40,763; f90: 20,649; sh: 18,463; xml: 14,418; python: 14,397; perl: 13,772; makefile: 9,279; fortran: 8,063; java: 4,553; asm: 324; ruby: 176; lisp: 19; php: 8; sed: 4
file content (59 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download | duplicates (4)
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
55
56
57
58
59

add_executable(test1Formatted test1.c parse_flags.c parse_flags.h)
target_compile_definitions(test1Formatted PRIVATE TEST_FORMATTED=1)
target_link_libraries(test1Formatted PRIVATE ${PROJECT_NAME})

add_executable(test2Formatted test2.c parse_flags.c parse_flags.h)
target_compile_definitions(test2Formatted PRIVATE TEST_FORMATTED=1)
target_link_libraries(test2Formatted PRIVATE ${PROJECT_NAME})

# https://cmake.org/cmake/help/v3.0/command/add_test.html
# https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/

include_directories(PUBLIC ${CMAKE_SOURCE_DIR})

foreach(TESTNAME
	test1
	test2
	test4
	testReplaceExisting
	test_cast
	test_charcase
	test_compare
	test_deep_copy
	test_double_serializer
	test_float
	test_int_add
	test_json_pointer
	test_locale
	test_null
	test_parse
	test_parse_int64
	test_printbuf
	test_set_serializer
	test_set_value
	test_util_file
	test_visit)

add_executable(${TESTNAME} ${TESTNAME}.c)
add_test(NAME ${TESTNAME} COMMAND ${PROJECT_SOURCE_DIR}/tests/${TESTNAME}.test)

# XXX using the non-target_ versions of these doesn't work :(
target_include_directories(
  ${TESTNAME}
  PUBLIC
    ${CMAKE_CURRENT_LIST_DIR}
  )
target_link_libraries(
  ${TESTNAME}
  PRIVATE
    ${PROJECT_NAME}
  )

endforeach(TESTNAME)

# Make sure NDEBUG is always undefined for tests
if (UNIX OR MINGW OR CYGWIN)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -UNDEBUG")
endif()