Skip to content

Commit 47deaef

Browse files
committed
cmake: support default build and test workflow
Make sure that the default workflow of `cmake ..; make; make test` does not fail with an error message that no tests are found. Remove any "convenience" targets that add maintenance burden and require tribal knowledge.
1 parent 1b8d4a6 commit 47deaef

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,4 @@ add_dependencies(install-lib multiprocess)
216216

217217
# Example and test subdirectories
218218
add_subdirectory(example EXCLUDE_FROM_ALL)
219-
add_subdirectory(test EXCLUDE_FROM_ALL)
219+
add_subdirectory(test)

test/CMakeLists.txt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,6 @@
22
# Distributed under the MIT software license, see the accompanying
33
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
# Custom test targets for convenience, based on
6-
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/tutorials/EmulateMakeCheck.
7-
#
8-
# CTest already provides a "make test" target, but it just runs existing tests
9-
# that were previously built, without building anything itself. Define "make
10-
# tests" here as a custom target to build all available tests and "make check"
11-
# as a custom target to build and run them.
12-
add_custom_target(mptests)
13-
add_custom_target(mpcheck COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS mptests)
14-
15-
# Only add more convenient tests and check targets if project is being built
16-
# standalone, to prevent clashes with external projects.
17-
if (MP_STANDALONE)
18-
add_custom_target(tests DEPENDS mptests)
19-
add_custom_target(check DEPENDS mpcheck)
20-
endif()
21-
225
if(BUILD_TESTING AND TARGET CapnProto::kj-test)
236
set_property(SOURCE ${MP_PROXY_HDRS} PROPERTY GENERATED 1)
247

@@ -34,6 +17,5 @@ if(BUILD_TESTING AND TARGET CapnProto::kj-test)
3417
target_link_libraries(mptest PRIVATE CapnProto::kj-test)
3518
target_link_libraries(mptest PRIVATE Threads::Threads)
3619

37-
add_dependencies(mptests mptest)
3820
add_test(NAME mptest COMMAND mptest)
3921
endif()

0 commit comments

Comments
 (0)