File tree Expand file tree Collapse file tree 3 files changed +53
-22
lines changed
Expand file tree Collapse file tree 3 files changed +53
-22
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ install(
7676 PATTERN "${CMAKE_CURRENT_BINARY_DIR} /include/beman/any_view/*.hpp"
7777)
7878
79- macro (beman_add_executable)
79+ function (beman_add_executable)
8080 set (options )
8181 set (oneValueArgs CATEGORY TARGET )
8282 set (multiValueArgs SOURCES LIBRARIES)
@@ -90,13 +90,8 @@ macro(beman_add_executable)
9090 )
9191
9292 # [CMAKE.TARGET_NAMES]
93- set (target
94- "beman.any_view.${beman_executable_CATEGORY} .${beman_executable_TARGET} "
95- )
96-
97- if (NOT beman_executable_SOURCES)
98- set (beman_executable_SOURCES "${beman_executable_TARGET} .cpp" )
99- endif ()
93+ set (category beman.any_view.${beman_executable_CATEGORY} )
94+ set (target ${category} .${beman_executable_TARGET} )
10095
10196 add_executable (${target} )
10297 # [CMAKE.PASSIVE_PROJECTS]
@@ -107,7 +102,13 @@ macro(beman_add_executable)
107102 ${target}
108103 PRIVATE beman::any_view ${beman_executable_LIBRARIES}
109104 )
110- endmacro ()
105+
106+ if (NOT TARGET ${category} )
107+ add_custom_target (${category} )
108+ endif ()
109+
110+ add_dependencies (${category} ${target} )
111+ endfunction ()
111112
112113if (BEMAN_ANY_VIEW_BUILD_TESTS)
113114 enable_testing ()
Original file line number Diff line number Diff line change 11# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
22
3- function (beman_add_example)
4- beman_add_executable(${ARGN} CATEGORY examples)
3+ function (beman_add_example name )
4+ beman_add_executable(
5+ TARGET ${name}
6+ SOURCES ${name} .cpp
7+ CATEGORY examples
8+ )
59endfunction ()
610
7- beman_add_example(TARGET sum_views)
11+ beman_add_example(sum_views)
Original file line number Diff line number Diff line change @@ -21,18 +21,44 @@ FetchContent_MakeAvailable(benchmark googletest)
2121include (GoogleTest)
2222
2323function (beman_add_benchmark)
24- beman_add_executable(${ARGN} CATEGORY benchmarks LIBRARIES benchmark::benchmark)
24+ beman_add_executable(
25+ ${ARGN}
26+ CATEGORY benchmarks
27+ LIBRARIES benchmark::benchmark
28+ )
2529endfunction ()
2630
27- function (beman_add_test)
28- beman_add_executable(${ARGN} CATEGORY tests LIBRARIES GTest::gtest GTest::gtest_main)
29- gtest_discover_tests(${target} )
31+ function (beman_add_tests)
32+ foreach (name ${ARGN} )
33+ beman_add_executable(
34+ TARGET ${name}
35+ SOURCES ${name} .test .cpp
36+ CATEGORY tests
37+ LIBRARIES GTest::gtest GTest::gtest_main
38+ )
39+ gtest_discover_tests(beman.any_view.tests.${name} )
40+ endforeach ()
3041endfunction ()
3142
32- beman_add_benchmark(TARGET all SOURCES all .benchmark.cpp detail/eager.cpp detail/fused.cpp detail/lazy.cpp detail/products.cpp detail/reserved.cpp)
33- beman_add_benchmark(TARGET take SOURCES take.benchmark.cpp detail/eager.cpp detail/fused.cpp detail/lazy.cpp detail/products.cpp detail/reserved.cpp)
43+ beman_add_benchmark(
44+ TARGET all
45+ SOURCES
46+ all .benchmark.cpp
47+ detail/eager.cpp
48+ detail/fused.cpp
49+ detail/lazy.cpp
50+ detail/products.cpp
51+ detail/reserved.cpp
52+ )
53+ beman_add_benchmark(
54+ TARGET take
55+ SOURCES
56+ take.benchmark.cpp
57+ detail/eager.cpp
58+ detail/fused.cpp
59+ detail/lazy.cpp
60+ detail/products.cpp
61+ detail/reserved.cpp
62+ )
3463
35- beman_add_test(TARGET concepts SOURCES concepts.test .cpp)
36- beman_add_test(TARGET constexpr SOURCES constexpr.test .cpp)
37- beman_add_test(TARGET sfinae SOURCES sfinae.test .cpp)
38- beman_add_test(TARGET type_traits SOURCES type_traits.test .cpp)
64+ beman_add_tests(concepts constexpr sfinae type_traits)
You can’t perform that action at this time.
0 commit comments