diff --git a/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake b/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake index b2df13c10..3d6f3b65f 100644 --- a/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake +++ b/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake @@ -618,7 +618,7 @@ tribits_add_advanced_test( TribitsExampleProject_NoFortran_reduced_tarball ARGS -E make_directory tribitsexproj-1.1-Source/packages/mixed_lang TEST_5 - MESSAGE "Configure from the untarred reduced source tree" + MESSAGE "Configure from the untarred reduced source tree warning about missing packages and test tribits_disable_optional_dependency()" WORKING_DIRECTORY BUILD2 CMND ${CMAKE_COMMAND} ARGS @@ -652,6 +652,35 @@ tribits_add_advanced_test( TribitsExampleProject_NoFortran_reduced_tarball ALWAYS_FAIL_ON_NONZERO_RETURN TEST_6 + MESSAGE "Configure from the untarred reduced source tree only noting missing packages to test that" + WORKING_DIRECTORY BUILD2 + CMND ${CMAKE_COMMAND} + ARGS + ${TribitsExampleProject_COMMON_CONFIG_ARGS} + -DTribitsExProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DTribitsExProj_ENABLE_Fortran=OFF + -DTribitsExProj_ENABLE_SECONDARY_TESTED_CODE=ON + -DTribitsExProj_ENABLE_ALL_PACKAGES=ON + -DTribitsExProj_ENABLE_TESTS=ON + -DTribitsExProj_ASSERT_DEFINED_DEPENDENCIES=OFF + -DTribitsExProj_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES=ON + ../tribitsexproj-1.1-Source + PASS_REGULAR_EXPRESSION_ALL + "-- NOTE: InsertedPkg is being ignored since its directory is missing and InsertedPkg_ALLOW_MISSING_EXTERNAL_PACKAGE = TRUE" + "-- NOTE: MixedLang is being ignored since its directory is missing and TribitsExProj_ASSERT_DEFINED_DEPENDENCIES = OFF" + "Final set of enabled top-level packages: SimpleCxx WithSubpackages 2" + "Final set of enabled packages: SimpleCxx WithSubpackagesA WithSubpackagesB WithSubpackages 4" + "Final set of non-enabled top-level packages: 0" + "Final set of non-enabled packages: 0" + "Processing enabled top-level package: SimpleCxx [(]Libs, Tests, Examples[)]" + "Processing enabled top-level package: WithSubpackages [(]A, B, Tests, Examples[)]" + "-- Configuring done" + "-- Generating done" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_7 MESSAGE "Build reduced project default 'all' target using raw 'make'" WORKING_DIRECTORY BUILD2 SKIP_CLEAN_WORKING_DIRECTORY @@ -662,7 +691,7 @@ tribits_add_advanced_test( TribitsExampleProject_NoFortran_reduced_tarball "Built target pws_b" ALWAYS_FAIL_ON_NONZERO_RETURN - TEST_7 + TEST_8 MESSAGE "Run all the tests in reduced project with raw 'ctest'" WORKING_DIRECTORY BUILD2 SKIP_CLEAN_WORKING_DIRECTORY diff --git a/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraphHelpers.cmake b/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraphHelpers.cmake index fa29d1736..f296106fa 100644 --- a/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraphHelpers.cmake +++ b/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraphHelpers.cmake @@ -92,9 +92,11 @@ set(${PROJECT_NAME}_EXTRA_REPOSITORIES extraRepoTwoPackages) # For running other lower-level functions set(REPOSITORY_NAME "Trilinos") +set(${REPOSITORY_NAME}_TPLS_FILE + ${CMAKE_CURRENT_LIST_DIR}/MiniMockTrilinosFiles/TPLsList.cmake) +include(${${REPOSITORY_NAME}_TPLS_FILE}) include(${CMAKE_CURRENT_LIST_DIR}/MiniMockTrilinosFiles/PackagesList.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/MiniMockTrilinosFiles/TPLsList.cmake) set(EXTRA_REPO_NAME extraRepoTwoPackages) set(EXTRA_REPO_DIR extraRepoTwoPackages) @@ -102,7 +104,7 @@ set(EXTRA_REPO_DIR extraRepoTwoPackages) set(REPOSITORY_NAME ${EXTRA_REPO_NAME}) include(${PROJECT_SOURCE_DIR}/${EXTRA_REPO_NAME}/PackagesList.cmake) -set(${EXTRA_REPO_NAME}_TPLS_FINDMODS_CLASSIFICATIONS) +set(${EXTRA_REPO_NAME}_TPLS_FINDMODS_CLASSIFICATIONS "") set(${PROJECT_NAME}_ALL_REPOSITORIES "." "${EXTRA_REPO_NAME}") diff --git a/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake b/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake index 3d7f4ac05..584b5c11d 100644 --- a/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake +++ b/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake @@ -587,6 +587,7 @@ function(unittest_extra_repo_missing_optional_package) #set(TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS ON) #set(${PROJECT_NAME}_VERBOSE_CONFIGURE ON) + tribits_process_tpls_lists(${PROJECT_NAME} ".") tribits_process_packages_and_dirs_lists(${PROJECT_NAME} ".") tribits_process_packages_and_dirs_lists(${EXTRA_REPO_NAME} ${EXTRA_REPO_DIR}) @@ -617,14 +618,15 @@ function(unittest_extra_repo_missing_optional_package_verbose) #set(TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS ON) #set(${PROJECT_NAME}_VERBOSE_CONFIGURE ON) + tribits_process_tpls_lists(${PROJECT_NAME} ".") tribits_process_packages_and_dirs_lists(${PROJECT_NAME} ".") tribits_process_packages_and_dirs_lists(${EXTRA_REPO_NAME} ${EXTRA_REPO_DIR}) - global_set(MESSAGE_WRAPPER_INPUT) + global_set(MESSAGE_WRAPPER_INPUT) tribits_read_deps_files_create_deps_graph() unittest_compare_const(MESSAGE_WRAPPER_INPUT - "NOTE: MissingUpstreamPackage is being ignored since its directory; is missing and MissingUpstreamPackage_ALLOW_MISSING_EXTERNAL_PACKAGE =; TRUE!;-- ;Trilinos_NUM_DEFINED_INTERNAL_PACKAGES='4'") + "-- NOTE: MissingUpstreamPackage is being ignored since its directory; is missing and MissingUpstreamPackage_ALLOW_MISSING_EXTERNAL_PACKAGE =; TRUE!;-- ;Trilinos_NUM_DEFINED_INTERNAL_PACKAGES='4'") unittest_compare_const( ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES "Teuchos;RTOp;Ex2Package1;Ex2Package2") unittest_compare_const(${PROJECT_NAME}_ENABLE_Ex2Package1 "") @@ -646,14 +648,15 @@ function(unittest_extra_repo_missing_required_package) #set(TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS ON) #set(${PROJECT_NAME}_VERBOSE_CONFIGURE ON) + tribits_process_tpls_lists(${PROJECT_NAME} ".") tribits_process_packages_and_dirs_lists(${PROJECT_NAME} ".") tribits_process_packages_and_dirs_lists(${EXTRA_REPO_NAME} ${EXTRA_REPO_DIR}) - global_set(MESSAGE_WRAPPER_INPUT) + global_set(MESSAGE_WRAPPER_INPUT) tribits_read_deps_files_create_deps_graph() unittest_compare_const(MESSAGE_WRAPPER_INPUT - "NOTE: Setting Trilinos_ENABLE_Ex2Package1=OFF because; package Ex2Package1 has a required dependency on missing; package MissingUpstreamPackage!;-- ;Trilinos_NUM_DEFINED_INTERNAL_PACKAGES='4'") + "-- NOTE: Setting Trilinos_ENABLE_Ex2Package1=OFF because; package Ex2Package1 has a required dependency on missing; package MissingUpstreamPackage!;-- ;Trilinos_NUM_DEFINED_INTERNAL_PACKAGES='4'") unittest_compare_const( ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES "Teuchos;RTOp;Ex2Package1;Ex2Package2") unittest_compare_const(${PROJECT_NAME}_ENABLE_Ex2Package1 OFF) @@ -678,6 +681,7 @@ function(unittest_extra_repo_missing_required_package_verbose) #set(TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS ON) #set(${PROJECT_NAME}_VERBOSE_CONFIGURE ON) + tribits_process_tpls_lists(${PROJECT_NAME} ".") tribits_process_packages_and_dirs_lists(${PROJECT_NAME} ".") tribits_process_packages_and_dirs_lists(${EXTRA_REPO_NAME} ${EXTRA_REPO_DIR}) @@ -685,7 +689,7 @@ function(unittest_extra_repo_missing_required_package_verbose) tribits_read_deps_files_create_deps_graph() unittest_compare_const(MESSAGE_WRAPPER_INPUT - "NOTE: MissingUpstreamPackage is being ignored since its directory; is missing and MissingUpstreamPackage_ALLOW_MISSING_EXTERNAL_PACKAGE =; TRUE!;NOTE: Setting Trilinos_ENABLE_Ex2Package1=OFF because; package Ex2Package1 has a required dependency on missing; package MissingUpstreamPackage!;-- ;Trilinos_NUM_DEFINED_INTERNAL_PACKAGES='4'") + "-- NOTE: MissingUpstreamPackage is being ignored since its directory; is missing and MissingUpstreamPackage_ALLOW_MISSING_EXTERNAL_PACKAGE =; TRUE!;-- NOTE: Setting Trilinos_ENABLE_Ex2Package1=OFF because; package Ex2Package1 has a required dependency on missing; package MissingUpstreamPackage!;-- ;Trilinos_NUM_DEFINED_INTERNAL_PACKAGES='4'") unittest_compare_const( ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES "Teuchos;RTOp;Ex2Package1;Ex2Package2") unittest_compare_const(${PROJECT_NAME}_ENABLE_Ex2Package1 OFF) diff --git a/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake b/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake index 4fd5f1d96..98fa30b1a 100644 --- a/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake +++ b/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake @@ -367,11 +367,13 @@ endfunction() # @MACRO: tribits_process_packages_and_dirs_lists() # +# Read in a list of packages and basic info info +# # Usage:: # -# tribits_process_packages_and_dirs_lists() +# tribits_process_packages_and_dirs_lists( ) # -# Macro that processes the list variable:: +# This macro processes the list variable:: # # ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS # diff --git a/tribits/core/package_arch/TribitsProcessTplsLists.cmake b/tribits/core/package_arch/TribitsProcessTplsLists.cmake index a30a09404..72e2a0fca 100644 --- a/tribits/core/package_arch/TribitsProcessTplsLists.cmake +++ b/tribits/core/package_arch/TribitsProcessTplsLists.cmake @@ -118,16 +118,24 @@ endmacro() # @MACRO: tribits_process_tpls_lists() # -# This macro that processes the project-level variable:: +# Reads in the list of external packages/TPLs and the location of there +# definition files. +# +# Usage:: +# +# tribits_process_tpls_lists( ) +# +# This macro processes the project-level variable:: # # ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS # -# This updates the project-level variables: +# from a `/TPLsList.cmake` file that just got read in and updates the +# project-level non-cache variables: # # * `${PROJECT_NAME}_DEFINED_TPLS`_ # * `${PROJECT_NAME}_NUM_DEFINED_TPLS`_ # -# For each TPL, it also sets the variables: +# For each external package/TPL, it also sets the variables: # # * `${TPL_NAME}_FINDMOD`_ # * `${TPL_NAME}_TESTGROUP`_ diff --git a/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake b/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake index 495388e54..02534d880 100644 --- a/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake +++ b/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake @@ -571,22 +571,19 @@ macro(tribits_set_dep_packages__handle_undefined_pkg packageName depPkg if (errorOutForUndefinedDepPkg) tribits_abort_on_missing_package("${depPkg}" "${packageName}") else() - if (${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE) - if (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES) - message_wrapper("NOTE: ${depPkg} is being ignored since its directory" - " is missing and ${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE =" - " ${${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE}!") - endif() - if ("${requiredOrOptional}" STREQUAL "REQUIRED") - message_wrapper("NOTE: Setting ${packageEnableVar}=OFF because" - " package ${packageName} has a required dependency on missing" - " package ${depPkg}!") - set(${packageEnableVar} OFF) - endif() + tribits_warn_about_ignored_missing_pkg_dep("${packageName}" "${depPkg}" + "${requiredOrOptional}" "${packageEnableVar}" ) + # Must set the package itself off if it is a required dependency + if ("${requiredOrOptional}" STREQUAL "REQUIRED") + message_wrapper("-- NOTE: Setting ${packageEnableVar}=OFF because" + " package ${packageName} has a required dependency on missing" + " package ${depPkg}!") + set(${packageEnableVar} OFF) endif() # Must set enable vars for missing package to off so that logic in # existing downstream packages that key off of these vars will still - # work. + # work. (NOTE: If this is a required dependency, it is also good to set + # these to off as well and not incorrect.) set(${PROJECT_NAME}_ENABLE_${depPkg} OFF) set(${packageName}_ENABLE_${depPkg} OFF) tribits_get_have_package_dependency_macro_name(${packageName} ${depPkg} @@ -596,6 +593,26 @@ macro(tribits_set_dep_packages__handle_undefined_pkg packageName depPkg endmacro() +function(tribits_warn_about_ignored_missing_pkg_dep packageName depPkg + requiredOrOptional packageEnableVar + ) +# message_wrapper("\ntribits_warn_about_ignored_missing_pkg_dep('${packageName}' '${depPkg}' '${requiredOrOptional}' '${packageEnableVar}')") + if (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES) + if (${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE) + message_wrapper("-- NOTE: ${depPkg} is being ignored since its directory" + " is missing and ${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE =" + " ${${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE}!") + elseif (NOT ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST + ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST + ) + message_wrapper("-- NOTE: ${depPkg} is being ignored since its directory" + " is missing and ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES =" + " ${${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES}!") + endif() + endif() +endfunction() + + # @MACRO: tribits_append_forward_dep_packages() # # Appends forward/downstream package dependency lists for the upstream diff --git a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index 06600479e..eec6819e5 100644 --- a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst @@ -3023,9 +3023,9 @@ One of the CMake configure-time debug-mode checks performed as part of ``_ENABLE_DEVELOPMENT_MODE=ON`` is to assert the existence of TriBITS package directories. In development mode, the failure to find a package directory is usually a programming error (i.e. a miss-spelled package -directory name). But in a tarball release of the project, package directories -may be purposefully missing (see `Creating a tarball of the source tree`_) and -must be ignored. +directory name). But in a reduced tarball release of the project, package +directories may be purposefully missing (see `Creating a tarball of the source +tree`_) and must be ignored. When building from a reduced source tarball created from the development sources, set:: @@ -3043,15 +3043,17 @@ Another type of checking is for optional inserted/external packages (e.g. packages who's source can optionally be included and is flagged with ``tribits_allow_missing_external_packages()``). Any of these package directories that are missing result in the packages being silently ignored by -default. However, notes on what missing packages are being ignored can -printed by configuring with:: +default. Also, when there are packages that are purposefully missing in a +reduced tarball build (which are allowed by setting +``_ASSERT_DEFINED_DEPENDENCIES=OFF``), these are also silently +ignored. However, notes on which of these packages are missing can be printed +to the CMAKE STDOUT by setting:: -D _WARN_ABOUT_MISSING_EXTERNAL_PACKAGES=TRUE -These warnings starting with 'NOTE' (not starting with 'WARNING' that would -otherwise trigger warnings in CDash) about missing inserted/external packages -will print regardless of the setting for -``_ASSERT_DEFINED_DEPENDENCIES``. +These STDOUT lines starting with 'NOTE' (not starting with 'WARNING' that +would otherwise trigger warnings in CDash) about missing packages will print +regardless of the setting for ``_ASSERT_DEFINED_DEPENDENCIES``. Finally, ``_ENABLE_DEVELOPMENT_MODE=ON`` results in a number of checks for invalid usage of TriBITS in the project's ``CMakeLists.txt`` files