diff --git a/cmake/tribits/CHANGELOG.md b/cmake/tribits/CHANGELOG.md index de889ddac29c..558c787b124e 100644 --- a/cmake/tribits/CHANGELOG.md +++ b/cmake/tribits/CHANGELOG.md @@ -2,6 +2,20 @@ ChangeLog for TriBITS ---------------------------------------- +## 2022-08-22: + +* **Added:** Added support for exporting cache variables for packages in their + `Config.cmake` files using the new function + `tribits_pkg_export_cache_var()`. + +## 2022-08-18: + +* **Changed:** Made setting parent package tests/examples enable/disable + correctly propagate down to subpackages in a more intuitive way (see + [TriBITSPub/TriBITS#268](https://github.com/TriBITSPub/TriBITS/issues/268)). + This also results in not enabling tests for subpackages that are not + explicitly enabled or enabled as part of the forward sweep of packages + enables due to `_ENABLE_ALL_FORWARD_DEP_PACKAGES=ON`. ## 2022-08-11: @@ -11,13 +25,6 @@ ChangeLog for TriBITS and [TriBITSPub/TriBITS#510](https://github.com/TriBITSPub/TriBITS/issues/510)). -* **Changed:** Made setting parent package tests/examples enables correctly - propagate down to subpackages in a more intuitive way (see - [TriBITSPub/TriBITS#268](https://github.com/TriBITSPub/TriBITS/issues/268)). - This also results in not enabling tests for subpackages that are not - explicitly enabled or enabled as part of the forward sweep of packages - enables due to `_ENABLE_ALL_FORWARD_DEP_PACKAGES=ON`. - ## 2022-07-20: * **Changed:** Fixed TriBITS generated and installed `Config.cmake` diff --git a/cmake/tribits/common_tpls/FindTPLNetcdf.cmake b/cmake/tribits/common_tpls/FindTPLNetcdf.cmake index 9ffd66c06a63..13730f0457eb 100644 --- a/cmake/tribits/common_tpls/FindTPLNetcdf.cmake +++ b/cmake/tribits/common_tpls/FindTPLNetcdf.cmake @@ -130,7 +130,7 @@ if ("${TPL_Netcdf_PARALLEL}" STREQUAL "") string(REGEX MATCH "[01]" netcdf_par_val "${netcdf_par_string}") if (netcdf_par_val EQUAL 1) set(TPL_Netcdf_PARALLEL True CACHE INTERNAL - "True if netcdf compiled with parallel enabled") + "True if netcdf compiled with parallel enabled") endif() endif() if ("${TPL_Netcdf_PARALLEL}" STREQUAL "") diff --git a/cmake/tribits/common_tpls/find_modules/FindHDF5.cmake b/cmake/tribits/common_tpls/find_modules/FindHDF5.cmake index bed6cb04b1ca..1ec93541032f 100644 --- a/cmake/tribits/common_tpls/find_modules/FindHDF5.cmake +++ b/cmake/tribits/common_tpls/find_modules/FindHDF5.cmake @@ -389,10 +389,10 @@ else() foreach( _component ${HDF5_VALID_COMPONENTS} ) set(target ${HDF5_${_component}_TARGET}) - if ( TARGET ${target} ) - set(HDF5_${_component}_LIBRARY ${target}) - list(APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY}) - endif() + if ( TARGET ${target} ) + set(HDF5_${_component}_LIBRARY ${target}) + list(APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY}) + endif() endforeach() # Define HDF5_C_LIBRARIES to contain hdf5 and hdf5_hl C libraries @@ -470,7 +470,7 @@ else() LOCATION ${_HDF5_C_LIBRARY} LINK_LANGUAGES "C" LINK_INTERFACE_LIBRARIES "${HDF5_LINK_LIBRARIES}") - set(HDF5_C_LIBRARY ${HDF5_C_TARGET}) + set(HDF5_C_LIBRARY ${HDF5_C_TARGET}) # --- Search for the other possible component libraries @@ -495,7 +495,7 @@ else() # Define the HDF5__LIBRARY to point to the target foreach ( _component ${HDF5_VALID_COMPONENTS} ) if ( TARGET ${HDF5_${_component}_TARGET} ) - set(HDF5_${_component}_LIBRARY ${HDF5_${_component}_TARGET}) + set(HDF5_${_component}_LIBRARY ${HDF5_${_component}_TARGET}) endif() endforeach() @@ -513,7 +513,7 @@ else() set(HDF5_LIBRARIES) foreach (_component ${HDF5_VALID_COMPONENTS}) if ( TARGET ${HDF5_${_component}_TARGET} ) - list(APPEND HDF5_LIBRARIES ${_HDF5_${_component}_LIBRARY}) + list(APPEND HDF5_LIBRARIES ${_HDF5_${_component}_LIBRARY}) endif() endforeach() list(APPEND HDF5_LIBRARIES ${HDF5_LINK_LIBRARIES}) @@ -581,8 +581,8 @@ if ( NOT HDF5_FIND_QUIETLY ) set(HDF5_COMPONENTS_NOTFOUND) foreach (_component ${HDF5_VALID_COMPONENTS} ) if ( HDF5_${_component}_FOUND ) - #message(STATUS "\t HDF5_${_component}_LIBRARY\t\t=${HDF5_${_component}_LIBRARY}") - message(STATUS "\t${HDF5_${_component}_LIBRARY}") + #message(STATUS "\t HDF5_${_component}_LIBRARY\t\t=${HDF5_${_component}_LIBRARY}") + message(STATUS "\t${HDF5_${_component}_LIBRARY}") else() list(APPEND HDF5_COMPONENTS_NOTFOUND ${_component}) endif() diff --git a/cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake b/cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake index 960088f3e4cf..1e97c3e237bc 100644 --- a/cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake +++ b/cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake @@ -186,21 +186,21 @@ else(NetCDF_LIBRARIES AND NetCDF_INCLUDE_DIRS) set(NetCDF_LARGE_DIMS FALSE) endif() - set(NetCDF_PARALLEL False) + set(NetCDF_PARALLEL False) find_path(meta_path - NAMES "netcdf_meta.h" + NAMES "netcdf_meta.h" HINTS ${NetCDF_INCLUDE_DIR} NO_DEFAULT_PATH) if(meta_path) - # Search meta for NC_HAS_PARALLEL setting... - # Note that there is both NC_HAS_PARALLEL4 and NC_HAS_PARALLEL, only want NC_HAS_PARALLEL - # so add a space to end to avoid getting NC_HAS_PARALLEL4 - file(STRINGS "${meta_path}/netcdf_meta.h" netcdf_par_string REGEX "NC_HAS_PARALLEL ") - string(REGEX REPLACE "[^0-9]" "" netcdf_par_val "${netcdf_par_string}") - # NOTE: The line for NC_HAS_PARALLEL has an hdf5 string in it which results + # Search meta for NC_HAS_PARALLEL setting... + # Note that there is both NC_HAS_PARALLEL4 and NC_HAS_PARALLEL, only want NC_HAS_PARALLEL + # so add a space to end to avoid getting NC_HAS_PARALLEL4 + file(STRINGS "${meta_path}/netcdf_meta.h" netcdf_par_string REGEX "NC_HAS_PARALLEL ") + string(REGEX REPLACE "[^0-9]" "" netcdf_par_val "${netcdf_par_string}") + # NOTE: The line for NC_HAS_PARALLEL has an hdf5 string in it which results # netcdf_par_val being set to 05 or 15 above... - if (netcdf_par_val EQUAL 15) - set(NetCDF_PARALLEL True) + if (netcdf_par_val EQUAL 15) + set(NetCDF_PARALLEL True) endif() endif() @@ -291,8 +291,8 @@ else(NetCDF_LIBRARIES AND NetCDF_INCLUDE_DIRS) message(STATUS "\tNetCDF_ROOT is ${NetCDF_ROOT}") find_program(netcdf_config nc-config PATHS ${NetCDF_ROOT}/bin ${NetCDF_BIN_DIR} - NO_DEFAULT_PATH - NO_CMAKE_SYSTEM_PATH + NO_DEFAULT_PATH + NO_CMAKE_SYSTEM_PATH DOC "NetCDF configuration script") if (netcdf_config) diff --git a/cmake/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in b/cmake/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in index 15025561c294..465648d63ac3 100644 --- a/cmake/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in +++ b/cmake/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in @@ -45,6 +45,15 @@ # ############################################################################## +if(CMAKE_VERSION VERSION_LESS 3.3) + set(${PDOLLAR}{CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE + "${PACKAGE_NAME} requires CMake 3.3 or later for 'if (... IN_LIST ...)'" + ) + set(${PDOLLAR}{CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() +endif() +cmake_minimum_required(VERSION 3.3...${TRIBITS_CMAKE_MINIMUM_REQUIRED}) + ## --------------------------------------------------------------------------- ## Compilers used by ${PROJECT_NAME}/${PACKAGE_NAME} build ## --------------------------------------------------------------------------- diff --git a/cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in b/cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in index 5872986017f6..67eb685ed483 100644 --- a/cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in +++ b/cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in @@ -46,6 +46,15 @@ # ############################################################################## +if(CMAKE_VERSION VERSION_LESS 3.3) + set(${PDOLLAR}{CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE + "${PROJECT_NAME} requires CMake 3.3 or later for 'if (... IN_LIST ...)'" + ) + set(${PDOLLAR}{CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() +endif() +cmake_minimum_required(VERSION 3.3...${TRIBITS_CMAKE_MINIMUM_REQUIRED}) + ## --------------------------------------------------------------------------- ## Compilers used by ${PROJECT_NAME} build ## --------------------------------------------------------------------------- diff --git a/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake b/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake index 3f4d02a35ac4..2f4928c8f0b8 100644 --- a/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake @@ -1097,7 +1097,7 @@ function(tribits_add_advanced_test TEST_NAME_IN) "" # multi_value_keywords "COPY_FILES_TO_TEST_DIR;SOURCE_DIR;DEST_DIR" - # Arguments to parse + # Arguments to parse ${PARSE_TEST_${TEST_CMND_IDX}} ) tribits_check_for_unparsed_arguments() @@ -1113,20 +1113,20 @@ function(tribits_add_advanced_test TEST_NAME_IN) # Parse TEST_ block args for types EXEC and CMND set(testBlockOptionsList NOEXEPREFIX NOEXESUFFIX NO_ECHO_OUTPUT PASS_ANY - STANDARD_PASS_OUTPUT ALWAYS_FAIL_ON_NONZERO_RETURN ALWAYS_FAIL_ON_ZERO_RETURN - WILL_FAIL ADD_DIR_TO_NAME SKIP_CLEAN_WORKING_DIRECTORY + STANDARD_PASS_OUTPUT ALWAYS_FAIL_ON_NONZERO_RETURN ALWAYS_FAIL_ON_ZERO_RETURN + WILL_FAIL ADD_DIR_TO_NAME SKIP_CLEAN_WORKING_DIRECTORY ) set(testBlockMultiValueKeywordsList EXEC CMND ARGS DIRECTORY MESSAGE - WORKING_DIRECTORY OUTPUT_FILE NUM_MPI_PROCS NUM_TOTAL_CORES_USED - PASS_REGULAR_EXPRESSION_ALL FAIL_REGULAR_EXPRESSION PASS_REGULAR_EXPRESSION - ) + WORKING_DIRECTORY OUTPUT_FILE NUM_MPI_PROCS NUM_TOTAL_CORES_USED + PASS_REGULAR_EXPRESSION_ALL FAIL_REGULAR_EXPRESSION PASS_REGULAR_EXPRESSION + ) cmake_parse_arguments( PARSE #prefix - "${testBlockOptionsList}" - "" # one_value_keywords - "${testBlockMultiValueKeywordsList}" + "${testBlockOptionsList}" + "" # one_value_keywords + "${testBlockMultiValueKeywordsList}" ${PARSE_TEST_${TEST_CMND_IDX}} ) diff --git a/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake b/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake index 26bddd91931e..bb32b1c3ae8e 100644 --- a/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake @@ -701,7 +701,7 @@ function(tribits_add_library_assert_deplibs) else() message(WARNING "WARNING: The case PARSE_TESTONLY=${PARSE_TESTONLY}," " depLibAlreadyInPkgLibs=${depLibAlreadyInPkgLibs}," - " depLibIsTestOnlyLib=${depLibIsTestOnlyLib}, has" + " depLibIsTestOnlyLib=${depLibIsTestOnlyLib}, has" " not yet been handled!") endif() @@ -781,7 +781,7 @@ function(tribits_add_library_determine_install_lib_and_or_headers if (${PROJECT_NAME}_VERBOSE_CONFIGURE) message("-- " "Skipping installation of headers and libraries" " because ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS=FALSE and" - " BUILD_SHARED_LIBS=FALSE ...") + " BUILD_SHARED_LIBS=FALSE ...") endif() set(installLib OFF) set(installHeaders OFF) @@ -789,7 +789,7 @@ function(tribits_add_library_determine_install_lib_and_or_headers if (${PROJECT_NAME}_VERBOSE_CONFIGURE) message("-- " "Skipping installation of headers but installing libraries" " because ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS=FALSE and" - " BUILD_SHARED_LIBS=TRUE ...") + " BUILD_SHARED_LIBS=TRUE ...") endif() set(installHeaders OFF) endif() diff --git a/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake b/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake index 8c98b1717d74..ea812e51cded 100644 --- a/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake @@ -37,12 +37,13 @@ # ************************************************************************ # @HEADER +include(TribitsPkgExportCacheVars) include(GlobalSet) # @MACRO: tribits_add_option_and_define() # -# Add an option and a define variable in one shot. +# Add an option and an optional macro define variable in one shot. # # Usage:: # @@ -58,6 +59,18 @@ include(GlobalSet) # # #cmakedefine # +# NOTE: This also calls `tribits_pkg_export_cache_var()`_ to export the +# variables ```` and ````. This also +# requires that local variables with the same names of these cache variables +# not be assigned with a different value from these cache variables. If they +# are, then an error will occur later when these variables are read. +# +# NOTE: The define var name ```` can be empty "" in which +# case all logic related to ```` is skipped. (But in this +# case, it would be better to just call:: +# +# set( CACHE BOOL "") +# macro(tribits_add_option_and_define USER_OPTION_NAME MACRO_DEFINE_NAME DOCSTRING DEFAULT_VALUE ) @@ -70,6 +83,10 @@ macro(tribits_add_option_and_define USER_OPTION_NAME MACRO_DEFINE_NAME global_set(${MACRO_DEFINE_NAME} OFF) endif() endif() + tribits_pkg_export_cache_var(${USER_OPTION_NAME}) + if(NOT ${MACRO_DEFINE_NAME} STREQUAL "") + tribits_pkg_export_cache_var(${MACRO_DEFINE_NAME}) + endif() endmacro() # 2008/10/05: rabartl: ToDo: Add an option to automatically add the macro diff --git a/cmake/tribits/core/package_arch/TribitsAddTest.cmake b/cmake/tribits/core/package_arch/TribitsAddTest.cmake index bdf500b5bf1b..5853d99a08f6 100644 --- a/cmake/tribits/core/package_arch/TribitsAddTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddTest.cmake @@ -1009,7 +1009,7 @@ function(tribits_add_test EXE_NAME) "${EXECUTABLE_PATH}" "${PARSE_CATEGORIES}" "${NUM_PROCS_USED}" "${NUM_TOTAL_CORES_USED}" "${SET_RUN_SERIAL}" "${SET_DISABLED_AND_MSG}" ADDED_TEST_NAME ${INARGS} - "${${TEST_NAME_INSTANCE}_EXTRA_ARGS}" ) + "${${TEST_NAME_INSTANCE}_EXTRA_ARGS}" ) if(PARSE_ADDED_TESTS_NAMES_OUT AND ADDED_TEST_NAME) list(APPEND ADDED_TESTS_NAMES_OUT ${ADDED_TEST_NAME}) endif() @@ -1054,7 +1054,7 @@ function(tribits_add_test EXE_NAME) "${EXECUTABLE_PATH}" "${PARSE_CATEGORIES}" "${NUM_PROCS_USED}" "${NUM_TOTAL_CORES_USED}" "${SET_RUN_SERIAL}" "${SET_DISABLED_AND_MSG}" ADDED_TEST_NAME ${INARGS} - "${${TEST_NAME_INSTANCE}_EXTRA_ARGS}" + "${${TEST_NAME_INSTANCE}_EXTRA_ARGS}" ) if(PARSE_ADDED_TESTS_NAMES_OUT AND ADDED_TEST_NAME) list(APPEND ADDED_TESTS_NAMES_OUT ${ADDED_TEST_NAME}) diff --git a/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake b/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake index ca8d1b0bd9c8..453de5432672 100644 --- a/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake @@ -658,10 +658,10 @@ function(tribits_add_test_process_skip_ctest_add_test ADD_THE_TEST_OUT) if(${PACKAGE_NAME}_SKIP_CTEST_ADD_TEST OR ${PARENT_PACKAGE_NAME}_SKIP_CTEST_ADD_TEST) if (PARENT_PACKAGE_NAME STREQUAL PACKAGE_NAME) set(DISABLE_VAR_MSG - "${PACKAGE_NAME}_SKIP_CTEST_ADD_TEST='${${PACKAGE_NAME}_SKIP_CTEST_ADD_TEST}'") + "${PACKAGE_NAME}_SKIP_CTEST_ADD_TEST='${${PACKAGE_NAME}_SKIP_CTEST_ADD_TEST}'") else() set(DISABLE_VAR_MSG - "${PARENT_PACKAGE_NAME}_SKIP_CTEST_ADD_TEST='${${PARENT_PACKAGE_NAME}_SKIP_CTEST_ADD_TEST}'") + "${PARENT_PACKAGE_NAME}_SKIP_CTEST_ADD_TEST='${${PARENT_PACKAGE_NAME}_SKIP_CTEST_ADD_TEST}'") endif() message_wrapper( "-- ${TEST_NAME}: NOT added test because ${DISABLE_VAR_MSG}!") diff --git a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake index 84a5994320fa..5b26b5549781 100644 --- a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake +++ b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake @@ -999,10 +999,59 @@ macro(tribits_apply_test_example_enables PACKAGE_NAME) endmacro() -# Macro to set ${TRIBITS_SUBPACKAGE)_ENABLE_TESTS and +# Macro to disable ${PARENT_PACKAGE_NAME)_ENABLE_ENABLES by default if +# ${PARENT_PACKAGE_NAME)_ENABLE_TESTS is explicitly disabled. +# +macro(tribits_apply_package_examples_disable PARENT_PACKAGE_NAME) + if (NOT "${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}" STREQUAL "" + AND NOT ${PARENT_PACKAGE_NAME}_ENABLE_TESTS + AND "${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}" STREQUAL "" + ) + message("-- " "Setting" + " ${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES" + "=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}" + " because" + " ${PARENT_PACKAGE_NAME}_ENABLE_TESTS" + "=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}" ) + set(${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES ${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}) + endif() +endmacro() +# NOTE: Above, the top-level package ${PARENT_PACKAGE_NAME} may not even be +# enabled yet when this gets called but its subpackages might and we need to +# process this default disable in case their are any enabled subpackages. + + +# Macro to disable ${TRIBITS_SUBPACKAGE)_ENABLE_TESTS and # ${TRIBITS_SUBPACKAGE)_ENABLE_EXAMPLES based on # ${TRIBITS_PARENTPACKAGE)_ENABLE_TESTS or # ${TRIBITS_PARENTPACKAGE)_ENABLE_EXAMPLES +# +macro(tribits_apply_subpackage_tests_or_examples_disables PARENT_PACKAGE_NAME + TESTS_OR_EXAMPLES + ) + set(parentPkgEnableVar ${PARENT_PACKAGE_NAME}_ENABLE_${TESTS_OR_EXAMPLES}) + if (NOT "${${parentPkgEnableVar}}" STREQUAL "" AND NOT ${parentPkgEnableVar}) + foreach(spkg IN LISTS ${PARENT_PACKAGE_NAME}_SUBPACKAGES) + set(fullSpkgName ${PARENT_PACKAGE_NAME}${spkg}) + if (${PROJECT_NAME}_ENABLE_${fullSpkgName} AND NOT ${parentPkgEnableVar}) + if ("${${fullSpkgName}_ENABLE_${TESTS_OR_EXAMPLES}}" STREQUAL "") + message("-- " "Setting" + " ${fullSpkgName}_ENABLE_${TESTS_OR_EXAMPLES}=${${parentPkgEnableVar}}" + " because parent package" + " ${parentPkgEnableVar}=${${parentPkgEnableVar}}") + set(${fullSpkgName}_ENABLE_${TESTS_OR_EXAMPLES} ${${parentPkgEnableVar}}) + endif() + endif() + endforeach() + endif() +endmacro() + + +# Macro to enable ${TRIBITS_SUBPACKAGE)_ENABLE_TESTS and +# ${TRIBITS_SUBPACKAGE)_ENABLE_EXAMPLES based on +# ${TRIBITS_PARENTPACKAGE)_ENABLE_TESTS or +# ${TRIBITS_PARENTPACKAGE)_ENABLE_EXAMPLES +# macro(tribits_apply_subpackage_tests_examples_enables PARENT_PACKAGE_NAME) if ("${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}" STREQUAL "" AND ${PARENT_PACKAGE_NAME}_ENABLE_TESTS @@ -1019,20 +1068,20 @@ macro(tribits_apply_subpackage_tests_examples_enables PARENT_PACKAGE_NAME) if (${PARENT_PACKAGE_NAME}_ENABLE_TESTS) if ("${${fullSpkgName}_ENABLE_TESTS}" STREQUAL "") message("-- " "Setting" - " ${fullSpkgName}_ENABLE_TESTS=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}" - " because parent package" - " ${PARENT_PACKAGE_NAME}_ENABLE_TESTS" - "=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}") + " ${fullSpkgName}_ENABLE_TESTS=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}" + " because parent package" + " ${PARENT_PACKAGE_NAME}_ENABLE_TESTS" + "=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}") set(${fullSpkgName}_ENABLE_TESTS ${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}) endif() endif() if (${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES) if ("${${fullSpkgName}_ENABLE_EXAMPLES}" STREQUAL "") message("-- " "Setting" - " ${fullSpkgName}_ENABLE_EXAMPLES=${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}" - " because parent package" - " ${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES" - "=${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}") + " ${fullSpkgName}_ENABLE_EXAMPLES=${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}" + " because parent package" + " ${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES" + "=${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}") set(${fullSpkgName}_ENABLE_EXAMPLES ${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}) endif() endif() @@ -1399,9 +1448,18 @@ macro(tribits_adjust_package_enables) ${PROJECT_NAME}_ENABLED_SE_PACKAGES "") # - # C) Enable tests for currently enabled SE packages + # C) Disable and enable tests for currently enabled SE packages # + message("") + message("Disabling subpackage tests/examples based on parent package tests/examples disables ...") + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) + tribits_apply_package_examples_disable(${TRIBITS_PACKAGE} TESTS) + tribits_apply_subpackage_tests_or_examples_disables(${TRIBITS_PACKAGE} TESTS) + tribits_apply_subpackage_tests_or_examples_disables(${TRIBITS_PACKAGE} EXAMPLES) + endforeach() + if (${PROJECT_NAME}_ENABLE_TESTS OR ${PROJECT_NAME}_ENABLE_EXAMPLES) message("") message("Enabling all tests and/or examples that have not been" diff --git a/cmake/tribits/core/package_arch/TribitsExternalPackageWriteConfigFile.cmake b/cmake/tribits/core/package_arch/TribitsExternalPackageWriteConfigFile.cmake index 3c1c6763d4f5..2d041a2ca424 100644 --- a/cmake/tribits/core/package_arch/TribitsExternalPackageWriteConfigFile.cmake +++ b/cmake/tribits/core/package_arch/TribitsExternalPackageWriteConfigFile.cmake @@ -328,7 +328,7 @@ function(tribits_extpkg_add_find_upstream_dependencies_str ) foreach (upstreamTplDepEntry IN LISTS ${tplName}_LIB_ENABLED_DEPENDENCIES) tribits_extpkg_get_dep_name_and_vis( - "${upstreamTplDepEntry}" upstreamTplDepName upstreamTplDepVis) + "${upstreamTplDepEntry}" upstreamTplDepName upstreamTplDepVis) if ("${${upstreamTplDepName}_DIR}" STREQUAL "") message(FATAL_ERROR "ERROR: ${upstreamTplDepName}_DIR is empty!") endif() @@ -336,9 +336,9 @@ function(tribits_extpkg_add_find_upstream_dependencies_str "if (NOT TARGET ${upstreamTplDepName}::all_libs)\n" " set(${upstreamTplDepName}_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../${upstreamTplDepName}\")\n" " find_dependency(${upstreamTplDepName} REQUIRED CONFIG \${${tplName}_SearchNoOtherPathsArgs})\n" - " unset(${upstreamTplDepName}_DIR)\n" + " unset(${upstreamTplDepName}_DIR)\n" "endif()\n" - "\n" + "\n" ) endforeach() string(APPEND configFileFragStr @@ -705,7 +705,7 @@ function(tribits_extpkg_append_upstream_target_link_libraries_str "target_link_libraries(${prefix_libname}\n") foreach (upstreamTplDepEntry IN LISTS ${tplName}_LIB_ENABLED_DEPENDENCIES) tribits_extpkg_get_dep_name_and_vis( - "${upstreamTplDepEntry}" upstreamTplDepName upstreamTplDepVis) + "${upstreamTplDepEntry}" upstreamTplDepName upstreamTplDepVis) if (upstreamTplDepVis STREQUAL "PUBLIC") string(APPEND configFileStr " INTERFACE ${upstreamTplDepName}::all_libs # i.e. PUBLIC\n") diff --git a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake index ca763c91480b..c269cf63b9ae 100644 --- a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -204,12 +204,12 @@ function(assert_project_set_group_and_permissions_on_install_base_dir) "***\n" "*** ERROR in ${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR!\n" "***\n" - "\n" - "${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR=${${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR}\n" + "\n" + "${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR=${${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR}\n" "\n" "is not a strict base dir of:\n" - "\n" - "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}\n" + "\n" + "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}\n" "\n" "Either remove ${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR from the cache or set it to be a base dir of CMAKE_INSTALL_PREFIX!\n" "\n" @@ -2079,7 +2079,7 @@ macro(tribits_configure_enabled_packages) endif() else() set(${TRIBITS_PACKAGE}_BINARY_DIR - ${CMAKE_CURRENT_BINARY_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) + ${CMAKE_CURRENT_BINARY_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) endif() if (${PROJECT_NAME}_VERBOSE_CONFIGURE) print_var(${TRIBITS_PACKAGE}_BINARY_DIR) @@ -2139,7 +2139,7 @@ macro(tribits_configure_enabled_packages) "${TRIBITS_PACKAGE_CMAKELIST_FILE}") if (NOT ${TRIBITS_PACKAGE}_SOURCE_DIR STREQUAL ${PROJECT_NAME}_SOURCE_DIR) add_subdirectory(${${TRIBITS_PACKAGE}_SOURCE_DIR} ${${TRIBITS_PACKAGE}_BINARY_DIR}) - else() + else() include("${TRIBITS_PACKAGE_CMAKELIST_FILE}") endif() if (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS) @@ -2307,15 +2307,15 @@ macro(tribits_setup_packaging_and_distribution) # package has to have this file to work correctly it should be # guaranteed to be there. string(REGEX MATCH "[.][.]/" RELATIVE_PATH_CHARS_MATCH - ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) + ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) if ("${RELATIVE_PATH_CHARS_MATCH}" STREQUAL "") set(CPACK_SOURCE_IGNORE_FILES - "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}/" + "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}/" ${CPACK_SOURCE_IGNORE_FILES}) else() find_path(ABSOLUTE_PATH CMakeLists.txt PATHS "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}" - NO_DEFAULT_PATH) + NO_DEFAULT_PATH) if ("${ABSOLUTE_PATH}" STREQUAL "ABSOLUTE_PATH-NOTFOUND") message(AUTHOR_WARNING "Relative path found for disabled package" " ${TRIBITS_PACKAGE} but package was missing a CMakeLists.txt file." diff --git a/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake b/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake index 99191e850611..62d3791e1b67 100644 --- a/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake @@ -52,6 +52,7 @@ include(RemoveGlobalDuplicates) include(TribitsGatherBuildTargets) include(TribitsAddOptionAndDefine) +include(TribitsPkgExportCacheVars) include(TribitsLibraryMacros) include(TribitsAddExecutable) include(TribitsAddExecutableAndTest) @@ -180,25 +181,7 @@ macro(tribits_package_decl PACKAGE_NAME_IN) message("\nTRIBITS_PACKAGE_DECL: ${PACKAGE_NAME_IN}") endif() - if (CURRENTLY_PROCESSING_SUBPACKAGE) - tribits_report_invalid_tribits_usage( - "Cannot call tribits_package_decl() in a subpackage." - " Use tribits_subpackage() instead" - " error in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - endif() - - if(${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) - tribits_report_invalid_tribits_usage( - "tribits_package_decl() called more than once in Package ${PACKAGE_NAME}" - " This may be because tribits_package_decl() was explicitly called more than once or" - " TRIBITS_PACKAGE_DECL was called after TRIBITS_PACKAGE. You do not need both." - " If your package has subpackages then do not call tribits_package() instead call:" - " tribits_pacakge_decl() then tribits_process_subpackages() then tribits package_def()" - ) - endif() - - # Set flag to check that macros are called in the correct order - set(${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED TRUE) + tribits_package_decl_assert_call_context() # # A) Parse the input arguments @@ -236,6 +219,7 @@ macro(tribits_package_decl PACKAGE_NAME_IN) # tribits_set_common_vars(${PACKAGE_NAME_IN}) + tribits_pkg_init_exported_vars(${PACKAGE_NAME_IN}) set(${PACKAGE_NAME_IN}_DISABLE_STRONG_WARNINGS OFF CACHE BOOL @@ -268,6 +252,31 @@ macro(tribits_package_decl PACKAGE_NAME_IN) endmacro() +macro(tribits_package_decl_assert_call_context) + + if (CURRENTLY_PROCESSING_SUBPACKAGE) + tribits_report_invalid_tribits_usage( + "Cannot call tribits_package_decl() in a subpackage." + " Use tribits_subpackage() instead" + " error in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") + endif() + + if(${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) + tribits_report_invalid_tribits_usage( + "tribits_package_decl() called more than once in Package ${PACKAGE_NAME}" + " This may be because tribits_package_decl() was explicitly called more than once or" + " TRIBITS_PACKAGE_DECL was called after TRIBITS_PACKAGE. You do not need both." + " If your package has subpackages then do not call tribits_package() instead call:" + " tribits_pacakge_decl() then tribits_process_subpackages() then tribits package_def()" + ) + endif() + + # Set flag to check that macros are called in the correct order + set(${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED TRUE) + +endmacro() + + # @MACRO: tribits_package_def() # # Macro called in `/CMakeLists.txt`_ after subpackages are @@ -291,6 +300,30 @@ endmacro() # macro(tribits_package_def) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nTRIBITS_PACKAGE_DEF: ${PACKAGE_NAME}") + endif() + + tribits_package_def_assert_call_context() + + if (NOT ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\n${PACKAGE_NAME} not enabled so exiting package processing") + endif() + return() + endif() + + # Reset in case were changed by subpackages + tribits_set_common_vars(${PACKAGE_NAME}) + + # Define package linkage variables + tribits_define_linkage_vars(${PACKAGE_NAME}) + +endmacro() + + +macro(tribits_package_def_assert_call_context) + # check that this is not being called from a subpackage if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) if (CURRENTLY_PROCESSING_SUBPACKAGE) @@ -311,23 +344,6 @@ macro(tribits_package_def) "${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") endif() - if (${PROJECT_NAME}_VERBOSE_CONFIGURE) - message("\nTRIBITS_PACKAGE_DEF: ${PACKAGE_NAME}") - endif() - - if (NOT ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - if (${PROJECT_NAME}_VERBOSE_CONFIGURE) - message("\n${PACKAGE_NAME} not enabled so exiting package processing") - endif() - return() - endif() - - # Reset in case were changed by subpackages - tribits_set_common_vars(${PACKAGE_NAME}) - - # Define package linkage variables - tribits_define_linkage_vars(${PACKAGE_NAME}) - set(${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED TRUE) endmacro() @@ -353,6 +369,13 @@ endmacro() # side-effects (and variables set) after calling this macro. # macro(tribits_package PACKAGE_NAME_IN) + tribits_package_assert_call_context() + tribits_package_decl(${PACKAGE_NAME_IN} ${ARGN}) + tribits_package_def() +endmacro() + + +macro(tribits_package_assert_call_context) if (CURRENTLY_PROCESSING_SUBPACKAGE) if (NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) @@ -381,8 +404,6 @@ macro(tribits_package PACKAGE_NAME_IN) set(${PACKAGE_NAME}_TRIBITS_PACKAGE_CALLED TRUE) - tribits_package_decl(${PACKAGE_NAME_IN} ${ARGN}) - tribits_package_def() endmacro() @@ -440,6 +461,9 @@ endmacro() # typically called in the package's `/CMakeLists.txt`_ file (see # the example ``SimpleCxx/CMakeLists.txt``). # +# NOTE: This also calls `tribits_pkg_export_cache_var()`_ to export the +# variable ``${PACKAGE_NAME}_ENABLE_DEBUG``. +# macro(tribits_add_debug_option) tribits_add_option_and_define( ${PACKAGE_NAME}_ENABLE_DEBUG @@ -737,7 +761,7 @@ macro(tribits_package_postprocess) NOT ${PACKAGE_NAME}_TRIBITS_PROCESS_SUBPACKAGES_CALLED ) tribits_report_invalid_tribits_usage( - "Must call tribits_package_decl(), tribits_process_subpackages()" + "Must call tribits_package_decl(), tribits_process_subpackages()" " and tribits_package_def() before tribits_package_postprocess()." " Because this package has subpackages you cannot use tribits_package()" " you must call these in the following order:" @@ -755,16 +779,16 @@ macro(tribits_package_postprocess) # This is a package without subpackages if ( - (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_CALLED) - AND - (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED) + (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_CALLED) + AND + (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED) ) tribits_report_invalid_tribits_usage( "Must call tribits_package() or tribits_package_def() before" - " tribits_package_postprocess()" - " at the top of the file:\n" - " ${TRIBITS_PACKAGE_CMAKELIST_FILE}" - ) + " tribits_package_postprocess()" + " at the top of the file:\n" + " ${TRIBITS_PACKAGE_CMAKELIST_FILE}" + ) endif() endif() diff --git a/cmake/tribits/core/package_arch/TribitsPkgExportCacheVars.cmake b/cmake/tribits/core/package_arch/TribitsPkgExportCacheVars.cmake new file mode 100644 index 000000000000..6fb85e0ef8de --- /dev/null +++ b/cmake/tribits/core/package_arch/TribitsPkgExportCacheVars.cmake @@ -0,0 +1,130 @@ +# @HEADER +# ************************************************************************ +# +# TriBITS: Tribal Build, Integrate, and Test System +# Copyright 2013 Sandia Corporation +# +# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +# the U.S. Government retains certain rights in this software. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the Corporation nor the names of the +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# ************************************************************************ +# @HEADER + + +# @MACRO: tribits_pkg_export_cache_var() +# +# Macro that registers a package-level cache var to be exported in the +# ``Config.cmake`` file +# +# Usage:: +# +# tribits_pkg_export_cache_var() +# +# where ```` must be the name of a cache variable (or an error +# will occur). +# +# NOTE: This will also export this variable to the +# ``Config.cmake`` file for every enabled subpackage (if this +# is called from a ``CMakeLists.txt`` file of a top-level package that has +# subpackages). That way, any top-level package cache vars are provided by +# any of the subpackages' ``Config.cmake`` files. +# +macro(tribits_pkg_export_cache_var cacheVarName) + if (DEFINED ${PACKAGE_NAME}_PKG_VARS_TO_EXPORT) + # Assert this is a cache var + get_property(cacheVarIsCacheVar CACHE ${cacheVarName} PROPERTY VALUE SET) + if (NOT cacheVarIsCacheVar) + message(SEND_ERROR + "ERROR: The variable ${cacheVarName} is NOT a cache var and cannot" + " be exported!") + endif() + # Add to the list of package cache vars to export + append_global_set(${PACKAGE_NAME}_PKG_VARS_TO_EXPORT + ${cacheVarName}) + endif() +endmacro() + + +# @MACRO: tribits_assert_cache_and_local_vars_same_value() +# +# Asset that a cache variable and a possible local variable (if it exists) +# have the same value. +# +# Usage:: +# +# tribits_assert_cache_and_local_vars_same_value() +# +# If the local var ```` and the cache var ```` +# both exist but have different values, then ``message(SEND_ERROR ...)`` is +# called with an informative error message. +# +macro(tribits_assert_cache_and_local_vars_same_value cacheVarName) + set(cacheVarValue "$CACHE{${cacheVarName}}") + set(localValue "${${cacheVarName}}") + if (NOT localValue STREQUAL cacheVarValue) + message_wrapper(SEND_ERROR "ERROR: The cache variable ${cacheVarName} with the" + " cache var value '${cacheVarValue}' is not the same value as the local" + " variable ${cacheVarName} with value '${localValue}'!") + endif() +endmacro() + + +# Function that sets up data-structures for package-level cache var to be +# exported +# +function(tribits_pkg_init_exported_vars PACKAGE_NAME_IN) + global_set(${PACKAGE_NAME_IN}_PKG_VARS_TO_EXPORT "") +endfunction() + + +# Function that injects set() statements for a package's exported cache vars into +# a string. +# +# This is used to create set() statements to be injected into a package's +# ``Config.cmake`` file. +# +function(tribits_pkg_append_set_commands_for_exported_vars packageName + configFileStrInOut + ) + set(configFileStr "${${configFileStrInOut}}") + if (NOT "${${packageName}_PARENT_PACKAGE}" STREQUAL "") + foreach(exportedCacheVar IN LISTS ${${packageName}_PARENT_PACKAGE}_PKG_VARS_TO_EXPORT) + tribits_assert_cache_and_local_vars_same_value(${exportedCacheVar}) + string(APPEND configFileStr + "set(${exportedCacheVar} \"${${exportedCacheVar}}\")\n") + endforeach() + endif() + foreach(exportedCacheVar IN LISTS ${packageName}_PKG_VARS_TO_EXPORT) + tribits_assert_cache_and_local_vars_same_value(${exportedCacheVar}) + string(APPEND configFileStr + "set(${exportedCacheVar} \"${${exportedCacheVar}}\")\n") + endforeach() + set(${configFileStrInOut} "${configFileStr}" PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsSubPackageMacros.cmake b/cmake/tribits/core/package_arch/TribitsSubPackageMacros.cmake index 60a7c668e9a5..27383b1907b6 100644 --- a/cmake/tribits/core/package_arch/TribitsSubPackageMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsSubPackageMacros.cmake @@ -88,6 +88,7 @@ macro(tribits_subpackage SUBPACKAGE_NAME_IN) # Now override the package-like variables tribits_set_common_vars(${SUBPACKAGE_FULLNAME}) tribits_define_linkage_vars(${SUBPACKAGE_FULLNAME}) + tribits_pkg_init_exported_vars(${SUBPACKAGE_FULLNAME}) tribits_append_package_specific_compiler_flags() if(${PROJECT_NAME}_VERBOSE_CONFIGURE) @@ -123,23 +124,22 @@ function(tribits_subpackage_assert_call_context) if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) tribits_report_invalid_tribits_usage( "Already called tribits_subpackge() for the" - " ${PARENT_PACKAGE_NAME} subpackage ${TRIBITS_SUBPACKAGE}") + " ${PARENT_PACKAGE_NAME} subpackage ${TRIBITS_SUBPACKAGE}") endif() # make sure the name in the macro call matches the name in the packages cmake file if (NOT ${SUBPACKAGE_NAME_IN} STREQUAL ${SUBPACKAGE_NAME}) tribits_report_invalid_tribits_usage( "Error, the package-defined subpackage name" - " '${SUBPACKAGE_NAME_IN}' is not the same as the subpackage name" - " '${SUBPACKAGE_NAME}' defined in the parent packages's" - " Dependencies.cmake file") + " '${SUBPACKAGE_NAME_IN}' is not the same as the subpackage name" + " '${SUBPACKAGE_NAME}' defined in the parent packages's" + " Dependencies.cmake file") endif() endif() endfunction() - # @MACRO: tribits_subpackage_postprocess() # # Macro that performs standard post-processing after defining a `TriBITS @@ -158,20 +158,22 @@ endfunction() # this macro but limitations of the CMake language make it necessary to do so. # macro(tribits_subpackage_postprocess) + tribits_subpackage_postprocess_assert_call_context() + tribits_package_postprocess_common() +endmacro() - # check that this is not being called from a package - if (NOT CURRENTLY_PROCESSING_SUBPACKAGE) - # This is being called from a package +macro(tribits_subpackage_postprocess_assert_call_context) + # check that this is not being called from a package + if (NOT CURRENTLY_PROCESSING_SUBPACKAGE) + # This is being called from a package tribits_report_invalid_tribits_usage( "Cannot call tribits_subpackage_postprocess() from a package." " Use tribits_package_postprocess() instead" " ${CURRENT_PACKAGE_CMAKELIST_FILE}") - else() - # This is being caleld from a subpackage - + # This is being called from a subpackage # check to make sure this has not already been called if (${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) tribits_report_invalid_tribits_usage( @@ -185,12 +187,9 @@ macro(tribits_subpackage_postprocess) "tribits_subpackage() must be called before tribits_subpackage_postprocess()" " for the ${PARENT_PACKAGE_NAME} subpackage ${TRIBITS_SUBPACKAGE}") endif() - endif() # Set flags that are used to check that macros are called in the correct order dual_scope_set(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED TRUE) - tribits_package_postprocess_common() - endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake b/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake index 987aaf8dd3b9..8a5eeb35f686 100644 --- a/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake +++ b/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake @@ -505,7 +505,7 @@ function(tribits_tpl_find_include_dirs_and_libraries TPL_NAME) "-- ${LIB_NOT_FOUND_MSG_PREFIX} Did not find a lib in the lib set \"${LIBNAME_SET}\"" " for the TPL '${TPL_NAME}'!") if (MUST_FIND_ALL_LIBS) - set(_${TPL_NAME}_ENABLE_SUCCESS FALSE) + set(_${TPL_NAME}_ENABLE_SUCCESS FALSE) else() break() endif() diff --git a/cmake/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake b/cmake/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake index 9b1f967af96b..cf3e9ef2f37b 100644 --- a/cmake/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake +++ b/cmake/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake @@ -38,6 +38,7 @@ # @HEADER include(TribitsGeneralMacros) +include(TribitsPkgExportCacheVars) ### ### WARNING: See "NOTES TO DEVELOPERS" at the bottom of the file @@ -545,8 +546,7 @@ function(tribits_append_dependent_package_config_file_includes_and_enables packa # Parse input cmake_parse_arguments( - PARSE #prefix - "" #options + PARSE "" # prefix, options #one_value_keywords "EXPORT_FILE_VAR_PREFIX;EXT_PKG_CONFIG_FILE_BASE_DIR;PKG_CONFIG_FILE_BASE_DIR;CONFIG_FILE_STR_INOUT" "" #multi_value_keywords @@ -577,6 +577,11 @@ function(tribits_append_dependent_package_config_file_includes_and_enables packa "set(${EXPORT_FILE_VAR_PREFIX}_ENABLE_${depPkg} ${enableVal})\n") endforeach() + # Put in set() statements for exported cache vars + string(APPEND configFileStr + "\n# Exported cache variables\n") + tribits_pkg_append_set_commands_for_exported_vars(${packageName} configFileStr) + # Include configurations of dependent packages string(APPEND configFileStr "\n# Include configuration of dependent packages\n") @@ -876,7 +881,7 @@ include(\"${${TRIBITS_PACKAGE}_BINARY_DIR}/${TRIBITS_PACKAGE}Config.cmake\")") set(TRIBITS_PROJECT_INSTALL_INCLUDE_DIR "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") else() set(TRIBITS_PROJECT_INSTALL_INCLUDE_DIR - "${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") + "${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") endif() configure_file( diff --git a/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake b/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake index a9a8b6992f21..723725deb3d7 100644 --- a/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake +++ b/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake @@ -196,7 +196,7 @@ macro(tribits_add_dashboard_target) # NOTE: Above, if ${PROJECT_NAME}_ENABLE_ALL_PACKAGES was set in CMakeCache.txt, then setting # -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF will turn it off in the cache. Note that it will # never be turned on again which means that the list of packages will be set explicitly below. - ) + ) set(DASHBOARD_TARGET_CTEST_DRIVER_CMND_NUM "B) ") @@ -226,7 +226,7 @@ macro(tribits_add_dashboard_target) COMMAND echo COMMAND echo "See the results at http://${CTEST_DROP_SITE}${CTEST_DROP_LOCATION}&display=project\#Experimental" COMMAND echo - ) + ) endif() diff --git a/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake b/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake index da12e79f96fe..33f2c886b88a 100644 --- a/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake +++ b/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake @@ -2128,18 +2128,18 @@ function(tribits_ctest_driver) if (EXISTS "${CTEST_TESTING_TAG_FILE}") file(READ "${CTEST_TESTING_TAG_FILE}" TAG_FILE_CONTENTS_STR) message( - "\nPrevious file:" - "\n" - "\n '${CTEST_TESTING_TAG_FILE}'" - "\n" - "\nexists with contents:\n" - "\n" - "${TAG_FILE_CONTENTS_STR}\n") + "\nPrevious file:" + "\n" + "\n '${CTEST_TESTING_TAG_FILE}'" + "\n" + "\nexists with contents:\n" + "\n" + "${TAG_FILE_CONTENTS_STR}\n") else() message(FATAL_ERROR - "ERROR: Previous file '${CTEST_TESTING_TAG_FILE}' does NOT exist!" - " A previous ctest_start() was not called. Please call again" - " this time setting CTEST_DO_NEW_START=TRUE") + "ERROR: Previous file '${CTEST_TESTING_TAG_FILE}' does NOT exist!" + " A previous ctest_start() was not called. Please call again" + " this time setting CTEST_DO_NEW_START=TRUE") endif() list(APPEND CTEST_START_ARGS APPEND) diff --git a/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake b/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake index f54285bb8c1f..1d62d292e8ea 100644 --- a/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake +++ b/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake @@ -50,7 +50,7 @@ macro(extrarepo_execute_process_wrapper) if (NOT EXTRAREPO_EXECUTE_PROCESS_WRAPPER_RTN_VAL STREQUAL "0") message(SEND_ERROR "Error: execute_process(${ARGN}) returned" - " '${EXTRAREPO_EXECUTE_PROCESS_WRAPPER_RTN_VAL}'") + " '${EXTRAREPO_EXECUTE_PROCESS_WRAPPER_RTN_VAL}'") endif() else() message("execute_process(${ARGN})") @@ -136,12 +136,12 @@ function(tribits_clone_or_update_extrarepo EXTRAREPO_NAME_IN EXTRAREPO_DIR_IN set(CLONE_CMND_ARGS COMMAND "${GIT_EXECUTABLE}" clone ${CHECKOUT_BRANCH_ARG} -o ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} - "${EXTRAREPO_REPOURL}" ${EXTRAREPO_DIR_IN} + "${EXTRAREPO_REPOURL}" ${EXTRAREPO_DIR_IN} WORKING_DIRECTORY "${${PROJECT_NAME}_SOURCE_DIRECTORY}" OUTPUT_FILE "${EXTRAREPO_CLONE_OUT_FILE}" ) else() message(SEND_ERROR - "Error, Invalid EXTRAREPO_REPOTYPE_IN='${EXTRAREPO_REPOTYPE_IN}'!") + "Error, Invalid EXTRAREPO_REPOTYPE_IN='${EXTRAREPO_REPOTYPE_IN}'!") endif() # Do the clone @@ -508,7 +508,7 @@ macro(enable_only_modified_packages) if (${PROJECT_NAME}_ENABLE_ALL_PACKAGES) if (NOT ${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE) message(FATAL_ERROR - "Error, failing 'ALL_PACKAGES' only allowed with all-at-once mode!") + "Error, failing 'ALL_PACKAGES' only allowed with all-at-once mode!") endif() message("\nDirectly modified or failing non-disabled packages that need" " to be tested: ALL_PACKAGES") @@ -954,7 +954,7 @@ macro(tribits_ctest_package_by_package) if (CTEST_DEPENDENCY_HANDLING_UNIT_TESTING) message("${TRIBITS_PACKAGE}: Skipping configure due" - " to running in unit testing mode!") + " to running in unit testing mode!") else() @@ -1001,7 +1001,7 @@ macro(tribits_ctest_package_by_package) if (NOT CTEST_DO_CONFIGURE AND CTEST_DO_SUBMIT) message("${TRIBITS_PACKAGE}: Skipping submitting configure" - " and notes due to CTEST_DO_CONFIGURE='${CTEST_DO_CONFIGURE}'!") + " and notes due to CTEST_DO_CONFIGURE='${CTEST_DO_CONFIGURE}'!") elseif (CTEST_DO_SUBMIT) message("\nSubmitting configure and notes ...") tribits_ctest_submit( PARTS configure notes ) @@ -1025,7 +1025,7 @@ macro(tribits_ctest_package_by_package) if ( NOT PBP_CONFIGURE_PASSED AND CTEST_DO_BUILD ) message("\n${TRIBITS_PACKAGE}: Skipping build due" - " to configure failing!") + " to configure failing!") set(PBP_BUILD_PASSED FALSE) set(PBP_BUILD_LIBS_PASSED FALSE) @@ -1033,14 +1033,14 @@ macro(tribits_ctest_package_by_package) elseif (NOT CTEST_DO_BUILD) message("\n${TRIBITS_PACKAGE}: Skipping build due" - " to CTEST_DO_BUILD='${CTEST_DO_BUILD}'!") + " to CTEST_DO_BUILD='${CTEST_DO_BUILD}'!") elseif (CTEST_DEPENDENCY_HANDLING_UNIT_TESTING OR CTEST_CONFIGURATION_UNIT_TESTING ) message("\n${TRIBITS_PACKAGE}: Skipping build due" - " to running in unit testing mode!") + " to running in unit testing mode!") else() @@ -1152,7 +1152,7 @@ macro(tribits_ctest_package_by_package) " exists so there were failed tests!") else() message("\n${TRIBITS_PACKAGE}: File '${FAILED_TEST_LOG_FILE}'" - " does NOT exist so all tests passed!") + " does NOT exist so all tests passed!") set(PBP_TESTS_PASSED TRUE) endif() # 2009/12/05: ToDo: We need to add an argument to ctest_test(...) @@ -1190,7 +1190,7 @@ macro(tribits_ctest_package_by_package) if (NOT PBP_BUILD_LIBS_PASSED AND CTEST_DO_MEMORY_TESTING) message("\n${TRIBITS_PACKAGE}: Skipping running memory checking" - "tests since library build failed!\n") + "tests since library build failed!\n") elseif (NOT CTEST_DO_MEMORY_TESTING) @@ -1209,7 +1209,7 @@ macro(tribits_ctest_package_by_package) BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL "${CTEST_PARALLEL_LEVEL}" INCLUDE_LABEL "^${TRIBITS_PACKAGE}$" - ) + ) # ToDo: Determine if memory testing passed or not and affect overall # pass/fail! diff --git a/cmake/tribits/doc/guides/TribitsGuidesBody.rst b/cmake/tribits/doc/guides/TribitsGuidesBody.rst index 848f5aea1d9d..293fcca3ea1e 100644 --- a/cmake/tribits/doc/guides/TribitsGuidesBody.rst +++ b/cmake/tribits/doc/guides/TribitsGuidesBody.rst @@ -3378,7 +3378,7 @@ management system are: 9) `TPL disable triggers auto-disables of downstream dependencies`_ 10) `Disables trump enables where there is a conflict`_ 11) `Enable/disable of parent package is enable/disable for subpackages`_ -12) `Enable of parent package tests/examples is enable for subpackages tests/examples`_ +12) `Enable/disable of parent package tests/examples is enable/disable for subpackages tests/examples`_ 13) `Subpackage enable does not auto-enable the parent package`_ 14) `Support for optional SE package/TPL is enabled by default`_ 15) `Support for optional SE package/TPL can be explicitly disabled`_ @@ -3588,17 +3588,19 @@ In more detail, these rules/behaviors are: see `Explicit enable of a package, its tests, an optional TPL, with ST enabled`_. -.. _Enable of parent package tests/examples is enable for subpackages tests/examples: - -12) **Enable of parent package tests/examples is enable for subpackages - tests/examples**: Setting ``_ENABLE_TESTS=ON`` is - equivalent to setting the default for - ``_ENABLE_TESTS=ON`` for each subpackage ```` of - the parent package ```` (if ```` has - subpackages). Same is true for ``_ENABLE_EXAMPLES=ON`` - setting the default for ``_ENABLE_EXAMPLES=ON``. In - addition, setting ``_ENABLE_TESTS=ON`` will set - ``_ENABLE_EXAMPLES=ON`` by default as well. +.. _Enable/disable of parent package tests/examples is enable/disable for subpackages tests/examples: + +12) **Enable/disable of parent package tests/examples is enable/disable for + subpackages tests/examples**: Setting + ``_ENABLE_TESTS=[ON|OFF]`` is equivalent to setting the + default for ``_ENABLE_TESTS=[ON|OFF]`` for each + subpackage ```` of the parent package ```` (if + ```` has subpackages). Same is true for + ``_ENABLE_EXAMPLES=[ON|OFF]`` setting the default for + ``_ENABLE_EXAMPLES=[ON|OFF]``. In addition, setting + ``_ENABLE_TESTS=[ON|OFF]`` will set + ``_ENABLE_EXAMPLES=[ON|OFF]`` by default as well (but not + vice versa). .. _Subpackage enable does not auto-enable the parent package: diff --git a/cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst b/cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst index b87a485d85de..c045c1962e54 100644 --- a/cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst +++ b/cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst @@ -14,6 +14,7 @@ @FUNCTION: tribits_add_test() + @MACRO: tribits_add_test_directories() + @FUNCTION: tribits_allow_missing_external_packages() + +@MACRO: tribits_assert_cache_and_local_vars_same_value() + @FUNCTION: tribits_configure_file() + @FUNCTION: tribits_copy_files_to_binary_dir() + @FUNCTION: tribits_ctest_driver() + @@ -30,6 +31,7 @@ @FUNCTION: tribits_find_most_recent_source_file_timestamp() + @FUNCTION: tribits_install_headers() + @MACRO: tribits_include_directories() + +@MACRO: tribits_pkg_export_cache_var() + @MACRO: tribits_package() + @MACRO: tribits_package_decl() + @MACRO: tribits_package_def() + diff --git a/cmake/tribits/examples/TribitsExampleApp/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleApp/CMakeLists.txt index 4de561d8acbb..562a38ffd4ab 100644 --- a/cmake/tribits/examples/TribitsExampleApp/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleApp/CMakeLists.txt @@ -17,6 +17,9 @@ include(AppHelperFuncs) getTribitsExProjStuffForApp() +# Show that we can see exported cache vars +message("-- WithSubpackagesA_SPECIAL_VALUE = '${WithSubpackagesA_SPECIAL_VALUE}'") + # Enable the compilers now that we have gotten them from the *Config.cmake file enable_language(C) enable_language(CXX) diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/CMakeLists.txt index d9e5c1c2bd1a..4eb715a09576 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/CMakeLists.txt @@ -8,6 +8,7 @@ tribits_package( SimpleCxx ENABLE_SHADOWING_WARNINGS CLEANED ) # include(CheckFor__int64) check_for___int64(HAVE_SIMPLECXX___INT64) +tribits_pkg_export_cache_var(HAVE_SIMPLECXX___INT64) # # C) Set up package-specific options diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.cpp b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.cpp index f9db8c90a125..85286e850a7c 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.cpp +++ b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.cpp @@ -1,4 +1,5 @@ #include "A.hpp" +#include "WithSubpackagesA_config.h" #include "SimpleCxx_HelloWorld.hpp" @@ -9,3 +10,7 @@ std::string WithSubpackages::getA() { std::string WithSubpackages::depsA() { return "SimpleCxx "+SimpleCxx::deps(); } + +int WithSubpackages::specialValue() { + return WITHSUBPACKAGESA_SPECIAL_VALUE; +} diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.hpp b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.hpp index 3476ee5b17ff..36364a10af12 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.hpp +++ b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/A.hpp @@ -11,6 +11,9 @@ namespace WithSubpackages { // return a string describing the dependencies of "A", recursively std::string depsA(); + // return special value + int specialValue(); + } diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt index f9ede481a956..e7cdf9cf6f63 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt @@ -6,18 +6,22 @@ tribits_subpackage(A) # # B) Set up subpackage-specific options # -# Typically there are none or are few as most options are picked up from the -# parent package's CMakeLists.txt file! + +set(${PACKAGE_NAME}_SPECIAL_VALUE 3 CACHE STRING "Integer special value") +tribits_pkg_export_cache_var(${PACKAGE_NAME}_SPECIAL_VALUE) # # C) Add the libraries, tests, and examples # +tribits_configure_file(${PACKAGE_NAME}_config.h) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library(pws_a SOURCES A.cpp - HEADERS A.hpp - NOINSTALLHEADERS + HEADERS A.hpp ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h ) tribits_add_test_directories(tests) diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/cmake/WithSubpackagesA_config.h.in b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/cmake/WithSubpackagesA_config.h.in new file mode 100644 index 000000000000..4536208a03c8 --- /dev/null +++ b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/cmake/WithSubpackagesA_config.h.in @@ -0,0 +1,6 @@ +#ifndef WITHSUBPACKAGESA_CONFIG_H +#define WITHSUBPACKAGESA_CONFIG_H + +#define WITHSUBPACKAGESA_SPECIAL_VALUE ${WithSubpackagesA_SPECIAL_VALUE} + +#endif // WITHSUBPACKAGESA_CONFIG_H diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/CMakeLists.txt index 788b93eac65d..c891750a7e94 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/CMakeLists.txt @@ -6,4 +6,5 @@ tribits_add_advanced_test( test_of_a PASS_REGULAR_EXPRESSION_ALL "A label is: A" "A deps are: ${EXPECTED_SIMPLECXX_AND_DEPS}" + "A special value: ${WithSubpackagesA_SPECIAL_VALUE}" ) diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/a_test.cpp b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/a_test.cpp index 4c48a7838eae..6497b4d8ebee 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/a_test.cpp +++ b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/tests/a_test.cpp @@ -3,13 +3,11 @@ #include "A.hpp" -using namespace WithSubpackages; - int main() { - std::string label_A = getA(); - std::string deps_A = depsA(); + std::string label_A = WithSubpackages::getA(); + std::string deps_A = WithSubpackages::depsA(); std::cout << "A label is: " << label_A << std::endl; std::cout << "A deps are: " << deps_A << std::endl; - + std::cout << "A special value: " << WithSubpackages::specialValue() << std::endl; return 0; } diff --git a/demos/simpleBuildAgainstTrilinos/CMakeLists.txt b/demos/simpleBuildAgainstTrilinos/CMakeLists.txt index 23c4f2e34ea9..990287789e66 100644 --- a/demos/simpleBuildAgainstTrilinos/CMakeLists.txt +++ b/demos/simpleBuildAgainstTrilinos/CMakeLists.txt @@ -1,6 +1,6 @@ # CMAKE File for "MyApp" application building against an installed Trilinos -cmake_minimum_required(VERSION 3.17.1) +cmake_minimum_required(VERSION 3.0) # Declare project but don't process compilers yet # @@ -22,11 +22,8 @@ MESSAGE(" Trilinos_VERSION = ${Trilinos_VERSION}") MESSAGE(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}") MESSAGE(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}") MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}") -MESSAGE(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}") MESSAGE(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}") -MESSAGE(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}") MESSAGE(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}") -MESSAGE(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}") MESSAGE(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}") MESSAGE("End of Trilinos details\n") diff --git a/packages/TrilinosInstallTests/find_package_Trilinos/CMakeLists.txt b/packages/TrilinosInstallTests/find_package_Trilinos/CMakeLists.txt index 65661f2b7d3d..4b4d8cb0f549 100644 --- a/packages/TrilinosInstallTests/find_package_Trilinos/CMakeLists.txt +++ b/packages/TrilinosInstallTests/find_package_Trilinos/CMakeLists.txt @@ -1,4 +1,7 @@ -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.0) + +# Disable Kokkos warning about not supporting C++ extensions +set(CMAKE_CXX_EXTENSIONS OFF) project(find_package_Trilinos NONE) diff --git a/packages/framework/ini-files/config-specs.ini b/packages/framework/ini-files/config-specs.ini index 601faa06e5a5..0fd0f532f060 100644 --- a/packages/framework/ini-files/config-specs.ini +++ b/packages/framework/ini-files/config-specs.ini @@ -887,6 +887,12 @@ opt-set-cmake-var Trilinos_CUDA_NUM_GPUS STRING : ${KOKKOS_NUM_DEVICES|ENV} opt-set-cmake-var Trilinos_CUDA_SLOTS_PER_GPU STRING : 2 # See https://tribits.org/doc/TribitsBuildReference.html#spreading-out-and-limiting-tests-running-on-gpus opt-set-cmake-var Trilinos_AUTOGENERATE_TEST_RESOURCE_FILE BOOL FORCE : ON +opt-set-cmake-var Trilinos_ENABLE_Pliris BOOL FORCE : OFF +# NOTE: Above, FORCE is needed for Trilinos_ENABLE_Pliris=OFF in case somemoe +# changes a file under packages/pliris/ and results in adding +# set(Trilinos_ENABLE_Pliris ON CACHE BOOL "") in the packageEnables.cmake +# file. For more details on the complexity of this, see Trilinos GitHub Issue +# #10931. [ATS2-COMMON-OVERRIDES] # Override TPL enables from [COMMON] @@ -977,6 +983,8 @@ opt-set-cmake-var PanzerAdaptersSTK_main_driver_energy-ss-blocked-tp_DISABLE BOO opt-set-cmake-var PanzerDiscFE_integration_values2_MPI_1_DISABLE BOOL : ON opt-set-cmake-var PanzerMiniEM_MiniEM-BlockPrec_Augmentation_MPI_4_DISABLE BOOL : ON opt-set-cmake-var PanzerMiniEM_MiniEM-BlockPrec_RefMaxwell_MPI_4_DISABLE BOOL : ON +opt-set-cmake-var Pliris_vector_random_MPI_3_DISABLE BOOL : ON +opt-set-cmake-var Pliris_vector_random_MPI_4_DISABLE BOOL : ON opt-set-cmake-var ROL_NonlinearProblemTest_MPI_4_DISABLE BOOL : ON opt-set-cmake-var ROL_adapters_minitensor_test_function_test_01_MPI_4_DISABLE BOOL : ON opt-set-cmake-var ROL_adapters_minitensor_test_function_test_02_MPI_4_DISABLE BOOL : ON diff --git a/packages/pliris/CMakeLists.txt b/packages/pliris/CMakeLists.txt index 738a4416edd3..c03d1d7390fe 100644 --- a/packages/pliris/CMakeLists.txt +++ b/packages/pliris/CMakeLists.txt @@ -20,11 +20,6 @@ TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_SCPLX "Enable single precision complex functionality." OFF ) -TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_DREAL - DREAL - "Set reals to double precision." - OFF ) - TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_SREAL SREAL "Set reals to single precision." @@ -37,11 +32,16 @@ TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_SREAL #If no options are specified set DREAL as the default IF(NOT ${PACKAGE_NAME}_ENABLE_ZCPLX AND NOT ${PACKAGE_NAME}_ENABLE_SCPLX AND - NOT ${PACKAGE_NAME}_ENABLE_SREAL AND - NOT ${PACKAGE_NAME}_ENABLE_DREAL) - - SET(${PACKAGE_NAME}_ENABLE_DREAL ON) + NOT ${PACKAGE_NAME}_ENABLE_SREAL + ) + SET(${PACKAGE_NAME}_ENABLE_DREAL_DEFAULT ON) +ELSE() + SET(${PACKAGE_NAME}_ENABLE_DREAL_DEFAULT OFF) ENDIF() +TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_DREAL + DREAL + "Set reals to double precision." + ${${PACKAGE_NAME}_ENABLE_DREAL_DEFAULT} ) ADD_SUBDIRECTORY(src)