diff --git a/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake b/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake index 785726392..27daaf1cc 100644 --- a/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake +++ b/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake @@ -2569,7 +2569,7 @@ tribits_add_advanced_test( TribitsExampleProject_HeaderOnlyTpl_FailThenPass "When you reconfigure, just grep the cmake stdout for 'HeaderOnlyTpl'" "and then follow the disables that occur as a result to see what impact" "this TPL disable has on the configuration of TribitsExProj." - "CMake Error at .+/TribitsProcessEnabledTpl[.]cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" " ERROR: TPL_HeaderOnlyTpl_NOT_FOUND=TRUE, aborting!" "Call Stack .most recent call first.:" "-- Configuring incomplete, errors occurred!" @@ -2624,7 +2624,7 @@ tribits_add_advanced_test( TribitsExampleProject_HeaderOnlyTpl_HardEnable_Fail "and then follow the disables that occur as a result to see what impact" "this TPL disable has on the configuration of TribitsExProj." "-- ERROR: Failed finding all of the parts of TPL 'HeaderOnlyTpl' .see above., Aborting!" - "CMake Error at .+/TribitsProcessEnabledTpl[.]cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" " ERROR: TPL_HeaderOnlyTpl_NOT_FOUND=TRUE, aborting!" "Call Stack .most recent call first.:" "-- Configuring incomplete, errors occurred!" @@ -3293,14 +3293,12 @@ tribits_add_advanced_test( TribitsExampleProject_SimpleCxx_External -DCMAKE_PREFIX_PATH=../install/simple_cxx -DTPL_ENABLE_MPI=OFF -DTPL_ENABLE_SimpleTpl=ON - -DSimpleTpl_INCLUDE_DIRS=${SimpleTpl_install_STATIC_DIR}/install/include - -DSimpleTpl_LIBRARY_DIRS=${SimpleTpl_install_STATIC_DIR}/install/lib - # ToDo: Remove how to find SimpleTpl because SimpleCxx should already - # have that found and we should just use what it found! ../TribitsExampleProject PASS_REGULAR_EXPRESSION_ALL "Adjust the set of internal and external packages:" "-- Treating internal package SimpleCxx as EXTERNAL because TPL_ENABLE_SimpleCxx=ON" + "-- NOTE: HeaderOnlyTpl is directly downstream from an fully TriBITS-compatible external package SimpleCxx" + "-- NOTE: SimpleTpl is directly downstream from an fully TriBITS-compatible external package SimpleCxx" "Final set of enabled top-level packages: MixedLang WithSubpackages WrapExternal 3" "Final set of enabled packages: MixedLang WithSubpackagesA WithSubpackagesB WithSubpackagesC WithSubpackages WrapExternal 6" @@ -3311,15 +3309,16 @@ tribits_add_advanced_test( TribitsExampleProject_SimpleCxx_External "Final set of non-enabled top-level external packages/TPLs: MPI 1" "Final set of non-enabled external packages/TPLs: MPI 1" - "Getting information for all enabled external packages/TPLs ..." + "Getting information for all enabled fully TriBITS-compatible or upstream external packages/TPLs ..." "Processing enabled external package/TPL: HeaderOnlyTpl [(]enabled by SimpleCxx, disable with -DTPL_ENABLE_HeaderOnlyTpl=OFF[)]" - "-- TPL_HeaderOnlyTpl_INCLUDE_DIRS='.*/tribits/examples/tpls/HeaderOnlyTpl'" + "-- The external package/TPL HeaderOnlyTpl will be read in by a downstream fully TriBITS-compliant external package" "Processing enabled external package/TPL: SimpleTpl [(]enabled explicitly, disable with -DTPL_ENABLE_SimpleTpl=OFF[)]" - "-- TPL_SimpleTpl_LIBRARIES='.*/TriBITS_SimpleTpl_install_STATIC/install/lib/libsimpletpl.a'" - "-- TPL_SimpleTpl_INCLUDE_DIRS='.*/TriBITS_SimpleTpl_install_STATIC/install/include'" + "-- The external package/TPL SimpleTpl will be read in by a downstream fully TriBITS-compliant external package" "Processing enabled external package/TPL: SimpleCxx [(]enabled explicitly, disable with -DTPL_ENABLE_SimpleCxx=OFF[)]" "-- Calling find_package[(]SimpleCxx[)] for TriBITS-compatible package ..." + "Getting information for all enabled external packages/TPLs ..." + "Configuring individual enabled TribitsExProj packages ..." "Processing enabled top-level package: MixedLang [(]Libs, Tests, Examples[)]" "Processing enabled top-level package: WithSubpackages [(]A, B, C, Tests, Examples[)]" diff --git a/test/core/ProcessEnabledTpls/CMakeLists.txt b/test/core/ProcessEnabledTpls/CMakeLists.txt index a7bb7e0c0..743bc410e 100644 --- a/test/core/ProcessEnabledTpls/CMakeLists.txt +++ b/test/core/ProcessEnabledTpls/CMakeLists.txt @@ -223,7 +223,7 @@ create_process_enabled_tpls_test_case( "When you reconfigure, just grep the cmake stdout for 'HeaderOnlyTpl'" "and then follow the disables that occur as a result to see what impact" "this TPL disable has on the configuration of DummyProj." - "CMake Error at .+/TribitsProcessEnabledTpl[.]cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeaderOnlyTpl_NOT_FOUND=TRUE, aborting!" ) @@ -244,7 +244,7 @@ create_process_enabled_tpls_test_case( "and then follow the disables that occur as a result to see what impact" "this TPL disable has on the configuration of ${MOCK_PROJECT_NAME}." "-- ERROR: Failed finding all of the parts of TPL 'HeaderOnlyTpl' .see above., Aborting!" - "CMake Error at .+/TribitsProcessEnabledTpl[.]cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeaderOnlyTpl_NOT_FOUND=TRUE, aborting!" ) @@ -481,7 +481,7 @@ create_process_enabled_tpls_test_case( "When you reconfigure, just grep the cmake stdout for 'HeadersAndLibsTpl'" "and then follow the disables that occur as a result to see what impact" "this TPL disable has on the configuration of DummyProj." - "CMake Error at .+/TribitsProcessEnabledTpl.cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeadersAndLibsTpl_NOT_FOUND=TRUE, aborting!" ) @@ -503,7 +503,7 @@ create_process_enabled_tpls_test_case( "-- TIP: If the TPL 'HeadersAndLibsTpl' is on your system then you can set:" "-- ERROR: Failed finding all of the parts of TPL 'HeadersAndLibsTpl' .see above., Aborting!" "TIP: One way to get past the configure failure for the" - "CMake Error at .+/TribitsProcessEnabledTpl.cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeadersAndLibsTpl_NOT_FOUND=TRUE, aborting!" ) @@ -526,7 +526,7 @@ create_process_enabled_tpls_test_case( "-- TIP: If the TPL 'HeadersAndLibsTpl' is on your system then you can set:" "-- ERROR: Failed finding all of the parts of TPL 'HeadersAndLibsTpl' .see above., Aborting!" "TIP: One way to get past the configure failure for the" - "CMake Error at .+/TribitsProcessEnabledTpl.cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeadersAndLibsTpl_NOT_FOUND=TRUE, aborting!" ) @@ -545,7 +545,7 @@ create_process_enabled_tpls_test_case( "-- Searching for libs in HeadersAndLibsTpl_LIBRARY_DIRS='.+/HeadersAndLibsTpl/lib'" "-- Searching for a lib in the set .badlibname.:" "-- NOTE: Did not find a lib in the lib set .badlibname. for the TPL 'HeadersAndLibsTpl'!" - "CMake Error at .+/TribitsProcessEnabledTpl.cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeadersAndLibsTpl_NOT_FOUND=TRUE, aborting!" ) @@ -563,7 +563,7 @@ create_process_enabled_tpls_test_case( "-- Searching for libs in HeadersAndLibsTpl_LIBRARY_DIRS='.+/HeadersAndLibsTpl/lib'" "-- Searching for a lib in the set .badlibname.:" "-- ERROR: Did not find a lib in the lib set .badlibname. for the TPL 'HeadersAndLibsTpl'!" - "CMake Error at .+/TribitsProcessEnabledTpl.cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeadersAndLibsTpl_NOT_FOUND=TRUE, aborting!" ) @@ -603,7 +603,7 @@ create_process_enabled_tpls_test_case( "-- Searching for libs in HeadersAndLibsTpl_LIBRARY_DIRS='.+/HeadersAndLibsTpl/lib'" "-- Searching for a lib in the set .badlibname.:" "-- ERROR: Did not find a lib in the lib set .badlibname. for the TPL 'HeadersAndLibsTpl'!" - "CMake Error at .+/TribitsProcessEnabledTpl.cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeadersAndLibsTpl_NOT_FOUND=TRUE, aborting!" ) @@ -626,7 +626,7 @@ create_process_enabled_tpls_test_case( "-- TIP: If the TPL 'HeadersAndLibsTpl' is on your system then you can set:" "-- ERROR: Failed finding all of the parts of TPL 'HeadersAndLibsTpl' .see above., Aborting!" "TIP: Even though the TPL 'HeadersAndLibsTpl' was explicitly enabled in input," - "CMake Error at .+/TribitsProcessEnabledTpl.cmake:[0-9]+ [(]message[)]:" + "CMake Error at .+/TribitsProcessEnabledTpls[.]cmake:[0-9]+ [(]message[)]:" "ERROR: TPL_HeadersAndLibsTpl_NOT_FOUND=TRUE, aborting!" ) diff --git a/test/core/ProcessEnabledTpls/TribitsProcessEnabledTplTesterCMakeLists.txt b/test/core/ProcessEnabledTpls/TribitsProcessEnabledTplTesterCMakeLists.txt index f80450482..ac1956339 100644 --- a/test/core/ProcessEnabledTpls/TribitsProcessEnabledTplTesterCMakeLists.txt +++ b/test/core/ProcessEnabledTpls/TribitsProcessEnabledTplTesterCMakeLists.txt @@ -56,7 +56,7 @@ set( CMAKE_MODULE_PATH "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" ) -include(TribitsProcessEnabledTpl) +include(TribitsProcessEnabledTpls) # Passed in on command-line print_var("TPL_NAME") @@ -72,7 +72,7 @@ endif() # Do the processing of the TPL message("") -tribits_process_enabled_tpl(${TPL_NAME}) +tribits_process_enabled_standard_tpl(${TPL_NAME}) message("") message("Exported TPL_ENABLE_${TPL_NAME}='${TPL_ENABLE_${TPL_NAME}}'") message("Exported TPL_${TPL_NAME}_NOT_FOUND='${TPL_${TPL_NAME}_NOT_FOUND}'") diff --git a/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake b/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake index 172888759..e99e6161b 100644 --- a/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake +++ b/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake @@ -853,6 +853,11 @@ macro(tribits_set_package_and_related_upstream_packages_to_external packageName tribits_set_upstream_dep_packages_as_external(${packageName} ${subpackageTriggeredParentPackageExternal}) + if (${packageName}_PACKAGE_BUILD_STATUS STREQUAL "EXTERNAL") + tribits_set_package_and_deps_as_processed_by_downstream_tribits_external_package( + ${packageName}) + endif() + endmacro() # NOTE: In the above macro, if ${packageName} is made EXTERNAL because it one # of its subpackages is considered EXTERNAL, then the loop over all of the @@ -1315,6 +1320,48 @@ macro(tribits_set_upstream_dep_packages_as_external packageName endmacro() +# Macro that sets all of the direct upstream dependent packages as being +# processed by a downstream fully TriBITS compliant external package. +macro(tribits_set_package_and_deps_as_processed_by_downstream_tribits_external_package + packageName + ) + + if ("${${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE}" + STREQUAL "" + ) + set(${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE FALSE) + endif() + + tribits_get_package_enable_status(${packageName} packageEnable "") + + if (${packageName}_PACKAGE_BUILD_STATUS STREQUAL "EXTERNAL" + AND (${packageName}_IS_FULLY_TRIBITS_COMPLIANT + OR ${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE) + ) + + if (${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE) + set(directOrIndirectStr "indirectly") + set(downstreamPkgStr "") + else() + set(directOrIndirectStr "directly") + set(downstreamPkgStr " ${packageName}") + endif() + + foreach(depPkg IN LISTS ${packageName}_LIB_DEFINED_DEPENDENCIES) + tribits_get_package_enable_status(${depPkg} depPkgEnable "") + if (depPkgEnable) + message("-- " + "NOTE: ${depPkg} is ${directOrIndirectStr} downstream from an fully" + " TriBITS-compatible external package${downstreamPkgStr}") + endif() + set(${depPkg}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE TRUE) + endforeach() + + endif() + +endmacro() + + # Macro that sets ``_ENABLE_=ON`` if not already # enabled for all enabled subpackages of a parent package. # @@ -1360,21 +1407,28 @@ endmacro() # # Usage:: # -# tribits_set_internal_package_to_external( "" +# tribits_set_internal_package_to_external( "" # "" ...) # -# This always sets ``_PACKAGE_BUILD_STATUS=EXTERNAL`` but only -# prints the message if ```` is enabled. +# This always sets ``_PACKAGE_BUILD_STATUS=EXTERNAL`` but only +# prints the message if ```` is enabled. # -macro(tribits_set_internal_package_to_external packageName) - tribits_get_package_enable_status(${packageName} packageEnable packageEnableVar) - if (packageEnable) +macro(tribits_set_internal_package_to_external depPkgName) + tribits_get_package_enable_status(${depPkgName} depPkgEnable "") + if (depPkgEnable) message("-- " - "Treating internal package ${packageName} as EXTERNAL because" + "Treating internal package ${depPkgName} as EXTERNAL because" " " ${ARGN}) endif() - set(${packageName}_PACKAGE_BUILD_STATUS EXTERNAL) - set(${packageName}_FINDMOD TRIBITS_PKG) + set(${depPkgName}_PACKAGE_BUILD_STATUS EXTERNAL) + set(${depPkgName}_FINDMOD TRIBITS_PKG) +endmacro() + + +macro(tribits_set_as_processed_by_downstream_tribits_external_package packageName + depPkgName + ) + endmacro() diff --git a/tribits/core/package_arch/TribitsGlobalMacros.cmake b/tribits/core/package_arch/TribitsGlobalMacros.cmake index 94c82c494..3ebfa7d9b 100644 --- a/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -1482,25 +1482,6 @@ macro(tribits_handle_project_extra_link_flags_as_a_tpl) endmacro() -# Gather information from enabled TPLs -# -macro(tribits_process_enabled_tpls) - - tribits_config_code_start_timer(CONFIGURE_TPLS_TIME_START_SECONDS) - - tribits_filter_package_list_from_var(${PROJECT_NAME}_DEFINED_TOPLEVEL_PACKAGES - EXTERNAL ON NONEMPTY ${PROJECT_NAME}_enabledExternalTopLevelPackages) - - foreach(TPL_NAME IN LISTS ${PROJECT_NAME}_enabledExternalTopLevelPackages) - tribits_process_enabled_tpl(${TPL_NAME}) - endforeach() - - tribits_config_code_stop_timer(CONFIGURE_TPLS_TIME_START_SECONDS - "\nTotal time to configure enabled external packages/TPLs") - -endmacro() - - # # Macros for setting up the standard environment # diff --git a/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake b/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake index 52f925abb..aaf846ae0 100644 --- a/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake +++ b/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake @@ -49,11 +49,69 @@ include(AppendStringVar) include(TribitsStandardizePaths) -# @MACRO: tribits_process_enabled_tpl() +# Gather information from enabled TPLs +# +macro(tribits_process_enabled_tpls) + + tribits_config_code_start_timer(CONFIGURE_TPLS_TIME_START_SECONDS) + + tribits_filter_package_list_from_var(${PROJECT_NAME}_DEFINED_TOPLEVEL_PACKAGES + EXTERNAL ON NONEMPTY ${PROJECT_NAME}_enabledExternalTopLevelPackages) + + message("") + message("Getting information for all enabled fully TriBITS-compatible" + " or upstream external packages/TPLs ...") + message("") + + foreach(TPL_NAME IN LISTS ${PROJECT_NAME}_enabledExternalTopLevelPackages) + if (${TPL_NAME}_IS_FULLY_TRIBITS_COMPLIANT + OR ${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE + ) + tribits_process_enabled_fully_tribits_compatible_or_upstream_tpl(${TPL_NAME}) + endif() + endforeach() + + message("") + message("Getting information for all enabled external packages/TPLs ...") + message("") + + foreach(TPL_NAME IN LISTS ${PROJECT_NAME}_enabledExternalTopLevelPackages) + if ((NOT ${TPL_NAME}_IS_FULLY_TRIBITS_COMPLIANT) + AND (NOT ${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE) + ) + tribits_process_enabled_standard_tpl(${TPL_NAME}) + endif() + endforeach() + + tribits_config_code_stop_timer(CONFIGURE_TPLS_TIME_START_SECONDS + "\nTotal time to configure enabled external packages/TPLs") + +endmacro() + + +macro(tribits_process_enabled_fully_tribits_compatible_or_upstream_tpl TPL_NAME) + + tribits_get_enabled_tpl_processing_string(${TPL_NAME} tplProcessingString) + message("${tplProcessingString}") + + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + if (NOT ${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE) + tribits_process_enabled_tribits_compatible_tpl(${TPL_NAME}) + else() + message("-- " + "The external package/TPL ${TPL_NAME} will be read in by a downstream" + " fully TriBITS-compliant external package") + endif() + endif() + +endmacro() + + +# @MACRO: tribits_process_enabled_standard_tpl() # # Process an enabled TPL's FindTPL${TPL_NAME}.cmake module. # -macro(tribits_process_enabled_tpl TPL_NAME) +macro(tribits_process_enabled_standard_tpl TPL_NAME) tribits_get_enabled_tpl_processing_string(${TPL_NAME} tplProcessingString) message("${tplProcessingString}") @@ -65,14 +123,10 @@ macro(tribits_process_enabled_tpl TPL_NAME) print_var(${TPL_NAME}_FINDMOD) endif() - if (${TPL_NAME}_FINDMOD STREQUAL "TRIBITS_PKG") - tribits_process_enabled_tribits_compatible_tpl(${TPL_NAME}) - else() - tribits_process_enabled_tribits_find_tpl_mod_file(${TPL_NAME}) - tribits_address_failed_tpl_find(${TPL_NAME}) - tribits_generate_tpl_version_file_and_add_package_config_install_targets( - ${TPL_NAME}) - endif() + tribits_process_enabled_tribits_find_tpl_mod_file(${TPL_NAME}) + tribits_address_failed_tpl_find(${TPL_NAME}) + tribits_generate_tpl_version_file_and_add_package_config_install_targets( + ${TPL_NAME}) endif() diff --git a/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake b/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake index d045fdedf..76bc1e7f8 100644 --- a/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake +++ b/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake @@ -572,6 +572,7 @@ macro(tribits_process_packages_and_dirs_lists REPOSITORY_NAME REPOSITORY_DIR) set(${TRIBITS_PACKAGE}_PARENT_REPOSITORY ${REPOSITORY_NAME}) tribits_insert_standard_package_options(${TRIBITS_PACKAGE} ${PACKAGE_TESTGROUP}) set(${TRIBITS_PACKAGE}_PACKAGE_BUILD_STATUS INTERNAL) + set(${TRIBITS_PACKAGE}_IS_FULLY_TRIBITS_COMPLIANT TRUE) else() if (${PROJECT_NAME}_VERBOSE_CONFIGURE) message( @@ -593,6 +594,7 @@ macro(tribits_process_packages_and_dirs_lists REPOSITORY_NAME REPOSITORY_DIR) print_var(${TRIBITS_PACKAGE}_PARENT_PACKAGE) print_var(${TRIBITS_PACKAGE}_PARENT_REPOSITORY) print_var(${TRIBITS_PACKAGE}_PACKAGE_BUILD_STATUS) + print_var(${TRIBITS_PACKAGE}_IS_FULLY_TRIBITS_COMPLIANT) endif() if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) diff --git a/tribits/core/package_arch/TribitsProcessTplsLists.cmake b/tribits/core/package_arch/TribitsProcessTplsLists.cmake index 611dcf3f7..711169cb9 100644 --- a/tribits/core/package_arch/TribitsProcessTplsLists.cmake +++ b/tribits/core/package_arch/TribitsProcessTplsLists.cmake @@ -275,6 +275,14 @@ macro(tribits_process_tpls_lists REPOSITORY_NAME REPOSITORY_DIR) set(${TPL_NAME}_PACKAGE_BUILD_STATUS EXTERNAL) + # Set ${TPL_NAME}_IS_FULLY_TRIBITS_COMPLIANT + + if (${TPL_NAME}_FINDMOD STREQUAL "TRIBITS_PKG") + set(${TPL_NAME}_IS_FULLY_TRIBITS_COMPLIANT TRUE) + else() + set(${TPL_NAME}_IS_FULLY_TRIBITS_COMPLIANT FALSE) + endif() + # Print variables/properties for the TPL if (${PROJECT_NAME}_VERBOSE_CONFIGURE OR TRIBITS_PROCESS_TPLS_LISTS_VERBOSE) @@ -283,6 +291,7 @@ macro(tribits_process_tpls_lists REPOSITORY_NAME REPOSITORY_DIR) print_var(${TPL_NAME}_DEPENDENCIES_FILE) print_var(${TPL_NAME}_TPLS_LIST_FILE) print_var(${TPL_NAME}_PACKAGE_BUILD_STATUS) + print_var(${TPL_NAME}_IS_FULLY_TRIBITS_COMPLIANT) endif() # Set cache var TPL_ENABLE_${TPL_NAME} with default "" diff --git a/tribits/core/package_arch/TribitsProjectImpl.cmake b/tribits/core/package_arch/TribitsProjectImpl.cmake index 892cecc6b..f27caa3e6 100644 --- a/tribits/core/package_arch/TribitsProjectImpl.cmake +++ b/tribits/core/package_arch/TribitsProjectImpl.cmake @@ -190,10 +190,6 @@ macro(tribits_project_impl) # G) Go get the information for all enabled TPLS # - message("") - message("Getting information for all enabled external packages/TPLs ...") - message("") - tribits_process_enabled_tpls() # diff --git a/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst b/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst index f207dbe3a..1c58dffee 100644 --- a/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst +++ b/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst @@ -456,6 +456,82 @@ any subpackage is determined to be EXTERNAL, then the parent package of that subpackage and every other peer subpackage will also be set to EXTERNAL. +Processing of external packages/TPLs and fully TriBITS compatible external packages ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +The processing of external packages/TPLs is influenced by whether the external +package is a regular TriBITS TPL or is a fully TriBITS-compliant external +package. Here, a **Fully TriBITS-Compliant External Package** has a +``Config.cmake`` file that satisfies the following properties: + +* Has the target ``::all_libs``. +* Calls ``find_dependency()`` for all upstream packages it depends on. +* Every upstream dependent package ```` has the target + ``::all_libs``. + +That means that when calling ``find_package()`` for a fully TriBITS compliant +external package, there is no need to worry about finding any of its upstream +dependent external packages. That means that any external packages/TPLs +defined a TriBITS project which is upstream from a fully TriBITS compliant +external package will be uniquely defined by calling ``find_package()`` on the +most downstream fully TriBITS-compliant external package that depends on it. +Therefore, defining the external packages and their targets in this set of +external packages just involves calling ``find_package()`` on the terminal +fully TriBITS-compliant external packages (i.e. fully TriBITS-compliant +external packages that don't have any downstream dependencies that are +external packages). Then the remaining subset of external packages/TPLs that +don't have a downstream fully TriBITS-compliant external package dependency +will be defined as usual. (ToDo: Put in a more detailed examples explaining +how this works.) + +The variables that are set internally to define these different subsets of +external packages/TPLs are: + +* ``_IS_FULLY_TRIBITS_COMPLIANT``: Set the ``TRUE`` if the package + ```` provides the ``::all_libs`` target for itself and all + of its upstream dependent (internal or external) packages (whether this + package is treated as an internal or external package). + +* ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE``: Set to + ``TRUE`` if the external package/TPL will be processed by downstream TriBITS + complient package. In this case, we just print that we are skipping the + find operation and explain why. + +An external package with ``_IS_FULLY_TRIBITS_COMPLIANT=TRUE`` **AND** +``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE`` is the +one for which ``find_package( CONFIG REQUIRED)`` will be called and +does not have any downstream packages that are being treated as external +packages. + +The variable ``_IS_FULLY_TRIBITS_COMPLIANT`` is set right when the +packages are initially defined by reading in the various input files. That +is, all initially internal packages that are listed in a +`/PackagesList.cmake`_ file will have +``_IS_FULLY_TRIBITS_COMPLIANT=TRUE`` set. While all external +packages/TPLs listed in a `/TPLsList.cmake`_ file will have +``_IS_FULLY_TRIBITS_COMPLIANT=FALSE`` set (except for those tagged +with ``TRIBITS_PKG`` which will have +``_IS_FULLY_TRIBITS_COMPLIANT=FALSE`` set). + +NOTE: When a TriBITS TPL (i.e. ``_IS_FULLY_TRIBITS_COMPLIANT=FALSE``) +is being processed, we can't assume where its +``Config.cmake`` file exists so we must find upstream +dependencies using ``set(_DIR ...)`` and +``find_dependency( CONFIG REQUIRED)``. + +So the first loop over external packages/TPLs will be those external +packages/TPLs that have ``_IS_FULLY_TRIBITS_COMPLIANT=TRUE`` **OR** +``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=TRUE``. And we +only call ``find_package()`` for those fully TriBITS-complient external +packages that have ``_IS_FULLY_TRIBITS_COMPLIANT=TRUE`` **AND** +``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE``. + +The second loop are those external packages/TPLs that don't have a downstream +fully TriBITS-compliant external package which are all of those external +packages for which ``_IS_FULLY_TRIBITS_COMPLIANT=FALSE`` **AND** +``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE``. + + Other package-related variables +++++++++++++++++++++++++++++++ diff --git a/tribits/core/std_tpls/FindTPLMPI.cmake b/tribits/core/std_tpls/FindTPLMPI.cmake index f4917fd6a..dd555efd7 100644 --- a/tribits/core/std_tpls/FindTPLMPI.cmake +++ b/tribits/core/std_tpls/FindTPLMPI.cmake @@ -39,9 +39,9 @@ # Either the MPI compiler wrappers take care of these or the user has to set # the explicitly using basic compile flags and ${PROJECT_NAME}_EXTRA_LINK_FLAGS. -global_set(TPL_MPI_INCLUDE_DIRS) -global_set(TPL_MPI_LIBRARIES) -global_set(TPL_MPI_LIBRARY_DIRS) +global_set(TPL_MPI_INCLUDE_DIRS "") +global_set(TPL_MPI_LIBRARIES "") +global_set(TPL_MPI_LIBRARY_DIRS "") if(WIN32 AND TPL_ENABLE_MPI) find_package(MPI) diff --git a/tribits/doc/guides/TribitsGuidesBody.rst b/tribits/doc/guides/TribitsGuidesBody.rst index 9351b0bfd..ea02544d5 100644 --- a/tribits/doc/guides/TribitsGuidesBody.rst +++ b/tribits/doc/guides/TribitsGuidesBody.rst @@ -2307,7 +2307,14 @@ defined TPL ``TPL_NAME`` is assigned the following global non-cache variables: ``Repo1/TPLsList.cmake`` and ``Repo2/TPLsList.cmake`` both list the TPL ``SomeTpl``, then if ``Repo2`` is processed after ``Repo1``, then ``SomeTpl_FINDMOD`` is determined by ``Repo2/TPLsList.cmake`` and the find - module listed in ``Repo1/TPLsList.cmake`` is ignored. + module listed in ``Repo1/TPLsList.cmake`` is ignored. NOTE: The special + value ``TRIBITS_PKG`` is also recognized for external packages/TPLs that + are *fully TriBITS compliant* (i.e. defines a ``${TPL_NAME}Config.cmake`` + file provides the ``${TPL_NAME}::all_libs`` target, calls + ``find_dependency()`` on all of its upstream dependencies, + and each of those dependencies defines the ``::all_libs`` + target.) A pre-installed TriBITS package meets this definition, + obviously. .. __DEPENDENCIES_FILE: .. _${TPL_NAME}_DEPENDENCIES_FILE: diff --git a/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst b/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst index 5f0f3259b..eda331f48 100644 --- a/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst +++ b/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst @@ -38,7 +38,7 @@ @MACRO: tribits_package_define_dependencies() + @MACRO: tribits_package_postprocess() + @MACRO: tribits_process_subpackages() + -@MACRO: tribits_process_enabled_tpl() + +@MACRO: tribits_process_enabled_standard_tpl() + @MACRO: tribits_project() + @MACRO: tribits_project_define_extra_repositories() + @MACRO: tribits_project_enable_all() +