Skip to content

Commit caa4ab6

Browse files
committed
Add custom targets for running cmkr/tests
1 parent 6e56be4 commit caa4ab6

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmake.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ link-libraries = [
3737
"mpark_variant",
3838
"ordered_map",
3939
]
40-
cmake-after = """
41-
generate_resources(${CMKR_TARGET})
42-
"""
40+
include-after = ["cmake/custom_targets.cmake"]
4341

4442
[[install]]
4543
targets = ["cmkr"]

cmake/custom_targets.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
generate_resources(cmkr)
2+
3+
add_custom_target(regenerate-cmake
4+
COMMAND "$<TARGET_FILE:cmkr>" gen
5+
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
6+
)
7+
8+
if(CMAKE_CONFIGURATION_TYPES)
9+
add_custom_target(run-tests
10+
COMMAND "${CMAKE_CTEST_COMMAND}" -C $<CONFIG>
11+
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/tests"
12+
)
13+
else()
14+
add_custom_target(run-tests
15+
COMMAND "${CMAKE_CTEST_COMMAND}"
16+
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/tests"
17+
)
18+
endif()

0 commit comments

Comments
 (0)