aboutsummaryrefslogtreecommitdiffstats
path: root/test/CMakeLists.txt
blob: 9c51a5093ba55f3d41898298d69ac25976092766 (plain)
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
include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}/../include
)

set (catch2_LIB_SRCS
  ${CMAKE_CURRENT_SOURCE_DIR}/../include/catch2/catch_amalgamated.cpp
)

add_library (catch2 STATIC ${catch2_LIB_SRCS})

if(CMAKE_COMPILER_IS_GNUCC)
target_compile_options(catch2 PUBLIC "-Wno-error=format-overflow")
endif(CMAKE_COMPILER_IS_GNUCC)

# install(TARGETS catch2 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

# These examples use the standard separate compilation
set( SOURCES_IDIOMATIC_EXAMPLES
    test_floatepsilon01.cpp
    test_type_traits_queries01.cpp
    test_to_string.cpp
    test_intdecstring01.cpp
    test_functiondef01.cpp
    test_lfringbuffer01.cpp
    test_lfringbuffer11.cpp
    test_mm_sc_drf_00.cpp
    test_mm_sc_drf_01.cpp
    test_cow_iterator_01.cpp
    test_cow_darray_01.cpp
    test_cow_darray_perf01.cpp
    test_hashset_perf01.cpp
)

string( REPLACE ".cpp" "" BASENAMES_IDIOMATIC_EXAMPLES "${SOURCES_IDIOMATIC_EXAMPLES}" )
set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} )

foreach( name ${TARGETS_IDIOMATIC_EXAMPLES} )
    add_executable(${name} ${name}.cpp)
endforeach()

set(ALL_EXAMPLE_TARGETS
  ${TARGETS_IDIOMATIC_EXAMPLES}
)

foreach(name ${ALL_EXAMPLE_TARGETS})
    target_link_libraries(${name} jaulib catch2)
    add_dependencies(${name} jaulib catch2)
    add_test (NAME ${name} COMMAND ${name})
endforeach()