-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathCMakeLists.txt
42 lines (34 loc) · 1.05 KB
/
CMakeLists.txt
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
macro(reflang_test TEST REGEX)
message(STATUS "Generating test target: ${TEST}")
set(INPUT "${TEST}.src.hpp")
set(OUT_HPP "${TEST}.gen.hpp")
set(OUT_CPP "${TEST}.gen.cpp")
set(SOURCE "${TEST}.test.cpp")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_HPP}"
COMMAND ${CMAKE_COMMAND}
ARGS
-DINPUT=${INPUT}
-DOUT_HPP=${OUT_HPP}
-DOUT_CPP=${OUT_CPP}
-DGEN=$<TARGET_FILE:reflang>
-DREGEX="${REGEX}"
-P ${CMAKE_SOURCE_DIR}/cmake/runtest.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_CPP}"
COMMAND echo "Pretending to generate ${OUT_CPP} -- this is generated by ${OUT_HPP} rule.")
add_executable(
${TEST}
${SOURCE}
${INPUT}
"${CMAKE_CURRENT_SOURCE_DIR}/${OUT_HPP}"
"${CMAKE_CURRENT_SOURCE_DIR}/${OUT_CPP}")
target_link_libraries(${TEST} libreflang)
add_test("${TEST}-test" ${TEST})
set_property(TARGET ${TEST} PROPERTY FOLDER "tests")
endmacro()
add_subdirectory(lib)
add_subdirectory(enum)
add_subdirectory(function)
add_subdirectory(class)