Skip to content

Commit 5b08aa4

Browse files
committed
Add a target build_tests to CMake
- This makes it easier to work around situations where a test fails in a super build, since it's awkward to disable specific tests via external_project_add() unless ctest is called directly - A compiler bug in 8.1 causes a failure, this is fixed in 8.2 but the toolchain-r-test PPA used by most CI systems doesn't yet have an 8.2 GFortran package
1 parent a572c0a commit 5b08aa4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ if ( ENABLE_TESTS )
243243

244244
# emulate GNU Autotools `make check`
245245
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>)
246+
add_custom_target(build_tests) # Make target to build all tests
247+
add_dependencies(build_tests ${LIB_NAME} ${LIB_NAME}-static)
246248

247249
find_program ( JSONLINT jsonlint )
248250
find_program ( DIFF diff )
@@ -290,6 +292,7 @@ if ( ENABLE_TESTS )
290292
add_executable ( ${TEST} EXCLUDE_FROM_ALL ${UNIT_TEST} )
291293
target_link_libraries ( ${TEST} ${LIB_NAME} )
292294
add_dependencies ( check ${TEST} )
295+
add_dependencies ( build_tests ${TEST} )
293296
set_target_properties ( ${TEST}
294297
PROPERTIES
295298
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )

0 commit comments

Comments
 (0)