Skip to content

Commit

Permalink
Add INTERFACE_LIBRARY targets to <Package>::all_libs target (TriBITSP…
Browse files Browse the repository at this point in the history
…ub#625)

This fixes the previously added failing test :-)

I also had to add logic to not generate the package-config files when doing
installation testing where you are only building the tests and examples.  This
was generating a strange error about export sets.  You should not be
generating packge-config files in these cases.

Also, this change required the update of some other tests.  Now that
INTERFACE_LIBRARY taragets are getting pulled down, the <SubPkg>::all_libs for
subpackage targets are getting added the <ParentPkg>::all_libs target for
parent packages.  This is an intereting case but it works.

Signed-off-by: Roscoe A. Bartlett <[email protected]>
  • Loading branch information
bartlettroscoe committed Feb 21, 2025
1 parent 2912c5a commit 7fb3cbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function(TribitsExampleProject_ALL_ST_NoFortran sharedOrStatic serialOrMpi)
"WithSubpackages_MPI_EXEC_MAX_NUMPROCS = '${MPI_EXEC_MAX_NUMPROCS}'"
"WithSubpackages_MPI_EXEC_NUMPROCS_FLAG = '${MPI_EXEC_NUMPROCS_FLAG}'"
"WithSubpackages_FOUND = '1'"
"WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesB::pws_b[;]WithSubpackagesC::pws_c'"
"WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesA::all_libs[;]WithSubpackagesB::pws_b[;]WithSubpackagesB::all_libs[;]WithSubpackagesC::pws_c[;]WithSubpackagesC::all_libs'"
"-- Configuring done"
"-- Generating done"
ALWAYS_FAIL_ON_NONZERO_RETURN
Expand Down Expand Up @@ -399,7 +399,7 @@ function(TribitsExampleProject_ALL_ST_NoFortran sharedOrStatic serialOrMpi)
"WithSubpackages_MPI_EXEC_MAX_NUMPROCS = '${MPI_EXEC_MAX_NUMPROCS}'"
"WithSubpackages_MPI_EXEC_NUMPROCS_FLAG = '${MPI_EXEC_NUMPROCS_FLAG}'"
"WithSubpackages_FOUND = '1'"
"WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesB::pws_b[;]WithSubpackagesC::pws_c'"
"WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesA::all_libs[;]WithSubpackagesB::pws_b[;]WithSubpackagesB::all_libs[;]WithSubpackagesC::pws_c[;]WithSubpackagesC::all_libs'"
ALWAYS_FAIL_ON_NONZERO_RETURN

TEST_8
Expand Down Expand Up @@ -1303,7 +1303,7 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST_NoFortran_Ninja
-P ${CMAKE_CURRENT_SOURCE_DIR}/RunDummyPackageClientBulid.cmake
PASS_REGULAR_EXPRESSION_ALL
"WithSubpackages_INSTALL_DIR = '.*/TriBITS_TribitsExampleProject_ALL_ST_NoFortran_Ninja/install'"
"WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesB::pws_b[;]WithSubpackagesC::pws_c'"
"WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesA::all_libs[;]WithSubpackagesB::pws_b[;]WithSubpackagesB::all_libs[;]WithSubpackagesC::pws_c[;]WithSubpackagesC::all_libs'"
ALWAYS_FAIL_ON_NONZERO_RETURN

TEST_6 CMND ninja ARGS -j1 install ${CTEST_BUILD_FLAGS}
Expand All @@ -1327,7 +1327,7 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST_NoFortran_Ninja
PASS_REGULAR_EXPRESSION_ALL
"Calling: find_package[(]WithSubpackages REQUIRED COMPONENTS OPTIONAL_COMPONENTS [)]"
"WithSubpackages_FOUND = '1'"
"WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesB::pws_b[;]WithSubpackagesC::pws_c'"
"WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesA::all_libs[;]WithSubpackagesB::pws_b[;]WithSubpackagesB::all_libs[;]WithSubpackagesC::pws_c[;]WithSubpackagesC::all_libs'"
ALWAYS_FAIL_ON_NONZERO_RETURN

TEST_8 CMND ninja ARGS -j1 package_source
Expand Down
8 changes: 4 additions & 4 deletions tribits/core/package_arch/TribitsPackageMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -669,9 +669,9 @@ macro(tribits_package_postprocess_common)

tribits_package_create_all_libs_interface_library()

if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES)
# Create the configure file so external projects can find packages with a
# call to find_package(<package_name>).
if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES
AND (NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING)
)
tribits_write_package_client_export_files(${PACKAGE_NAME})
endif()

Expand All @@ -689,7 +689,7 @@ macro(tribits_package_create_all_libs_interface_library)

# Find all of the non-TESTONLY library targets
tribits_get_all_build_targets_including_in_subdirs("${CMAKE_CURRENT_SOURCE_DIR}"
"STATIC_LIBRARY;SHARED_LIBRARY"
"STATIC_LIBRARY;SHARED_LIBRARY;INTERFACE_LIBRARY"
allPackageBuildableLibTargetsList )
#print_var(allPackageBuildableLibTargetsList)
set(packageLibsInAllLibsList)
Expand Down

0 comments on commit 7fb3cbe

Please sign in to comment.