Skip to content

Commit 29c2452

Browse files
authored
Merge pull request #313 from nigels-com/cmake-test
cmake support for building and running tests
2 parents bcacd26 + 8a47e6e commit 29c2452

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

test/CMakeLists.txt

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2+
set(CMAKE_CXX_EXTENSIONS OFF)
3+
4+
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
5+
# warning level 4
6+
add_compile_options(/W4)
7+
endif()
8+
9+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
10+
add_compile_options(-Wall -Wextra -Wpedantic)
11+
endif()
12+
13+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
14+
add_compile_options(-Wall -Wextra -Wpedantic)
15+
endif()
16+
17+
if(NOT TARGET tests)
18+
add_custom_target(tests)
19+
endif()
20+
21+
set(PREFIX "boost_container_")
22+
set(LINK_LIBRARIES Boost::container Boost::included_test_exec_monitor)
23+
24+
function(boost_container_add_test name source)
25+
set(pname "${PREFIX}${name}")
26+
add_executable(${pname} ${source})
27+
target_link_libraries(${pname} ${LINK_LIBRARIES})
28+
add_test(NAME ${pname} COMMAND ${pname})
29+
add_dependencies(tests ${pname})
30+
endfunction()
31+
32+
boost_container_add_test(allocator_traits_test allocator_traits_test.cpp)
33+
boost_container_add_test(alloc_basic_test alloc_basic_test.cpp)
34+
boost_container_add_test(alloc_full_test alloc_full_test.cpp)
35+
boost_container_add_test(boost_iterator_comp_test boost_iterator_comp_test.cpp)
36+
boost_container_add_test(common_iterator_test common_iterator_test.cpp)
37+
boost_container_add_test(copy_move_algo_test copy_move_algo_test.cpp)
38+
boost_container_add_test(deque_options_test deque_options_test.cpp)
39+
boost_container_add_test(deque_test deque_test.cpp)
40+
boost_container_add_test(devector_options_test devector_options_test.cpp)
41+
boost_container_add_test(devector_test devector_test.cpp)
42+
boost_container_add_test(explicit_inst_deque_test explicit_inst_deque_test.cpp)
43+
boost_container_add_test(explicit_inst_devector_test explicit_inst_devector_test.cpp)
44+
boost_container_add_test(explicit_inst_flat_map_test explicit_inst_flat_map_test.cpp)
45+
boost_container_add_test(explicit_inst_flat_set_test explicit_inst_flat_set_test.cpp)
46+
boost_container_add_test(explicit_inst_list_test explicit_inst_list_test.cpp)
47+
boost_container_add_test(explicit_inst_map_test explicit_inst_map_test.cpp)
48+
boost_container_add_test(explicit_inst_set_test explicit_inst_set_test.cpp)
49+
boost_container_add_test(explicit_inst_slist_test explicit_inst_slist_test.cpp)
50+
boost_container_add_test(explicit_inst_small_vector_test explicit_inst_small_vector_test.cpp)
51+
boost_container_add_test(explicit_inst_stable_vector_test explicit_inst_stable_vector_test.cpp)
52+
boost_container_add_test(explicit_inst_static_vector_test explicit_inst_static_vector_test.cpp)
53+
boost_container_add_test(explicit_inst_string_test explicit_inst_string_test.cpp)
54+
boost_container_add_test(explicit_inst_vector_test explicit_inst_vector_test.cpp)
55+
boost_container_add_test(flat_map_adaptor_test flat_map_adaptor_test.cpp)
56+
boost_container_add_test(flat_map_test flat_map_test.cpp)
57+
boost_container_add_test(flat_set_adaptor_test flat_set_adaptor_test.cpp)
58+
boost_container_add_test(flat_set_test flat_set_test.cpp)
59+
boost_container_add_test(flat_tree_test flat_tree_test.cpp)
60+
boost_container_add_test(global_resource_test global_resource_test.cpp)
61+
boost_container_add_test(insert_vs_emplace_test insert_vs_emplace_test.cpp)
62+
boost_container_add_test(list_test list_test.cpp)
63+
boost_container_add_test(map_test map_test.cpp)
64+
boost_container_add_test(memory_resource_test memory_resource_test.cpp)
65+
boost_container_add_test(monotonic_buffer_resource_test monotonic_buffer_resource_test.cpp)
66+
boost_container_add_test(node_handle_test node_handle_test.cpp)
67+
boost_container_add_test(null_iterators_test null_iterators_test.cpp)
68+
boost_container_add_test(pair_test pair_test.cpp)
69+
boost_container_add_test(pmr_deque_test pmr_deque_test.cpp)
70+
boost_container_add_test(pmr_devector_test pmr_devector_test.cpp)
71+
boost_container_add_test(pmr_flat_map_test pmr_flat_map_test.cpp)
72+
boost_container_add_test(pmr_flat_set_test pmr_flat_set_test.cpp)
73+
boost_container_add_test(pmr_list_test pmr_list_test.cpp)
74+
boost_container_add_test(pmr_map_test pmr_map_test.cpp)
75+
boost_container_add_test(pmr_set_test pmr_set_test.cpp)
76+
boost_container_add_test(pmr_slist_test pmr_slist_test.cpp)
77+
boost_container_add_test(pmr_small_vector_test pmr_small_vector_test.cpp)
78+
boost_container_add_test(pmr_stable_vector_test pmr_stable_vector_test.cpp)
79+
boost_container_add_test(pmr_string_test pmr_string_test.cpp)
80+
boost_container_add_test(pmr_vector_test pmr_vector_test.cpp)
81+
boost_container_add_test(polymorphic_allocator_test polymorphic_allocator_test.cpp)
82+
boost_container_add_test(resource_adaptor_test resource_adaptor_test.cpp)
83+
boost_container_add_test(scoped_allocator_adaptor_test scoped_allocator_adaptor_test.cpp)
84+
boost_container_add_test(scoped_allocator_usage_test scoped_allocator_usage_test.cpp)
85+
boost_container_add_test(set_test set_test.cpp)
86+
boost_container_add_test(slist_test slist_test.cpp)
87+
boost_container_add_test(small_vector_options_test small_vector_options_test.cpp)
88+
boost_container_add_test(small_vector_test small_vector_test.cpp)
89+
boost_container_add_test(stable_vector_test stable_vector_test.cpp)
90+
boost_container_add_test(static_vector_options_test static_vector_options_test.cpp)
91+
boost_container_add_test(static_vector_test static_vector_test.cpp)
92+
boost_container_add_test(string_test string_test.cpp)
93+
boost_container_add_test(string_view_compat_test string_view_compat_test.cpp)
94+
boost_container_add_test(synchronized_pool_resource_test synchronized_pool_resource_test.cpp)
95+
boost_container_add_test(throw_exception_test throw_exception_test.cpp)
96+
boost_container_add_test(tree_test tree_test.cpp)
97+
boost_container_add_test(unsynchronized_pool_resource_test unsynchronized_pool_resource_test.cpp)
98+
boost_container_add_test(uses_allocator_test uses_allocator_test.cpp)
99+
boost_container_add_test(vector_options_test vector_options_test.cpp)
100+
boost_container_add_test(vector_test vector_test.cpp)

0 commit comments

Comments
 (0)