Commit 8978caf6 authored by Harris Hancock's avatar Harris Hancock

cmake: Fix test.capnp.{h,c++} file generation race

parent 6b788321
......@@ -204,6 +204,13 @@ if(BUILD_TESTING)
capnp_generate_cpp(test_capnp_cpp_files test_capnp_h_files ${test_capnp_files})
# TODO(cleanup): capnp-tests and capnp-heavy-tests both depend on the test.capnp output files. In
# a parallel Makefile-based build (maybe others?), they can race and cause the custom capnp
# command in capnp_generate_cpp() to run twice. To get around this I'm using a custom target to
# force CMake to generate race-free Makefiles. Remove this garbage when we move to a
# target-based capnp_generate() command, as that will make CMake do the right thing by default.
add_custom_target(test_capnp DEPENDS ${test_capnp_cpp_files} ${test_capnp_h_files})
if(CAPNP_LITE)
set(test_libraries capnp kj-test kj)
else()
......@@ -229,6 +236,7 @@ if(BUILD_TESTING)
${test_capnp_h_files}
)
target_link_libraries(capnp-tests ${test_libraries})
add_dependencies(capnp-tests test_capnp)
add_dependencies(check capnp-tests)
add_test(NAME capnp-tests-run COMMAND capnp-tests)
......@@ -261,6 +269,7 @@ if(BUILD_TESTING)
)
endif()
add_dependencies(capnp-heavy-tests test_capnp)
add_dependencies(check capnp-heavy-tests)
add_test(NAME capnp-heavy-tests-run COMMAND capnp-heavy-tests)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment