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 is getting written to the MixedLangTargets.cmake
file and is getting linked to 'mixedlang' and 'mixedlang' was getting liked to
MixedLang::all_libs.  So, anyone that was linking against MixedLang::all_libs
or just the 'mixedlang' LIB (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 have INTERFACE
libraries.  Those are never getting 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 new added test case 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 bc17fb3 commit 2912c5a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,12 @@ 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 grep ARGS -A 1 "set_target_properties.MixedLang::all_libs PROPERTIES" cmake_packages/MixedLang/MixedLangTargets.cmake
PASS_REGULAR_EXPRESSION_ALL
"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 +1605,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 2912c5a

Please sign in to comment.