Skip to content

Commit

Permalink
WIP: Add failing test for INTERFACE library not being in all_libs (Tr…
Browse files Browse the repository at this point in the history
…iBITSPub#625)

This failing test shows that an INTERFACE library was not getting picked up
and linked to the <Package>::all_libs target.

The reason the existing tests all passed after adding the initial support for
HEAERONLY INTERFACE libraries was that I added the interface library
'mixedlang_vector' before the main 'mixedlang' library.  So the new
'mixedlang_vector' library getting written to the MixedLangTargets.cmake file
and was getting linked to 'mixedlang' and 'mixedlang' was getting liked to
MixedLang::all_libs.  So, anyone that was linking against MixedLang::all_libs
(from internal or IMPORTED target) was getting the include directories being
specified in the 'mixedlang_vector' library.

But this implementation fails for TriBITS packages that only has INTERFACE
libraries.  Those never get added to the <Package>::all_libs target or
indirectly to targets that do.  This is why the STKEmend package failed
because it has just one HEADERONLY INTERFACE library.

This test ensures that the INTERFACE library does get linked to the
<Package>::all_libs target and will fail if it does not.

The next commit will add the code in TriBITS to fix this test :-)

Signed-off-by: Roscoe A. Bartlett <[email protected]>
  • Loading branch information
bartlettroscoe committed Feb 21, 2025
1 parent e690ae2 commit f1e4b76
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,13 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST
"Configuring done"
"Generating done"
"Build files have been written to: .*ExamplesUnitTests/TriBITS_TribitsExampleProject_ALL_ST"
TEST_1 CMND make
TEST_1
MESSAGE "Grep MixedLangTargets.cmake to ensure INTERFACE library mixedlang_vector in all_libs"
CMND cat ARGS cmake_packages/MixedLang/MixedLangTargets.cmake
PASS_REGULAR_EXPRESSION_ALL
"add_library[(]MixedLang::mixedlang_vector INTERFACE IMPORTED[)]"
"INTERFACE_LINK_LIBRARIES .MixedLang::mixedlang_vector[;]MixedLang::mixedlang."
TEST_2 CMND make
MESSAGE "Build the default 'all' target using raw 'make'"
ARGS ${CTEST_BUILD_FLAGS}
PASS_REGULAR_EXPRESSION_ALL
Expand All @@ -1600,7 +1606,7 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST
"Built target pws_a"
"Built target pws_b"
"Built target pws_c"
TEST_2 CMND ${CMAKE_CTEST_COMMAND} ARGS -VV
TEST_3 CMND ${CMAKE_CTEST_COMMAND} ARGS -VV
MESSAGE "Run all the tests with raw 'ctest'"
PASS_REGULAR_EXPRESSION_ALL
"SimpleCxx_HelloWorldTests${TEST_MPI_1_SUFFIX} .* Passed"
Expand Down

0 comments on commit f1e4b76

Please sign in to comment.