From 2a35523ed589df3924ea83a91e4471833d83bfe2 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Sun, 16 Oct 2022 18:33:10 -0600 Subject: [PATCH] Remove unused/unneeded list vars and logic for packages and TPLs (#299, #63) This commit gets rid of several list variables that are not needed with the move to modern CMake and some fairly complex code that was needed to compute these list variables: * _REVERSE_DEFINED_INTERNAL_PACKAGES * _REVERSE_DEFINED_TPLS * _TPL_LIST * _PACKAGE_LIST * _TPL_LIST * _INCLUDE_DIR * _LIBRARY_DIRS * _TPL_INCLUDE_DIRS * _TPL_LIBRARIES * _TPL_LIBRARY_DIRS --- test/core/CMakeLists.txt | 4 +- .../TribitsExampleProject_Tests.cmake | 37 +---- .../TribitsHelloWorld_Tests.cmake | 6 +- .../TribitsAdjustPackageEnablesHelpers.cmake | 7 - ...ctDepsFilesCreateDepsGraph_UnitTests.cmake | 3 +- ...bitsWriteClientExportFiles_UnitTests.cmake | 29 +--- .../TribitsExampleProject/CMakeLists.txt | 1 - tribits/CHANGELOG.md | 23 +++ .../TribitsPackageConfigTemplate.cmake.in | 23 +-- .../TribitsProjectConfigTemplate.cmake.in | 14 -- ...adAllProjectDepsFilesCreateDepsGraph.cmake | 8 - .../TribitsReadDepsFilesCreateDepsGraph.cmake | 7 - .../TribitsWriteClientExportFiles.cmake | 143 +----------------- .../TribitsExampleApp/AppHelperFuncs.cmake | 3 +- .../TribitsOldSimpleExampleApp/CMakeLists.txt | 5 +- .../TribitsSimpleExampleApp/CMakeLists.txt | 2 +- 16 files changed, 45 insertions(+), 270 deletions(-) diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index f89747d99..132e8fcba 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -102,7 +102,7 @@ tribits_add_advanced_test( TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTes -DCMAKE_CURRENT_LIST_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P "${CMAKE_CURRENT_SOURCE_DIR}/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake" PASS_REGULAR_EXPRESSION_ALL - "Final UnitTests Result: num_run = 125" + "Final UnitTests Result: num_run = 124" "Final UnitTests Result: PASSED" ) @@ -131,7 +131,7 @@ tribits_add_advanced_test( TribitsWriteClientExportFiles_UnitTests -DCMAKE_CURRENT_LIST_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P "${CMAKE_CURRENT_SOURCE_DIR}/TribitsWriteClientExportFiles_UnitTests.cmake" PASS_REGULAR_EXPRESSION_ALL - "Final UnitTests Result: num_run = 33" + "Final UnitTests Result: num_run = 12" "Final UnitTests Result: PASSED" ) diff --git a/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake b/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake index 3d60c5561..e461d2aaa 100644 --- a/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake +++ b/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake @@ -89,10 +89,6 @@ function(TribitsExampleProject_ALL_ST_NoFortran sharedOrStatic serialOrMpi) set(TPL_MPI_FILE_TRACE "") set(FINAL_ENABLED_TPLS "HeaderOnlyTpl 1") set(TEST_MPI_1_SUFFIX "") - set(WithSubpackages_TPL_LIBRARIES HeaderOnlyTpl::all_libs) - set(WithSubpackages_TPL_LIST HeaderOnlyTpl) - set(TribitsExProj_TPL_LIBRARIES HeaderOnlyTpl::all_libs) - set(TribitsExProj_TPL_LIST HeaderOnlyTpl) set(TribitsExProj_SHARED_LIB_RPATH_COMMAND_REGEX "") elseif (serialOrMpi STREQUAL "MPI") set(tplEnableMpiArg -DTPL_ENABLE_MPI=ON) @@ -101,10 +97,6 @@ function(TribitsExampleProject_ALL_ST_NoFortran sharedOrStatic serialOrMpi) "-- File Trace: TPL INCLUDE .*/core/std_tpls/FindTPLMPI.cmake") set(FINAL_ENABLED_TPLS "MPI HeaderOnlyTpl 2") set(TEST_MPI_1_SUFFIX "_MPI_1") - set(WithSubpackages_TPL_LIBRARIES "HeaderOnlyTpl::all_libs;MPI::all_libs") - set(WithSubpackages_TPL_LIST "HeaderOnlyTpl;MPI") - set(TribitsExProj_TPL_LIBRARIES "HeaderOnlyTpl::all_libs;MPI::all_libs") - set(TribitsExProj_TPL_LIST "HeaderOnlyTpl;MPI") set(TribitsExProj_SHARED_LIB_RPATH_COMMAND_REGEX "-Wl,-rpath,.*/${testName}/install/lib") else() @@ -315,21 +307,13 @@ function(TribitsExampleProject_ALL_ST_NoFortran sharedOrStatic serialOrMpi) "WithSubpackages_LINKER = '.+'" "WithSubpackages_AR = '.+'" "WithSubpackages_INSTALL_DIR = .*/${testName}/install" - "WithSubpackages_INCLUDE_DIRS = ''" - "WithSubpackages_LIBRARY_DIRS = ''" - "WithSubpackages_LIBRARIES = 'WithSubpackagesC::pws_c[;]WithSubpackagesB::pws_b[;]WithSubpackagesA::pws_a[;]SimpleCxx::simplecxx'" - "WithSubpackages_TPL_INCLUDE_DIRS = ''" - "WithSubpackages_TPL_LIBRARY_DIRS = ''" - "WithSubpackages_TPL_LIBRARIES = '${WithSubpackages_TPL_LIBRARIES}'" + "WithSubpackages_LIBRARIES = 'WithSubpackages::all_libs'" "WithSubpackages_MPI_LIBRARIES = ''" "WithSubpackages_MPI_LIBRARY_DIRS = ''" "WithSubpackages_MPI_INCLUDE_DIRS = ''" "WithSubpackages_MPI_EXEC = '${MPI_EXEC}'" "WithSubpackages_MPI_EXEC_MAX_NUMPROCS = '${MPI_EXEC_MAX_NUMPROCS}'" "WithSubpackages_MPI_EXEC_NUMPROCS_FLAG = '${MPI_EXEC_NUMPROCS_FLAG}'" - "WithSubpackages_PACKAGE_LIST = 'WithSubpackagesC.WithSubpackagesB.WithSubpackagesA.SimpleCxx'" - "WithSubpackages_SELECTED_PACKAGE_LIST = ''" - "WithSubpackages_TPL_LIST = '${WithSubpackages_TPL_LIST}'" "WithSubpackages_FOUND = '1'" "WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesB::pws_b[;]WithSubpackagesC::pws_c'" "-- Configuring done" @@ -409,21 +393,13 @@ function(TribitsExampleProject_ALL_ST_NoFortran sharedOrStatic serialOrMpi) "WithSubpackages_LINKER = '.+'" "WithSubpackages_AR = '.+'" "WithSubpackages_INSTALL_DIR = '.+/install'" - "WithSubpackages_INCLUDE_DIRS = ''" - "WithSubpackages_LIBRARY_DIRS = ''" - "WithSubpackages_LIBRARIES = 'WithSubpackagesC::pws_c[;]WithSubpackagesB::pws_b[;]WithSubpackagesA::pws_a[;]SimpleCxx::simplecxx'" - "WithSubpackages_TPL_INCLUDE_DIRS = ''" - "WithSubpackages_TPL_LIBRARY_DIRS = ''" - "WithSubpackages_TPL_LIBRARIES = '${WithSubpackages_TPL_LIBRARIES}'" + "WithSubpackages_LIBRARIES = 'WithSubpackages::all_libs'" "WithSubpackages_MPI_LIBRARIES = ''" "WithSubpackages_MPI_LIBRARY_DIRS = ''" "WithSubpackages_MPI_INCLUDE_DIRS = ''" "WithSubpackages_MPI_EXEC = '${MPI_EXEC}'" "WithSubpackages_MPI_EXEC_MAX_NUMPROCS = '${MPI_EXEC_MAX_NUMPROCS}'" "WithSubpackages_MPI_EXEC_NUMPROCS_FLAG = '${MPI_EXEC_NUMPROCS_FLAG}'" - "WithSubpackages_PACKAGE_LIST = 'WithSubpackagesC.WithSubpackagesB.WithSubpackagesA.SimpleCxx'" - "WithSubpackages_SELECTED_PACKAGE_LIST = ''" - "WithSubpackages_TPL_LIST = '${WithSubpackages_TPL_LIST}'" "WithSubpackages_FOUND = '1'" "WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesB::pws_b[;]WithSubpackagesC::pws_c'" ALWAYS_FAIL_ON_NONZERO_RETURN @@ -466,11 +442,7 @@ function(TribitsExampleProject_ALL_ST_NoFortran sharedOrStatic serialOrMpi) "TribitsExProj_AR = '.*'" "TribitsExProj_INSTALL_DIR = '.*/${testName}/install'" "TribitsExProj_INCLUDE_DIRS = '.*/${testName}/install/include'" - "TribitsExProj_LIBRARY_DIRS = ''" - "TribitsExProj_LIBRARIES = 'WithSubpackagesC::pws_c[;]WithSubpackagesB::pws_b[;]WithSubpackagesA::pws_a[;]SimpleCxx::simplecxx'" - "TribitsExProj_TPL_INCLUDE_DIRS = ''" - "TribitsExProj_TPL_LIBRARY_DIRS = ''" - "TribitsExProj_TPL_LIBRARIES = '${TribitsExProj_TPL_LIBRARIES}'" + "TribitsExProj_LIBRARIES = 'WithSubpackages::all_libs;WithSubpackagesC::all_libs;WithSubpackagesB::all_libs;WithSubpackagesA::all_libs;SimpleCxx::all_libs'" "TribitsExProj_MPI_LIBRARIES = ''" "TribitsExProj_MPI_LIBRARY_DIRS = ''" "TribitsExProj_MPI_INCLUDE_DIRS = ''" @@ -1221,8 +1193,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_TPL_LIST = 'HeaderOnlyTpl'" + "WithSubpackages::all_libs INTERFACE_LINK_LIBRARIES: 'WithSubpackagesA::pws_a[;]WithSubpackagesB::pws_b[;]WithSubpackagesC::pws_c'" ALWAYS_FAIL_ON_NONZERO_RETURN TEST_6 CMND ninja ARGS -j1 install ${CTEST_BUILD_FLAGS} diff --git a/test/core/ExamplesUnitTests/TribitsHelloWorld_Tests.cmake b/test/core/ExamplesUnitTests/TribitsHelloWorld_Tests.cmake index d09eb8ab1..776baf3fd 100644 --- a/test/core/ExamplesUnitTests/TribitsHelloWorld_Tests.cmake +++ b/test/core/ExamplesUnitTests/TribitsHelloWorld_Tests.cmake @@ -768,11 +768,7 @@ tribits_add_advanced_test( TribitsHelloWorld_install_config_dummy_proj "TribitsHelloWorld_AR = '.*'" "TribitsHelloWorld_INSTALL_DIR = '.*/TriBITS_TribitsHelloWorld_install_config_dummy_proj/install'" "TribitsHelloWorld_INCLUDE_DIRS = '.*/TriBITS_TribitsHelloWorld_install_config_dummy_proj/install/include'" - "TribitsHelloWorld_LIBRARY_DIRS = ''" - "TribitsHelloWorld_LIBRARIES = 'HelloWorld::hello_world_lib'" - "TribitsHelloWorld_TPL_INCLUDE_DIRS = '" - "TribitsHelloWorld_TPL_LIBRARY_DIRS = ''" - "TribitsHelloWorld_TPL_LIBRARIES = ''" + "TribitsHelloWorld_LIBRARIES = 'HelloWorld::all_libs'" "TribitsHelloWorld_MPI_LIBRARIES = ''" "TribitsHelloWorld_MPI_LIBRARY_DIRS = ''" "TribitsHelloWorld_MPI_INCLUDE_DIRS = ''" diff --git a/test/core/TribitsAdjustPackageEnablesHelpers.cmake b/test/core/TribitsAdjustPackageEnablesHelpers.cmake index cf54e554f..cb2028f68 100644 --- a/test/core/TribitsAdjustPackageEnablesHelpers.cmake +++ b/test/core/TribitsAdjustPackageEnablesHelpers.cmake @@ -62,13 +62,6 @@ macro(unittest_helper_read_and_process_packages) foreach(tribitsPkg ${${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES}) global_set(${tribitsPkg}_FULL_ENABLED_DEP_PACKAGES) endforeach() - # ${PROJECT_NAME}_REVERSE_DEFINED_TPLS (ToDo: Remove the need for this #63) - if (${PROJECT_NAME}_DEFINED_TPLS) - set(${PROJECT_NAME}_REVERSE_DEFINED_TPLS ${${PROJECT_NAME}_DEFINED_TPLS}) - list(REVERSE ${PROJECT_NAME}_REVERSE_DEFINED_TPLS) - else() - set(${PROJECT_NAME}_REVERSE_DEFINED_TPLS) - endif() tribits_print_enables_before_adjust_package_enables() tribits_adjust_package_enables(TRUE) tribits_print_enables_after_adjust_package_enables() diff --git a/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake b/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake index 63094ddde..878459e52 100644 --- a/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake +++ b/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake @@ -409,7 +409,6 @@ function(unittest_read_packages_and_dependencies) unittest_helper_read_packages_and_dependencies() unittest_compare_const(${PROJECT_NAME}_DEFINED_TPLS "MPI;BLAS;LAPACK;Boost") unittest_compare_const(${PROJECT_NAME}_NUM_DEFINED_TPLS 4) - unittest_compare_const(${PROJECT_NAME}_REVERSE_DEFINED_TPLS "Boost;LAPACK;BLAS;MPI") unittest_compare_const(${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES "Teuchos;RTOp;Ex2Package1;Ex2Package2") unittest_compare_const(${PROJECT_NAME}_NUM_DEFINED_INTERNAL_TOPLEVEL_PACKAGES 4) @@ -772,4 +771,4 @@ unittest_extra_repo_missing_required_package_verbose() unittest_elevate_subpackages_st_to_pt() # Pass in the number of expected tests that must pass! -unittest_final_result(125) +unittest_final_result(124) diff --git a/test/core/TribitsWriteClientExportFiles_UnitTests.cmake b/test/core/TribitsWriteClientExportFiles_UnitTests.cmake index 82eaf0f16..b0c823ca3 100644 --- a/test/core/TribitsWriteClientExportFiles_UnitTests.cmake +++ b/test/core/TribitsWriteClientExportFiles_UnitTests.cmake @@ -176,14 +176,7 @@ function(unittest_write_specialized_package_export_makefile_rtop_before_libs) unittest_file_regex("${GENERATED_EXPORT_CONFIG_FOR_BUILD}" REGEX_STRINGS "set[(]RTOp1_CMAKE_BUILD_TYPE .DEBUG." - "set[(]RTOp1_INCLUDE_DIRS ..[)]" - "set[(]RTOp1_LIBRARY_DIRS ..[)]" - "set[(]RTOp1_LIBRARIES .teuchoscore.teuchosnumeric.[)]" - "set[(]RTOp1_TPL_INCLUDE_DIRS ..[)]" - "set[(]RTOp1_TPL_LIBRARY_DIRS ..[)]" - "set[(]RTOp1_TPL_LIBRARIES .LAPACK::all_libs[;]BLAS::all_libs.[)]" - "set[(]RTOp1_PACKAGE_LIST .Teuchos.[)]" - "set[(]RTOp1_TPL_LIST .LAPACK.BLAS.[)]" + "set[(]RTOp1_LIBRARIES RTOp::all_libs[)]" "set[(]RTOp1_ENABLE_Teuchos ON[)]" ) @@ -191,14 +184,7 @@ function(unittest_write_specialized_package_export_makefile_rtop_before_libs) unittest_file_regex("${GENERATED_EXPORT_CONFIG_FOR_INSTALL}" REGEX_STRINGS "set[(]RTOp1_CMAKE_BUILD_TYPE .DEBUG." - "set[(]RTOp1_INCLUDE_DIRS ..[)]" - "set[(]RTOp1_LIBRARY_DIRS ..[)]" - "set[(]RTOp1_LIBRARIES .teuchoscore.teuchosnumeric.[)]" - "set[(]RTOp1_TPL_INCLUDE_DIRS ..[)]" - "set[(]RTOp1_TPL_LIBRARY_DIRS ..[)]" - "set[(]RTOp1_TPL_LIBRARIES .LAPACK::all_libs[;]BLAS::all_libs.[)]" - "set[(]RTOp1_PACKAGE_LIST .Teuchos.[)]" - "set[(]RTOp1_TPL_LIST .LAPACK.BLAS.[)]" + "set[(]RTOp1_LIBRARIES RTOp::all_libs[)]" "set[(]RTOp1_ENABLE_Teuchos ON[)]" ) @@ -266,14 +252,7 @@ function(unittest_write_specialized_package_export_makefile_rtop_after_libs) unittest_file_regex("${GENERATED_EXPORT_CONFIG_FOR_BUILD}" REGEX_STRINGS "set[(]RTOp2_CMAKE_BUILD_TYPE .RELEASE." - "set[(]RTOp2_INCLUDE_DIRS ..[)]" - "set[(]RTOp2_LIBRARY_DIRS ..[)]" - "set[(]RTOp2_LIBRARIES .rtop.teuchoscore.teuchosnumeric.[)]" - "set[(]RTOp2_TPL_INCLUDE_DIRS ..[)]" - "set[(]RTOp2_TPL_LIBRARY_DIRS ..[)]" - "set[(]RTOp2_TPL_LIBRARIES .LAPACK::all_libs[;]BLAS::all_libs.[)]" - "set[(]RTOp2_PACKAGE_LIST .RTOp.Teuchos.[)]" - "set[(]RTOp2_TPL_LIST .LAPACK.BLAS.[)]" + "set[(]RTOp2_LIBRARIES RTOp::all_libs[)]" "set[(]RTOp2_ENABLE_Teuchos ON[)]" ) @@ -300,4 +279,4 @@ unittest_write_specialized_package_export_makefile_rtop_before_libs() unittest_write_specialized_package_export_makefile_rtop_after_libs() # Pass in the number of expected tests that must pass! -unittest_final_result(33) +unittest_final_result(12) diff --git a/test/ctest_driver/TribitsExampleProject/CMakeLists.txt b/test/ctest_driver/TribitsExampleProject/CMakeLists.txt index aca5a95ec..4c255e545 100644 --- a/test/ctest_driver/TribitsExampleProject/CMakeLists.txt +++ b/test/ctest_driver/TribitsExampleProject/CMakeLists.txt @@ -2709,7 +2709,6 @@ function(generate_aao_tests) "Calling: find_package[(]TribitsExProj REQUIRED COMPONENTS OPTIONAL_COMPONENTS SimpleCxx[;]WithSubpackagesA[;]WithSubpackageC [)]" "TribitsExProj_PACKAGE_LIST = 'WithSubpackages[;]WithSubpackagesC[;]WithSubpackagesB[;]WithSubpackagesA[;]MixedLang[;]SimpleCxx'" "TribitsExProj_SELECTED_PACKAGE_LIST = 'SimpleCxx[;]WithSubpackagesA'" - "TribitsExProj_TPL_LIST = 'HeaderOnlyTpl'" "TribitsExProj_SimpleCxx_FOUND = 'TRUE'" "TribitsExProj_WithSubpackagesA_FOUND = 'TRUE'" "TribitsExProj_WithSubpackageC_FOUND = 'FALSE'" diff --git a/tribits/CHANGELOG.md b/tribits/CHANGELOG.md index 3d60abe9c..438b7dc62 100644 --- a/tribits/CHANGELOG.md +++ b/tribits/CHANGELOG.md @@ -2,6 +2,29 @@ ChangeLog for TriBITS ---------------------------------------- +## 2022-10-16: + +* **Removed:** Removed the variables `_LIBRARY_DIRS`, + `_TPL_LIST` and `_TPL_LIBRARIES` from the installed + `Config.cmake` file. These are not needed after the change to + modern CMake targets `::all_libs` (see `::all_libs` + below). To determine if a TPL is enabled, check `if (TARGET + ::all_libs)`. To get the libraries and include dirs for a TPL, + link against the IMPORTED target `::all_libs` (see the updated + TriBITS example APP projects for details). + +* **Removed:** Removed the variables `_PACKAGE_LIST`, + `_TPL_LIST`, `_INCLUDE_DIR`, `_LIBRARY_DIRS`, + `_TPL_INCLUDE_DIRS`, `_TPL_LIBRARIES` and + `_TPL_LIBRARY_DIRS` from the generated `Config.cmake` + files. These are not needed with the move to modern CMake targets (see + `::all_libs` below). + +* **Changed:** Changed `_LIBRARIES` in generated + `Config.cmake` files from the full list of the package's library + targets to just `::all_libs`. (There is no need to list the + individual libraries after the move to modern CMake targets.) + ## 2022-10-11: * **Changed:** Added option `_ASSERT_DEFINED_DEPENDENCIES` to diff --git a/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in b/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in index 465648d63..499d5352e 100644 --- a/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in +++ b/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in @@ -101,23 +101,8 @@ set(${EXPORT_FILE_VAR_PREFIX}_AR ${CMAKE_AR}) ## Base install location (if not in the build tree) set(${EXPORT_FILE_VAR_PREFIX}_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@") -## List of package include dirs -set(${EXPORT_FILE_VAR_PREFIX}_INCLUDE_DIRS "") - -## List of package library paths -set(${EXPORT_FILE_VAR_PREFIX}_LIBRARY_DIRS "") - ## List of package libraries -set(${EXPORT_FILE_VAR_PREFIX}_LIBRARIES "${FULL_LIBRARY_SET}") - -## Specification of directories for TPL headers -set(${EXPORT_FILE_VAR_PREFIX}_TPL_INCLUDE_DIRS "") - -## Specification of directories for TPL libraries -set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARY_DIRS "") - -## List of required TPLs -set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARIES "${${PACKAGE_NAME}_TPL_LIBRARIES}") +set(${EXPORT_FILE_VAR_PREFIX}_LIBRARIES ${PACKAGE_NAME}::all_libs) ## --------------------------------------------------------------------------- ## MPI specific variables @@ -136,12 +121,6 @@ set(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC_NUMPROCS_FLAG "${MPI_EXEC_NUMPROCS_FLAG}" ## Set useful general variables ## --------------------------------------------------------------------------- -## The packages enabled for this project -set(${EXPORT_FILE_VAR_PREFIX}_PACKAGE_LIST "${FULL_PACKAGE_SET}") - -## The TPLs enabled for this project -set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIST "${ORDERED_FULL_TPL_SET}") - ${PACKAGE_CONFIG_CODE} ## ---------------------------------------------------------------------------- diff --git a/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in b/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in index 67eb685ed..09c413821 100644 --- a/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in +++ b/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in @@ -123,7 +123,6 @@ foreach (comp IN ITEMS ${PDOLLAR}{COMPONENTS_LIST}) include(${PDOLLAR}{compPkgConfigFile}) # Add variables to lists. list(APPEND ${PROJECT_NAME}_LIBRARIES ${PDOLLAR}{${PDOLLAR}{comp}_LIBRARIES}) - list(APPEND ${PROJECT_NAME}_TPL_LIBRARIES ${PDOLLAR}{${PDOLLAR}{comp}_TPL_LIBRARIES}) list(APPEND selectedComponentsFound ${PDOLLAR}{comp}) else() set(${PROJECT_NAME}_${PDOLLAR}{comp}_FOUND FALSE) @@ -138,18 +137,8 @@ endforeach() # Deprecated (see #299)! set(${PROJECT_NAME}_INCLUDE_DIRS "${TRIBITS_PROJECT_INSTALL_INCLUDE_DIR}") -# Deprecated (see #299)! -set(${PROJECT_NAME}_LIBRARY_DIRS "") - # Remove duplicates in ${PROJECT_NAME}_LIBRARIES -list(REVERSE ${PROJECT_NAME}_LIBRARIES) list(REMOVE_DUPLICATES ${PROJECT_NAME}_LIBRARIES) -list(REVERSE ${PROJECT_NAME}_LIBRARIES) - -# Remove duplicates in ${PROJECT_NAME}_TPL_LIBRARIES -list(REVERSE ${PROJECT_NAME}_TPL_LIBRARIES) -list(REMOVE_DUPLICATES ${PROJECT_NAME}_TPL_LIBRARIES) -list(REVERSE ${PROJECT_NAME}_TPL_LIBRARIES) ## --------------------------------------------------------------------------- ## MPI specific variables @@ -186,9 +175,6 @@ set(${PROJECT_NAME}_PACKAGE_LIST "${FULL_PACKAGE_SET}") ## The selected packages for this project set(${PROJECT_NAME}_SELECTED_PACKAGE_LIST "${PDOLLAR}{selectedComponentsFound}") -## The TPLs enabled for this project -set(${PROJECT_NAME}_TPL_LIST "${FULL_TPL_SET}") - ## --------------------------------------------------------------------------- ## Modern CMake (IMPORTED) targets ## --------------------------------------------------------------------------- diff --git a/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake b/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake index 261d815f3..85a18092d 100644 --- a/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake +++ b/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake @@ -238,14 +238,6 @@ macro(tribits_read_defined_external_and_internal_toplevel_packages_lists) # ${PROJECT_NAME}_NUM_DEFINED_TPLS list(LENGTH ${PROJECT_NAME}_DEFINED_TPLS ${PROJECT_NAME}_NUM_DEFINED_TPLS) - # ${PROJECT_NAME}_REVERSE_DEFINED_TPLS (ToDo: Remove the need for this #63) - if (${PROJECT_NAME}_DEFINED_TPLS) - set(${PROJECT_NAME}_REVERSE_DEFINED_TPLS ${${PROJECT_NAME}_DEFINED_TPLS}) - list(REVERSE ${PROJECT_NAME}_REVERSE_DEFINED_TPLS) - else() - set(${PROJECT_NAME}_REVERSE_DEFINED_TPLS) - endif() - # ${PROJECT_NAME}_DEFINED_TOPLEVEL_PACKAGES set(${PROJECT_NAME}_DEFINED_TOPLEVEL_PACKAGES ${${PROJECT_NAME}_DEFINED_TPLS} diff --git a/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake b/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake index 91a382145..ae1094ff4 100644 --- a/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake +++ b/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake @@ -190,13 +190,6 @@ macro(tribits_read_all_package_deps_files_create_deps_graph) ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) endforeach() - # Create a reverse packages list for later use - set(${PROJECT_NAME}_REVERSE_DEFINED_INTERNAL_PACKAGES - ${${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES}) - if (${PROJECT_NAME}_REVERSE_DEFINED_INTERNAL_PACKAGES) - list(REVERSE ${PROJECT_NAME}_REVERSE_DEFINED_INTERNAL_PACKAGES) - endif() - list(LENGTH ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES ${PROJECT_NAME}_NUM_DEFINED_INTERNAL_PACKAGES) print_var(${PROJECT_NAME}_NUM_DEFINED_INTERNAL_PACKAGES) diff --git a/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake b/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake index 1f31b6ec0..7ef8f2666 100644 --- a/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake +++ b/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake @@ -178,125 +178,11 @@ function(tribits_write_flexible_package_client_export_files) print_var(EXPORT_FILE_VAR_PREFIX) endif() - # - # B) Get the set of upstream packages for this package that are enabled, - # libraries, library dirs, and include dirs - # - - set(FULL_PACKAGE_SET "") - set(FULL_LIBRARY_SET "") - - - if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - print_var(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) - endif() - - foreach(TRIBITS_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) - - if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - print_var(TRIBITS_PACKAGE) - if (${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) - print_var(${TRIBITS_PACKAGE}_HAS_NATIVE_LIBRARIES_TO_INSTALL) - endif() - endif() - - set(APPEND_THE_PACKAGE TRUE) - set(APPEND_THE_PACKAGE_LIBS TRUE) - - if (NOT ${TRIBITS_PACKAGE}_HAS_NATIVE_LIBRARIES_TO_INSTALL) - set(APPEND_THE_PACKAGE_LIBS FALSE) - endif() - - if (APPEND_THE_PACKAGE) - list(APPEND FULL_PACKAGE_SET ${TRIBITS_PACKAGE}) - if (APPEND_THE_PACKAGE_LIBS) - append_set(FULL_LIBRARY_SET ${${TRIBITS_PACKAGE}_LIBRARIES}) - else() - if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - message("-- " "Skipping adding the package libs!") - endif() - endif() - else() - if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - message("-- " "Skipping adding the package!") - endif() - endif() - - if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - print_var(FULL_PACKAGE_SET) - print_var(FULL_LIBRARY_SET) - endif() - - endforeach() - - # Must prepend the current package and its libraries itself so that we get - # its TPLs libraries. However, if the current package has no native - # libraries (yet), then there is no point in listing the package or its - # TPLs. Why would a package list TPLs (with actual libraries) if itself - # does not have libraries to export? Note, this does not affect internal - # tests and examples which could have TPLs but no native libraries. - if (${PACKAGE_NAME}_LIBRARIES AND ${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES_TO_INSTALL) - prepend_set(FULL_PACKAGE_SET ${PACKAGE_NAME}) - prepend_set(FULL_LIBRARY_SET ${${PACKAGE_NAME}_LIBRARIES}) - endif() - - if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - message("-- " "*** Final sets of packages, libs, include dirs, and lib dirs:") - print_var(FULL_PACKAGE_SET) - print_var(FULL_LIBRARY_SET) - endif() - - # - # C) Get the set of TPLs for this package that are enabled - # - - # C.1) Get the set of enabled TPLs - - set(FULL_TPL_SET "") - foreach(TRIBITS_PACKAGE ${FULL_PACKAGE_SET}) - list(APPEND FULL_TPL_SET ${${TRIBITS_PACKAGE}_LIB_REQUIRED_DEP_TPLS}) - set(OPTIONAL_TPLS ${${TRIBITS_PACKAGE}_LIB_OPTIONAL_DEP_TPLS}) - foreach(TPL ${OPTIONAL_TPLS}) - # Only add if support for the optional TPL is enabled in this - # package. Don't just check if the TPL is enabled! - if(${TRIBITS_PACKAGE}_ENABLE_${TPL}) - list(APPEND FULL_TPL_SET ${TPL}) - endif() - endforeach() - endforeach() - if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - print_var(FULL_TPL_SET) - endif() - - # C.2) Sort the TPLs according to the master TPL list - - #We will use the complete list of supported tpls for the project - #to help us create a properly ordered list of tpls. - if (FULL_TPL_SET) - set(ORDERED_FULL_TPL_SET ${FULL_TPL_SET}) - tribits_sort_list_according_to_master_list("${${PROJECT_NAME}_REVERSE_DEFINED_TPLS}" - ORDERED_FULL_TPL_SET) - endif() - - if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - print_var(ORDERED_FULL_TPL_SET) - endif() - - # - # D) Get the libraries, library dirs, and the include dirs for the - # upstream enabled TPLs - # - - set(${PACKAGE_NAME}_TPL_LIBRARIES "") - foreach(TPL ${ORDERED_FULL_TPL_SET}) - list(APPEND ${PACKAGE_NAME}_TPL_LIBRARIES ${TPL}::all_libs) - endforeach() - # Generate a note discouraging editing of the Config.cmake file set(DISCOURAGE_EDITING "Do not edit: This file was generated automatically by CMake.") # - # E) Deal with the library rpath issues with shared libs + # B) Deal with the library rpath issues with shared libs # # Write the specification of the rpath if necessary. This is only needed if @@ -309,14 +195,14 @@ function(tribits_write_flexible_package_client_export_files) endif() # - # F) Create the contents of the Config.cmake file for the build tree + # C) Create the contents of the Config.cmake file for the build tree # tribits_generate_package_config_file_for_build_tree(${PACKAGE_NAME} EXPORT_FILE_VAR_PREFIX ${EXPORT_FILE_VAR_PREFIX}) # - # G) Create Config_install.cmake file for the install tree + # D) Create Config_install.cmake file for the install tree # tribits_generate_package_config_file_for_install_tree(${PACKAGE_NAME} @@ -787,28 +673,6 @@ function(tribits_write_project_client_export_files) # Custom code in configuration file. set(PROJECT_CONFIG_CODE "") - # # Export targets from the build tree. - # if(FULL_LIBRARY_SET) - # list(SORT FULL_LIBRARY_SET) - # list(REMOVE_DUPLICATES FULL_LIBRARY_SET) - # set(FULL_LIBRARY_TARGET_SET) - # foreach(LIB_ELE ${FULL_LIBRARY_SET}) - # if (TARGET ${LIB_ELE}) - # list(APPEND FULL_LIBRARY_TARGET_SET ${LIB_ELE}) - # endif() - # endforeach() - # export(TARGETS ${FULL_LIBRARY_TARGET_SET} FILE - # "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake") - # # Import the targets in applications. - # set(PROJECT_CONFIG_CODE "${PROJECT_CONFIG_CODE} - ## Import ${PROJECT_NAME} targets - #if(NOT ${PROJECT_NAME}_TARGETS_IMPORTED) - # set(${PROJECT_NAME}_TARGETS_IMPORTED 1) - # include(\"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake\") - #endif() - #") - # endif() - # Appending the logic to include each package's config file. set(LOAD_CODE "# Load configurations from enabled packages") foreach(TRIBITS_PACKAGE ${FULL_PACKAGE_SET}) @@ -916,7 +780,6 @@ include(\"${${TRIBITS_PACKAGE}_BINARY_DIR}/${TRIBITS_PACKAGE}Config.cmake\")") endfunction() - macro(tribits_set_compiler_var_for_config_file LANG FOR_DIR) if (NOT "${CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE_${FOR_DIR}}" STREQUAL "") set(CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE diff --git a/tribits/examples/TribitsExampleApp/AppHelperFuncs.cmake b/tribits/examples/TribitsExampleApp/AppHelperFuncs.cmake index 471f33eb2..bfd38d815 100644 --- a/tribits/examples/TribitsExampleApp/AppHelperFuncs.cmake +++ b/tribits/examples/TribitsExampleApp/AppHelperFuncs.cmake @@ -65,7 +65,6 @@ macro(getTribitsExProjStuffForAppByProject) message(" TribitsExProj_DIR = ${TribitsExProj_DIR}") message(" TribitsExProj_VERSION = ${TribitsExProj_VERSION}") message(" TribitsExProj_PACKAGE_LIST = ${TribitsExProj_PACKAGE_LIST}") - message(" TribitsExProj_TPL_LIST = ${TribitsExProj_TPL_LIST}") message(" TribitsExProj_BUILD_SHARED_LIBS = ${TribitsExProj_BUILD_SHARED_LIBS}") message("End of TribitsExProj details\n") @@ -139,7 +138,7 @@ endfunction() # function(getExpectedAppDepsStr expectedDepsStrOut) - if ("SimpleTpl" IN_LIST SimpleCxx_TPL_LIST) + if (TARGET SimpleTpl::all_libs) set(simpleCxxDeps "simpletpl ") else() set(simpleCxxDeps "") diff --git a/tribits/examples/TribitsOldSimpleExampleApp/CMakeLists.txt b/tribits/examples/TribitsOldSimpleExampleApp/CMakeLists.txt index 34302ee7b..b0d9d5d06 100644 --- a/tribits/examples/TribitsOldSimpleExampleApp/CMakeLists.txt +++ b/tribits/examples/TribitsOldSimpleExampleApp/CMakeLists.txt @@ -52,11 +52,14 @@ target_include_directories(app enable_testing() -if ("SimpleTpl" IN_LIST TribitsExProj_TPL_LIST) +if ("SimpleTpl" IN_LIST TribitsExProj_TPL_LIST OR TARGET SimpleTpl::all_libs) set(simpleCxxDeps "simpletpl headeronlytpl") else() set(simpleCxxDeps "headeronlytpl") endif() +# NOTE: Above, TribitsExProj_TPL_LIST does not exist in new TriBITS so to make +# this work for new TriBITS as well, we need to check for target +# SimpleTpl::all_libs. Small price to pay for progress! add_test(NAME util_test COMMAND util) set_tests_properties(util_test PROPERTIES diff --git a/tribits/examples/TribitsSimpleExampleApp/CMakeLists.txt b/tribits/examples/TribitsSimpleExampleApp/CMakeLists.txt index 425e0717c..58725b4fc 100644 --- a/tribits/examples/TribitsSimpleExampleApp/CMakeLists.txt +++ b/tribits/examples/TribitsSimpleExampleApp/CMakeLists.txt @@ -39,7 +39,7 @@ target_link_libraries(app PRIVATE TribitsExProj::all_selected_libs) enable_testing() -if ("SimpleTpl" IN_LIST TribitsExProj_TPL_LIST) +if (TARGET SimpleTpl::all_libs) set(simpleCxxDeps "simpletpl headeronlytpl") else() set(simpleCxxDeps "headeronlytpl")