File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -16,21 +16,27 @@ source_group("test" FILES
16
16
speed_test.cpp
17
17
)
18
18
19
- macro (add_example)
19
+ if (NOT TARGET tests)
20
+ add_custom_target (tests)
21
+ endif ()
22
+
23
+ function (add_example)
20
24
cmake_parse_arguments ("addex" "" "NAME" "SRCS;DEPS" ${ARGN} )
21
25
if ("${addex_NAME} " STREQUAL "" )
22
- message (FATAL_ERROR "add_example: no NAME" )
26
+ message (SEND_ERROR "add_example: no NAME" )
27
+ return ()
23
28
endif ()
24
29
if ("${addex_SRCS} " STREQUAL "" )
25
- message (FATAL_ERROR "add_example: no SRCS" )
30
+ message (SEND_ERROR "add_example: no SRCS" )
31
+ return ()
26
32
endif ()
27
33
message (STATUS "add_example: ${addex_NAME} SRCS: ${addex_SRCS} DEPS: ${addex_DEPS} " )
28
34
add_executable ("${PROJECT_NAME} -example-${addex_NAME} "
29
35
${addex_SRCS} )
30
36
set_property (TARGET "${PROJECT_NAME} -example-${addex_NAME} " PROPERTY FOLDER "example" )
31
37
target_link_libraries ("${PROJECT_NAME} -example-${addex_NAME} " PRIVATE ${addex_DEPS} )
32
- endmacro ( )
33
- #
38
+ add_dependencies (tests " ${PROJECT_NAME} -example- ${addex_NAME} " )
39
+ endfunction ()
34
40
35
41
add_example(NAME custom_data_type SRCS custom_data_type.cpp DEPS Boost::property_tree)
36
42
add_example(NAME debug_settings SRCS debug_settings.cpp DEPS Boost::property_tree)
You can’t perform that action at this time.
0 commit comments