From bd26a11747b397054e350712d275f6aac8507d11 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Wed, 26 May 2021 16:59:21 -0600 Subject: [PATCH 1/6] Automatic snapshot commit from tribits at 74f61da Origin repo remote tracking branch: 'github/master' Origin repo remote repo URL: 'github = git@github.com:TriBITSPub/TriBITS.git' At commit: commit 74f61da9a7a97742e941585166025e849c6dcfaf Author: Roscoe A. Bartlett Date: Wed May 26 16:56:22 2021 -0600 Summary: Add link back to function call graph (#63) --- .../ci_support/TribitsDumpDepsXmlScript.cmake | 7 +- ...=> TribitsWriteXmlDependenciesFiles.cmake} | 30 +- .../TribitsAdjustPackageEnables.cmake | 1369 ----------------- .../TribitsFindMostRecentFileTimestamp.cmake | 12 +- .../package_arch/TribitsGeneralMacros.cmake | 318 +++- .../package_arch/TribitsGlobalMacros.cmake | 109 +- .../TribitsPackageDefineDependencies.cmake | 256 +++ .../TribitsPrintDependencyInfo.cmake | 120 ++ .../TribitsProcessPackagesAndDirsLists.cmake | 11 +- .../TribitsProcessTplsLists.cmake | 3 +- .../package_arch/TribitsProjectImpl.cmake | 46 +- ...dAllProjectDepsFilesCreateDepsGraph.cmake} | 49 +- .../TribitsReadDepsFilesCreateDepsGraph.cmake | 943 ++++++++++++ ...itsSystemDataStructuresMacrosFunctions.rst | 44 +- .../TribitsCTestDriverCoreHelpers.cmake | 7 +- .../TribitsDevelopersGuide.rst | 6 +- .../TribitsSystemMacroFunctionDocTemplate.rst | 21 +- .../developers_guide/generate-dev-guide.sh | 2 +- 18 files changed, 1754 insertions(+), 1599 deletions(-) rename cmake/tribits/ci_support/{TribitsDumpXmlDependenciesFiles.cmake => TribitsWriteXmlDependenciesFiles.cmake} (91%) create mode 100644 cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake create mode 100644 cmake/tribits/core/package_arch/TribitsPrintDependencyInfo.cmake rename cmake/tribits/core/package_arch/{TribitsReadPackagesProcessDepenenciesWriteXml.cmake => TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake} (92%) create mode 100644 cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake diff --git a/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake b/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake index 8bb5cd6dc9e6..88b2b8ed233c 100644 --- a/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake +++ b/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake @@ -101,6 +101,7 @@ MESSAGE("-- Setting ${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}") SET( CMAKE_MODULE_PATH "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" + "${${PROJECT_NAME}_TRIBITS_DIR}/ci_support" ) INCLUDE(TribitsConstants) @@ -108,6 +109,8 @@ TRIBITS_ASESRT_MINIMUM_CMAKE_VERSION() INCLUDE(TribitsCMakePolicies) INCLUDE(TribitsGlobalMacros) +INCLUDE(TribitsPrintDependencyInfo) +INCLUDE(TribitsWriteXmlDependenciesFiles) # Generate the dependencies file @@ -121,4 +124,6 @@ IF (NOT ${PROJECT_NAME}_EXTRA_REPOSITORIES) # Make sure is defined! ENDIF() TRIBITS_READ_IN_NATIVE_REPOSITORIES() TRIBITS_COMBINE_NATIVE_AND_EXTRA_REPOS() -TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML() +TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() +TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() +TRIBITS_WRITE_XML_DEPENDENCY_FILES() diff --git a/cmake/tribits/ci_support/TribitsDumpXmlDependenciesFiles.cmake b/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake similarity index 91% rename from cmake/tribits/ci_support/TribitsDumpXmlDependenciesFiles.cmake rename to cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake index 0e469504e297..6f5672e71d2e 100644 --- a/cmake/tribits/ci_support/TribitsDumpXmlDependenciesFiles.cmake +++ b/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake @@ -145,15 +145,18 @@ FUNCTION(TRIBITS_DUMP_DEPS_XML_FILE) ENDFUNCTION() +# @MACRO: TRIBITS_WRITE_XML_DEPENDENCY_FILES() # -# Macro that ouptuts XML dependency files +# Usage:: +# +# TRIBITS_WRITE_XML_DEPENDENCY_FILES() +# +# Macro that output XML dependency files if asked based in the global project +# package dependency graph previously constructed.. # - MACRO(TRIBITS_WRITE_XML_DEPENDENCY_FILES) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(WRITE_DEPENDENCY_FILES_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(WRITE_DEPENDENCY_FILES_TIME_START_SECONDS) #PRINT_VAR(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) IF (${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) @@ -195,17 +198,12 @@ MACRO(TRIBITS_WRITE_XML_DEPENDENCY_FILES) --output-cdash-deps-xml-file=${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE} ) ENDIF() - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(WRITE_DEPENDENCY_FILES_TIME_STOP_SECONDS) - IF (${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE - OR ${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE - OR ${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE - ) - TIMER_PRINT_REL_TIME(${WRITE_DEPENDENCY_FILES_TIME_START_SECONDS} - ${WRITE_DEPENDENCY_FILES_TIME_STOP_SECONDS} - "\nTotal time to write dependency files") - ENDIF() + IF (${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE + OR ${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE + OR ${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE + ) + TRIBITS_CONFIG_CODE_STOP_TIMER(WRITE_DEPENDENCY_FILES_TIME_START_SECONDS + "\nTotal time to write dependency files") ENDIF() ENDMACRO() - diff --git a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake index 63dd20f22730..829a21b81ef2 100644 --- a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake +++ b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake @@ -58,1219 +58,6 @@ INCLUDE(DualScopeSet) INCLUDE(CMakeParseArguments) -# @FUNCTION: TRIBITS_SET_ST_FOR_DEV_MODE() -# -# Function that allows packages to easily make a feature ``ST`` for -# development builds and ``PT`` for release builds by default. -# -# Usage:: -# -# TRIBITS_SET_ST_FOR_DEV_MODE() -# -# This function is typically called in a package's top-level -# `/CMakeLists.txt`_ file before defining other options for the -# package. The output variable ``${}`` is set to ``ON`` or ``OFF`` -# based on the configure state. In development mode -# (i.e. ``${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE==ON``), ``${}`` -# will be set to ``ON`` only if ``ST`` code is enabled -# (i.e. ``${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE==ON``), otherwise it is -# set to ``OFF``. In release mode -# (i.e. ``${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE==OFF``), ``${}`` -# is always set to ``ON``. This allows some parts of a TriBITS package to be -# considered ``ST`` for development mode (thereby reducing testing time by not -# enabling the dependent features/tests), while still having important -# functionality available to users by default in a release of the package. -# -FUNCTION(TRIBITS_SET_ST_FOR_DEV_MODE OUTPUT_VAR) - IF(${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE) - SET(OUTPUT_VAL ${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}) - ELSE() - SET(OUTPUT_VAL ON) - ENDIF() - SET(${OUTPUT_VAR} ${OUTPUT_VAL} PARENT_SCOPE) -ENDFUNCTION() - - -# For backward compatibility -MACRO(TRIBITS_SET_SS_FOR_DEV_MODE OUTPUT_VAR) - MESSAGE(WARNING - "WARNING: TRIBITS_SET_SS_FOR_DEV_MODE() is deprecated," - " use TRIBITS_SET_ST_FOR_DEV_MODE() instead!") - TRIBITS_SET_ST_FOR_DEV_MODE(${OUTPUT_VAR}) -ENDMACRO() - - -# Set the combined directory name taking into account '.' repos. -# -FUNCTION(TRIBITS_GET_REPO_NAME REPO_DIR REPO_NAME_OUT) - IF (REPO_DIR STREQUAL ".") - SET(REPO_NAME ${PROJECT_NAME}) - ELSE() - SET(REPO_NAME ${REPO_DIR}) - ENDIF() - SET(${REPO_NAME_OUT} "${REPO_NAME}" PARENT_SCOPE) -ENDFUNCTION() - - -# Set the combined directory name taking into account '.' repos. -# -FUNCTION(TRIBITS_SET_BASE_REPO_DIR BASE_DIR REPO_DIR BASE_REPO_DIR_OUT) - IF (REPO_DIR STREQUAL ".") - SET(REPO_DIR_STR "") - ELSE() - SET(REPO_DIR_STR "/${REPO_DIR}") - ENDIF() - SET(${BASE_REPO_DIR_OUT} "${BASE_DIR}${REPO_DIR_STR}" PARENT_SCOPE) -ENDFUNCTION() - - -# @FUNCTION: TRIBITS_ABORT_ON_MISSING_PACKAGE() -# -# Usage:: -# -# TRIBITS_ABORT_ON_MISSING_PACKAGE( ) -# -# Function that creates error message about missing/misspelled package. This -# error message also suggests that the package might be defining an upstream -# dependency on a downstream dependency (i.e. a circular dependency). -# -FUNCTION(TRIBITS_ABORT_ON_MISSING_PACKAGE DEP_PKG PACKAGE_NAME DEP_PKG_LIST_NAME) - MULTILINE_SET(ERRMSG - "Error, the package '${DEP_PKG}' is listed as a dependency of the package" - " '${PACKAGE_NAME}' is in the list '${DEP_PKG_LIST_NAME}' but the package" - " '${DEP_PKG}' is either not defined or is listed later in the package order." - " This may also be an attempt to create a circular dependency between" - " the packages '${DEP_PKG}' and '${PACKAGE_NAME}' (which is not allowed)." - " Check the spelling of '${DEP_PKG}' or see how it is listed in" - " a call to TRIBITS_REPOSITORY_DEFINE_PACKAGES() in relation to" - " '${PACKAGE_NAME}'.") - MESSAGE(FATAL_ERROR ${ERRMSG}) -ENDFUNCTION() - - -# @FUNCTION: TRIBITS_ABORT_ON_SELF_DEP() -# -# Usage:: -# -# TRIBITS_ABORT_ON_SELF_DEP( ) -# -# Prints a fatal error message for an attempt for a self dependency -# declaration and which list it comes from. -# -FUNCTION(TRIBITS_ABORT_ON_SELF_DEP PACKAGE_NAME DEP_PKG_LIST_NAME) - MULTILINE_SET(ERRMSG - "Error, the package '${PACKAGE_NAME}' is listed as a dependency of itself" - " in the list '${DEP_PKG_LIST_NAME}'!") - MESSAGE(FATAL_ERROR ${ERRMSG}) -ENDFUNCTION() - - -# @FUNCTION: TRIBITS_SET_DEP_PACKAGES() -# -# Usage:: -# -# TRIBITS_SET_DEP_PACKAGES( LIB|TEST REQUIRED|OPTIONAL) -# -# Function that helps to set up backward package dependency lists for a given -# package given the vars read in from the macro -# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_. -# -# Sets the upstream/backward dependency variables defined in the section `List -# variables defining the package dependencies graph`_. -# -# This also handles the several types of issues: -# -# * A package declaring a dependency on itself -# (`TRIBITS_ABORT_ON_SELF_DEP()`_). -# -# * A missing upstream dependent package (either error out with -# `TRIBITS_ABORT_ON_MISSING_PACKAGE()`_ or allow to be missing and disable -# this package if this is a required dependency). -# -FUNCTION(TRIBITS_SET_DEP_PACKAGES PACKAGE_NAME LIB_OR_TEST REQUIRED_OR_OPTIONAL) - - IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) - MESSAGE("\nTRIBITS_SET_DEP_PACKAGES: ${PACKAGE_NAME} ${LIB_OR_TEST} ${REQUIRED_OR_OPTIONAL})") - ENDIF() - - SET(LIST_TYPE ${LIB_OR_TEST}_${REQUIRED_OR_OPTIONAL}_DEP_PACKAGES) - SET(PACKAGE_DEPS_LIST) - SET(SE_PACKAGE_ENABLE_VAR ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - - FOREACH(DEP_PKG ${${LIST_TYPE}}) - IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) - PRINT_VAR(DEP_PKG) - ENDIF() - IF (${DEP_PKG} STREQUAL ${PACKAGE_NAME}) - TRIBITS_ABORT_ON_SELF_DEP("${PACKAGE_NAME}" "${LIST_TYPE}") - ENDIF() - IF (${DEP_PKG}_SOURCE_DIR) - SET(DEP_PKG_DEFINED_AND_EXISTS TRUE) - ELSE() - SET(DEP_PKG_DEFINED_AND_EXISTS FALSE) - ENDIF() - IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) - PRINT_VAR(DEP_PKG_DEFINED_AND_EXISTS) - ENDIF() - IF (DEP_PKG_DEFINED_AND_EXISTS) - LIST(APPEND PACKAGE_DEPS_LIST ${DEP_PKG}) - ELSE() - IF (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES - AND NOT ${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE - ) - TRIBITS_ABORT_ON_MISSING_PACKAGE( - "${DEP_PKG}" "${PACKAGE_NAME}" "${PROJECT_NAME}_SE_PACKAGES") - ELSE() - IF (${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE) - IF (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES) - MESSAGE_WRAPPER("NOTE: ${DEP_PKG} is being ignored since its directory" - " is missing and ${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE =" - " ${${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE}!") - ENDIF() - IF (REQUIRED_OR_OPTIONAL STREQUAL "REQUIRED") - MESSAGE_WRAPPER("NOTE: Setting ${SE_PACKAGE_ENABLE_VAR}=OFF because" - " package ${PACKAGE_NAME} has a required dependency on missing" - " package ${DEP_PKG}!") - DUAL_SCOPE_SET(${SE_PACKAGE_ENABLE_VAR} OFF) - ENDIF() - ENDIF() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE( - "\n***" - "\n*** NOTE: The package ${DEP_PKG} which is a dependent package of" - " ${PACKAGE_NAME} being ignored because ${DEP_PKG} is missing!" - "\n***\n" ) - 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. - DUAL_SCOPE_SET(${PROJECT_NAME}_ENABLE_${DEP_PKG} OFF) - DUAL_SCOPE_SET(${PACKAGE_NAME}_ENABLE_${DEP_PKG} OFF) - ENDIF() - ENDIF() - ENDFOREACH() - - #PRINT_VAR(PACKAGE_DEPS_LIST) - - GLOBAL_SET(${PACKAGE_NAME}_${LIST_TYPE} ${PACKAGE_DEPS_LIST}) - -ENDFUNCTION() - - -# @FUNCTION: TRIBITS_APPEND_FORWARD_DEP_PACKAGES() -# -# Usage: TRIBITS_APPEND_FORWARD_DEP_PACKAGES( ) -# -# Function that helps to set up forward package dependency lists for an -# upstream package given that a downstream package declared a dependency on -# it. In particular, it appends the var:: -# -# _FORWARD_ -# -# for one of the vars listed in `List variables defining the package -# dependencies graph`_. -# -# This function is called multiple times to build up the forward package -# dependencies for a given ```` by the downstream packages that -# declare dependencies on it. -# -FUNCTION(TRIBITS_APPEND_FORWARD_DEP_PACKAGES PACKAGE_NAME LIST_TYPE) - - SET(DEP_PKG_LIST_NAME "${PACKAGE_NAME}_${LIST_TYPE}") - - ASSERT_DEFINED(${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - FOREACH(DEP_PKG ${${DEP_PKG_LIST_NAME}}) - SET(FWD_DEP_PKG_LIST_NAME "${DEP_PKG}_FORWARD_${LIST_TYPE}") - IF (NOT DEFINED ${FWD_DEP_PKG_LIST_NAME}) - IF (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - TRIBITS_ABORT_ON_MISSING_PACKAGE(${DEP_PKG} ${PACKAGE_NAME} ${DEP_PKG_LIST_NAME}) - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE( - "\n***" - "\n*** NOTE: The package ${DEP_PKG} has forward dependent package" - " ${PACKAGE_NAME}, but that dependency is being ignored because the package" - " ${DEP_PKG} is missing!" - "\n***\n" ) - ENDIF() - ENDIF() - ELSE() - SET(${FWD_DEP_PKG_LIST_NAME} ${${FWD_DEP_PKG_LIST_NAME}} ${PACKAGE_NAME} - PARENT_SCOPE) - ENDIF() - ENDFOREACH() - -ENDFUNCTION() - - -################################################################################ -# -# Helper macros for TRIBITS_READ_PACKAGE_DEPENDENCIES() -# -################################################################################ - - -# @MACRO: TRIBITS_PREP_TO_READ_DEPENDENCIES() -# -# Usage:: -# -# TRIBITS_PREP_TO_READ_DEPENDENCIES() -# -# Macro that sets to undefined all of the variables that must be set by the -# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ macro. -# -# It also sets to empty the forward dependency list vars:: -# -# _FORWARD_ -# -# for each of the forward/downstream in `List variables defining the package -# dependencies graph`_. -# -MACRO(TRIBITS_PREP_TO_READ_DEPENDENCIES PACKAGE_NAME_IN) - - TRIBITS_DECLARE_UNDEFINED(LIB_REQUIRED_DEP_PACKAGES) - TRIBITS_DECLARE_UNDEFINED(LIB_OPTIONAL_DEP_PACKAGES) - TRIBITS_DECLARE_UNDEFINED(TEST_REQUIRED_DEP_PACKAGES) - TRIBITS_DECLARE_UNDEFINED(TEST_OPTIONAL_DEP_PACKAGES) - - TRIBITS_DECLARE_UNDEFINED(LIB_REQUIRED_DEP_TPLS "") - TRIBITS_DECLARE_UNDEFINED(LIB_OPTIONAL_DEP_TPLS "") - TRIBITS_DECLARE_UNDEFINED(TEST_REQUIRED_DEP_TPLS "") - TRIBITS_DECLARE_UNDEFINED(TEST_OPTIONAL_DEP_TPLS "") - - SET(REGRESSION_EMAIL_LIST "") # Allow to be empty - - SET(${PACKAGE_NAME_IN}_FORWARD_LIB_REQUIRED_DEP_PACKAGES "") - SET(${PACKAGE_NAME_IN}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES "") - SET(${PACKAGE_NAME_IN}_FORWARD_TEST_REQUIRED_DEP_PACKAGES "") - SET(${PACKAGE_NAME_IN}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES "") - -ENDMACRO() - - -# @MACRO: TRIBITS_PACKAGE_DEFINE_DEPENDENCIES() -# -# Define the dependencies for a given `TriBITS SE Package`_ (i.e. a top-level -# `TriBITS Package`_ or a `TriBITS Subpackage`_) in the package's -# `/cmake/Dependencies.cmake`_ file. -# -# Usage:: -# -# TRIBITS_PACKAGE_DEFINE_DEPENDENCIES( -# [LIB_REQUIRED_PACKAGES ...] -# [LIB_OPTIONAL_PACKAGES ...] -# [TEST_REQUIRED_PACKAGES ...] -# [TEST_OPTIONAL_PACKAGES ...] -# [LIB_REQUIRED_TPLS ...] -# [LIB_OPTIONAL_TPLS ...] -# [TEST_REQUIRED_TPLS ...] -# [TEST_OPTIONAL_TPLS ...] -# [REGRESSION_EMAIL_LIST ] -# [SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS -# -# -# ... -# ] -# ) -# -# Every argument in this macro is optional (that is, an SE package can have no -# upstream dependencies). The arguments that apply to all SE packages are: -# -# ``LIB_REQUIRED_PACKAGES`` -# -# List of required upstream SE packages that must be enabled in order to -# build and use the libraries (or capabilities) in this SE package. -# -# ``LIB_OPTIONAL_PACKAGES`` -# -# List of additional optional upstream SE packages that can be used in -# this SE package if enabled. These upstream SE packages need not be -# enabled in order to enable this SE package but not enabling one or more -# of these optional upstream SE packages will result in diminished -# capabilities of this SE package. -# -# ``TEST_REQUIRED_PACKAGES`` -# -# List of additional upstream SE packages that must be enabled in order to -# build and/or run the tests and/or examples in this SE package. If any -# of these upstream SE packages are not enabled, then there will be no -# tests or examples defined or run for this SE package. -# -# ``TEST_OPTIONAL_PACKAGES`` -# -# List of additional optional upstream SE packages that can be used by the -# tests in this SE package. These upstream SE packages need not be -# enabled in order to run some basic tests or examples for this SE -# package. Typically, extra tests that depend on optional test SE -# packages involve integration testing of some type. -# -# ``LIB_REQUIRED_TPLS`` -# -# List of required upstream TPLs that must be enabled in order to build -# and use the libraries (or capabilities) in this SE package. -# -# ``LIB_OPTIONAL_TPLS`` -# -# List of additional optional upstream TPLs that can be used in this SE -# package if enabled. These upstream TPLs need not be enabled in order to -# use this SE package but not enabling one or more of these optional -# upstream TPLs will result in diminished capabilities of this SE package. -# -# ``TEST_REQUIRED_TPLS`` -# -# List of additional upstream TPLs that must be enabled in order to build -# and/or run the tests and/or examples in this SE package. If any of -# these upstream TPLs are not enabled, then there will be no tests or -# examples defined or run for this SE package. -# -# ``TEST_OPTIONAL_TPLS`` -# -# List of additional optional upstream TPLs that can be used by the tests -# in this SE package. These upstream TPLs need not be enabled in order to -# run basic tests for this SE package. Typically, extra tests that depend -# on optional TPLs involve integration testing or some additional testing -# of some type. -# -# Only upstream SE packages can be listed (as defined by the order the SE -# packages are listed in `TRIBITS_REPOSITORY_DEFINE_PACKAGES()`_ in the -# `/PackagesList.cmake`_ file). Otherwise an error will occur and -# processing will stop. Misspelled SE package names are caught as well. -# -# Only direct SE package dependencies need to be listed. Indirect SE package -# dependencies are automatically handled. For example, if this SE package -# directly depends on SE package ``PKG2`` which depends on SE package ``PKG1`` -# (but this SE package does not directly depend on anything in ``PKG1``) then -# this SE package only needs to list a dependency on ``PKG2``, not ``PKG1``. -# The dependency on ``PKG1`` will be taken care of automatically by the -# TriBITS dependency management system. -# -# However, currently, all TPL dependencies must be listed, even the indirect -# ones. This is a requirement that will be dropped in a future version of -# TriBITS. -# -# The SE packages listed in ``LIB_REQUIRED_PACKAGES`` are implicitly also -# dependencies in ``TEST_REQUIRED_PACKAGES``. Likewise -# ``LIB_OPTIONAL_PACKAGES`` are implicitly also dependencies in -# ``TEST_OPTIONAL_PACKAGES``. Same goes for TPL dependencies. -# -# The upstream dependencies within a single list do not need to be listed in -# any order. For example if ``PKG2`` depends on ``PKG1``, and this given SE -# package depends on both, then one can list:: -# -# LIB_REQUIRED_PACKAGES PKG2 PKG1 -# -# or:: -# -# "LIB_REQUIRED_PACKAGES PKG1 PKG2 -# -# Likewise the order that dependent TPLs are listed is not significant. -# -# If some upstream SE packages are allowed to be missing, this can be specified -# by calling the macro `TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES()`_. -# -# A top-level `TriBITS Package`_ can also be broken down into `TriBITS -# Subpackages`_. In this case, the following argument must be passed in: -# -# .. _SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS: -# -# ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` -# -# 2D array with rows listing the subpackages where each row has the -# columns: -# -# * **SUBPACKAGE** (Column 0): The name of the subpackage ````. -# The full SE package name is ``${PARENT_PACKAGE_NAME}``. -# The full SE package name is what is used in listing dependencies in -# other SE packages. -# -# * **DIRS** (Column 1): The subdirectory ```` relative to the -# parent package's base directory. All of the contents of the -# subpackage should be under this subdirectory. This is assumed by the -# TriBITS testing support software when mapping modified files to SE -# packages that need to be tested (see `checkin-test.py`_). -# -# * **CLASSIFICATIONS** (Column 2): The `Test Test Category`_ `PT`_, -# `ST`_, `EX`_ and the maturity level ``EP``, ``RS``, ``PG``, ``PM``, -# ``GRS``, ``GPG``, ``GPM``, and ``UM``, separated by a coma ',' with no -# spaces in between (e.g. ``"PT,GPM"``). These have exactly the same -# meaning as for full packages (see -# `TRIBITS_REPOSITORY_DEFINE_PACKAGES()`_). -# -# * **OPTREQ** (Column 3): Determines if the outer parent package has an -# ``OPTIONAL`` or ``REQUIRED`` dependence on this subpackage. -# -# Other variables that this macro handles: -# -# ``REGRESSION_EMAIL_LIST`` -# -# The email list that is used to send CDash error messages. If this -# argument is missing, then the email list that CDash errors go to is -# determined by other means (see `CDash regression email addresses`_). -# -# NOTE: All this macro really does is to just define the variables: -# -# * ``LIB_REQUIRED_DEP_PACKAGES`` -# * ``LIB_OPTIONAL_DEP_PACKAGES`` -# * ``TEST_REQUIRED_DEP_PACKAGES`` -# * ``TEST_OPTIONAL_DEP_PACKAGES`` -# * ``LIB_REQUIRED_DEP_TPLS`` -# * ``LIB_OPTIONAL_DEP_TPLS`` -# * ``TEST_REQUIRED_DEP_TPLS`` -# * ``TEST_OPTIONAL_DEP_TPLS`` -# * ``REGRESSION_EMAIL_LIST`` -# * ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` -# -# which are then read by the TriBITS cmake code to build the SE package -# dependency graph. The advantage of using this macro instead of just -# directly setting the variables is that an SE package only needs to list -# dependencies that exist. Otherwise, the ``Dependencies.cmake`` file will -# need to set all of the above local variables, even those that are empty. -# This is an error checking property of the TriBITS system to avoid misspelling -# the names of these variables. -# -MACRO(TRIBITS_PACKAGE_DEFINE_DEPENDENCIES) - - CMAKE_PARSE_ARGUMENTS( - #prefix - PARSE - #options - "" - #one_value_keywords - "" - #multi_value_keywords - "LIB_REQUIRED_PACKAGES;LIB_OPTIONAL_PACKAGES;TEST_REQUIRED_PACKAGES;TEST_OPTIONAL_PACKAGES;LIB_REQUIRED_TPLS;LIB_OPTIONAL_TPLS;TEST_REQUIRED_TPLS;TEST_OPTIONAL_TPLS;REGRESSION_EMAIL_LIST;SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS" - ${ARGN} - ) - - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() - - SET(LIB_REQUIRED_DEP_PACKAGES ${PARSE_LIB_REQUIRED_PACKAGES}) - SET(LIB_OPTIONAL_DEP_PACKAGES ${PARSE_LIB_OPTIONAL_PACKAGES}) - SET(TEST_REQUIRED_DEP_PACKAGES ${PARSE_TEST_REQUIRED_PACKAGES}) - SET(TEST_OPTIONAL_DEP_PACKAGES ${PARSE_TEST_OPTIONAL_PACKAGES}) - SET(LIB_REQUIRED_DEP_TPLS ${PARSE_LIB_REQUIRED_TPLS}) - SET(LIB_OPTIONAL_DEP_TPLS ${PARSE_LIB_OPTIONAL_TPLS}) - SET(TEST_REQUIRED_DEP_TPLS ${PARSE_TEST_REQUIRED_TPLS}) - SET(TEST_OPTIONAL_DEP_TPLS ${PARSE_TEST_OPTIONAL_TPLS}) - SET(REGRESSION_EMAIL_LIST ${PARSE_REGRESSION_EMAIL_LIST}) - SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS - ${PARSE_SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS}) - - # ToDo: - # * Assert that REGRESSION_EMAIL_LIST has only one entry - # * Assert that SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS is divisible - # by the number of columns! - -ENDMACRO() - - -# @MACRO: TRIBITS_SAVE_OFF_DEPENDENCIES_VARS() -# -# Usage:: -# -# TRIBITS_SAVE_OFF_DEPENDENCIES_VARS() -# -# Saves off package depeneency varaibles with variable suffix ``_``. -# -MACRO(TRIBITS_SAVE_OFF_DEPENDENCIES_VARS POSTFIX) - - SET(LIB_REQUIRED_DEP_PACKAGES_${POSTFIX} ${LIB_REQUIRED_DEP_PACKAGES}) - SET(LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${LIB_OPTIONAL_DEP_PACKAGES}) - SET(TEST_REQUIRED_DEP_PACKAGES_${POSTFIX} ${TEST_REQUIRED_DEP_PACKAGES}) - SET(TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${TEST_OPTIONAL_DEP_PACKAGES}) - - SET(LIB_REQUIRED_DEP_TPLS_${POSTFIX} ${LIB_REQUIRED_DEP_TPLS}) - SET(LIB_OPTIONAL_DEP_TPLS_${POSTFIX} ${LIB_OPTIONAL_DEP_TPLS}) - SET(TEST_REQUIRED_DEP_TPLS_${POSTFIX} ${TEST_REQUIRED_DEP_TPLS}) - SET(TEST_OPTIONAL_DEP_TPLS_${POSTFIX} ${TEST_OPTIONAL_DEP_TPLS}) - -ENDMACRO() - - -# @MACRO: TRIBITS_ASSERT_READ_DEPENDENCY_VARS() -# -# Usage:: -# -# TRIBITS_ASSERT_READ_DEPENDENCY_VARS() -# -# Assert that all of the required variables set by the function -# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ in the file -# `/cmake/Dependencies.cmake`_ have been set. -# -MACRO(TRIBITS_ASSERT_READ_DEPENDENCY_VARS PACKAGE_NAME) - - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) - - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) - -ENDMACRO() - - -# @MACRO: TRIBITS_READ_BACK_DEPENDENCIES_VARS() -# -# Usage:: -# -# TRIBITS_READ_BACK_DEPENDENCIES_VARS() -# -# Read back the local package dependency vars from the saved-off vars with -# suffix ``_``. -# -MACRO(TRIBITS_READ_BACK_DEPENDENCIES_VARS POSTFIX) - - SET(LIB_REQUIRED_DEP_PACKAGES ${LIB_REQUIRED_DEP_PACKAGES_${POSTFIX}}) - SET(LIB_OPTIONAL_DEP_PACKAGES ${LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) - SET(TEST_REQUIRED_DEP_PACKAGES ${TEST_REQUIRED_DEP_PACKAGES_${POSTFIX}}) - SET(TEST_OPTIONAL_DEP_PACKAGES ${TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) - - SET(LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS_${POSTFIX}}) - SET(LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS_${POSTFIX}}) - SET(TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS_${POSTFIX}}) - SET(TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS_${POSTFIX}}) - -ENDMACRO() - - -# @MACRO: TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS() -# -# Usage:: -# -# TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS() -# -# Sets up the upstsream and downstream/forward package dependency list -# varaibles for ```` descrdibed in `List variables defining the -# package dependencies graph`_. Note that the downstream/forward dependencies -# of upstream packages on this package ```` are built up -# incrimentally. -# -MACRO(TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS PACKAGE_NAME) - - TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} LIB REQUIRED) - TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} LIB OPTIONAL) - TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} TEST REQUIRED) - TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} TEST OPTIONAL) - - SET(${PACKAGE_NAME}_LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS}) - SET(${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS}) - SET(${PACKAGE_NAME}_TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS}) - SET(${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS}) - - TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} LIB_REQUIRED_DEP_PACKAGES) - TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} LIB_OPTIONAL_DEP_PACKAGES) - TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} TEST_REQUIRED_DEP_PACKAGES) - TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} TEST_OPTIONAL_DEP_PACKAGES) - -ENDMACRO() - - -# @MACRO: TRIBITS_PARSE_SUBPACKAGES_AND_APPEND_SE_PACKAGES_AND_ADD_OPTIONS() -# -# Usage:: -# -# TRIBITS_PARSE_SUBPACKAGES_AND_APPEND_SE_PACKAGES_AND_ADD_OPTIONS() -# -# Macro that parses the read-in variable -# ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` set by the macro -# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ , add subpackages to the list of -# defined packages, and define user cache var options for those subpackages. -# -# This sets the list varaibles for the parent package ````:: -# -# _SUBPACKAGES -# _SUBPACKAGE_DIRS -# _SUBPACKAGE_OPTREQ -# -# For each subpackage ````, this sets:: -# -# _SOURCE_DIR -# _REL_SOURCE_DIR -# _PARENT_PACKAGE -# _PARENT_REPOSITORY -# -# And it appends for each subpackage to varaible:: -# -# ${PROJECT_NAME}_SE_PACKAGES (old) -# -MACRO(TRIBITS_PARSE_SUBPACKAGES_AND_APPEND_SE_PACKAGES_AND_ADD_OPTIONS - PACKAGE_NAME - ) - - #MESSAGE("TRIBITS_PARSE_SUBPACKAGES_AND_APPEND_SE_PACKAGES_AND_ADD_OPTIONS: ${PACKAGE_NAME}") - - # Structure of SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS - SET(SPDC_SP_NAME_OFFSET 0) - SET(SPDC_SP_DIR_OFFSET 1) - SET(SPDC_SP_CLASSIFICATION_OFFSET 2) - SET(SPDC_SP_OPTREQ_OFFSET 3) - SET(SPDC_NUM_FIELDS 4) - - SET(${PACKAGE_NAME}_SUBPACKAGES "") - SET(${PACKAGE_NAME}_SUBPACKAGE_DIRS "") - SET(${PACKAGE_NAME}_SUBPACKAGE_OPTREQ "") - - IF (SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) - - LIST(LENGTH SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS SPDC_TOTAL_LENGTH) - MATH(EXPR NUM_SUBPACKAGES "${SPDC_TOTAL_LENGTH}/${SPDC_NUM_FIELDS}") - MATH(EXPR SUBPACKAGES_LAST_IDX "${NUM_SUBPACKAGES}-1") - - FOREACH(SUBPACKAGE_IDX RANGE ${SUBPACKAGES_LAST_IDX}) - - #MESSAGE("") - #PRINT_VAR(SUBPACKAGE_IDX) - - # SUBPACKAGE_NAME - MATH(EXPR SUBPACKAGE_NAME_IDX - "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_NAME_OFFSET}") - LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_NAME_IDX} - SUBPACKAGE_NAME ) - - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) - - # SUBPACKAGE_DIR - MATH(EXPR SUBPACKAGE_DIR_IDX - "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_DIR_OFFSET}") - LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_DIR_IDX} - SUBPACKAGE_DIR ) - - # SUBPACKAGE_CLASSIFICATION - MATH(EXPR SUBPACKAGE_CLASSIFICATION_IDX - "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_CLASSIFICATION_OFFSET}") - LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_CLASSIFICATION_IDX} - SUBPACKAGE_CLASSIFICATION ) - - # ToDo: Parse out TESTGROUP and MATURITYLEVEL (Trilinos #6042) - SET(SUBPACKAGE_TESTGROUP ${SUBPACKAGE_CLASSIFICATION}) - - TRIBITS_UPDATE_PS_PT_SS_ST(Subpackage ${SUBPACKAGE_FULLNAME} SUBPACKAGE_TESTGROUP) - - # SUBPACKAGE_OPTREQ - MATH(EXPR SUBPACKAGE_OPTREQ_IDX - "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_OPTREQ_OFFSET}") - LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_OPTREQ_IDX} - SUBPACKAGE_OPTREQ ) - - # Determine if this subpackage exists - SET(SUBPACKAGE_FULL_SOURCE_DIR - ${PROJECT_SOURCE_DIR}/${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}) - IF (EXISTS ${SUBPACKAGE_FULL_SOURCE_DIR}) - SET(SUBPACKAGE_EXISTS TRUE) - ELSE() - SET(SUBPACKAGE_EXISTS FALSE) - ENDIF() - - IF (NOT SUBPACKAGE_EXISTS AND ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - MESSAGE(SEND_ERROR "ERROR: Subpackage dir '${SUBPACKAGE_FULL_SOURCE_DIR}'" - " is missing!") - ENDIF() - - # Append to lists and global variables - - IF (SUBPACKAGE_EXISTS) - - LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGES ${SUBPACKAGE_NAME}) - LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_DIR}) - LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_OPTREQ}) - LIST(APPEND ${PROJECT_NAME}_SE_PACKAGES ${SUBPACKAGE_FULLNAME}) - SET(${SUBPACKAGE_FULLNAME}_SOURCE_DIR "${SUBPACKAGE_FULL_SOURCE_DIR}") - SET(${SUBPACKAGE_FULLNAME}_REL_SOURCE_DIR - "${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}") - SET(${SUBPACKAGE_FULLNAME}_PARENT_PACKAGE ${PACKAGE_NAME}) - SET(${SUBPACKAGE_FULLNAME}_PARENT_REPOSITORY - ${${PACKAGE_NAME}_PARENT_REPOSITORY}) - - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${SUBPACKAGE_FULLNAME}_PARENT_PACKAGE) - PRINT_VAR(${SUBPACKAGE_FULLNAME}_PARENT_REPOSITORY) - ENDIF() - - # Set up the input options for this subpackage - TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS(${SUBPACKAGE_FULLNAME} - ${SUBPACKAGE_TESTGROUP}) - - ENDIF() - - ENDFOREACH() - - ENDIF() - - #PRINT_VAR(${PACKAGE_NAME}_SUBPACKAGES) - #PRINT_VAR(${PACKAGE_NAME}_SUBPACKAGE_OPTREQ) - -ENDMACRO() - - -# @MACRO: TRIBITS_READ_SUBPACKAGE_DEPENDENCIES_AND_ADD_TO_GRAPH() -# -# Usage:: -# -# TRIBITS_READ_SUBPACKAGE_DEPENDENCIES_AND_ADD_TO_GRAPH( -# ) -# -# Macro that reads in a single subpackage dependencies file -# `//cmake/Dependencies.cmake`_ and sets up the -# dependency structure for it. -# -MACRO(TRIBITS_READ_SUBPACKAGE_DEPENDENCIES_AND_ADD_TO_GRAPH PACKAGE_NAME - SUBPACKAGE_NAME SUBPACKAGE_DIR - ) - - #MESSAGE("TRIBITS_READ_SUBPACKAGE_DEPENDENCIES_AND_ADD_TO_GRAPH: ${PACKAGE_NAME} ${SUBPACKAGE_NAME} ${SUBPACKAGE_DIR}") - - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) - - # - # A) Get ready to read in the contents of this this subpakages's - # Dependencies.cmake file - # - - TRIBITS_PREP_TO_READ_DEPENDENCIES(${SUBPACKAGE_FULLNAME}) - - # NOTE: Subpackages use the regression email list from the parent package. - - # NOTE: Subpackages are not allowed to have subpackages! - SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) - - # - # B) Read in this subpackage's Dependencies file - # - - SET(SUBPACKAGE_FULL_DIR "${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}") - - SET(SUBPACKAGE_ABS_DIR "${PROJECT_SOURCE_DIR}/${SUBPACKAGE_FULL_DIR}") - SET(SUBPAKCAGE_DEPENDENCIES_FILE "${SUBPACKAGE_ABS_DIR}/cmake/Dependencies.cmake") - - IF (EXISTS ${SUBPAKCAGE_DEPENDENCIES_FILE}) - SET(SUBPACKAGE_EXISTS TRUE) - ELSE() - SET(SUBPACKAGE_EXISTS FALSE) - ENDIF() - - IF (SUBPACKAGE_EXISTS OR ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE INCLUDE "${SUBPAKCAGE_DEPENDENCIES_FILE}") - INCLUDE(${SUBPAKCAGE_DEPENDENCIES_FILE}) - - TRIBITS_ASSERT_READ_DEPENDENCY_VARS(${SUBPACKAGE_FULLNAME}) - - TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS(${SUBPACKAGE_FULLNAME}) - - SET(${SUBPACKAGE_FULLNAME}_REGRESSION_EMAIL_LIST - ${${PACKAGE_NAME}_REGRESSION_EMAIL_LIST}) - - ENDIF() - -ENDMACRO() - - -# @MACRO: TRIBITS_READ_ALL_PACKAGE_SUBPACKAGE_DEPENDENCIES() -# -# Usage:: -# -# TRIBITS_READ_ALL_PACKAGE_SUBPACKAGE_DEPENDENCIES() -# -# Read in subpackages dependencies files and add to dependencies graph -# variables. -# -MACRO(TRIBITS_READ_ALL_PACKAGE_SUBPACKAGE_DEPENDENCIES PACKAGE_NAME) - - #MESSAGE("TRIBITS_READ_ALL_PACKAGE_SUBPACKAGE_DEPENDENCIES: ${PACKAGE_NAME}") - - #PRINT_VAR(${PROJECT_NAME}_SE_PACKAGES) - - SET(SUBPACKAGE_IDX 0) - FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) - LIST(GET ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_IDX} SUBPACKAGE_DIR) - TRIBITS_READ_SUBPACKAGE_DEPENDENCIES_AND_ADD_TO_GRAPH(${TRIBITS_PACKAGE} - ${TRIBITS_SUBPACKAGE} ${SUBPACKAGE_DIR}) - MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") - ENDFOREACH() - -ENDMACRO() - - -# @MACRO: TRIBITS_READ_PACKAGE_DEPENDENCIES() -# -# Usage:: -# -# TRIBITS_READ_PACKAGE_DEPENDENCIES() -# -# Macro that reads in package dependencies for a top-level package from the -# file `/cmake/Dependencies.cmake`_ and appends the forward -# dependencies list vars for packages already read in for this package -# ````. -# -# Modifies the global variables:: -# -# ${PACKAGE_NAME}_LIB_REQUIRED_DEP_PACKAGES -# ${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES -# ${PACKAGE_NAME}_TEST_REQUIRED_DEP_PACKAGES -# ${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES -# ${PACKAGE_NAME}_FORWARD_LIB_REQUIRED_DEP_PACKAGES -# ${PACKAGE_NAME}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES -# ${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES -# ${PACKAGE_NAME}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES -# -# It also appends the list varaible:: -# -# ${PROJECT_NAME}_SE_PACKAGES (old) -# -# as for the subpackage dependencies under this top-level package are read in -# order and then this top-level package is appended and dependencies are -# dependencies are created for them. -# -MACRO(TRIBITS_READ_PACKAGE_DEPENDENCIES PACKAGE_NAME) - - # A) Get ready to read in the contents of this this pakages's Dependencies.cmake file - - TRIBITS_PREP_TO_READ_DEPENDENCIES(${PACKAGE_NAME}) - - # Listing of subpakages - SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) # Allow to be empty - - # B) Read in this package's Dependencies file and save off read dependency vars. - - SET(PACKAGE_DEPENDENCIES_FILE - "${PROJECT_SOURCE_DIR}/${${PACKAGE_NAME}_REL_SOURCE_DIR}/cmake/Dependencies.cmake") - - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE INCLUDE "${PACKAGE_DEPENDENCIES_FILE}") - INCLUDE(${PACKAGE_DEPENDENCIES_FILE}) - - TRIBITS_ASSERT_READ_DEPENDENCY_VARS(${PACKAGE_NAME}) - - TRIBITS_SAVE_OFF_DEPENDENCIES_VARS(PARENTPACK) - - # B.1) Set up the mail addresses (one regression email list for the package - # and all subpackages) - - TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST(${PACKAGE_NAME}) - - # B.2) Process this package's subpackages first *before* finishing this packages! - - TRIBITS_PARSE_SUBPACKAGES_AND_APPEND_SE_PACKAGES_AND_ADD_OPTIONS(${PACKAGE_NAME}) - - TRIBITS_READ_ALL_PACKAGE_SUBPACKAGE_DEPENDENCIES(${PACKAGE_NAME}) - - # C) Finish processing this package's dependencies into dependency graph vars - # - # NOTE: The subpackages for this package are automatically treated as - # optional or required library dependent packages for this outer package! - - TRIBITS_READ_BACK_DEPENDENCIES_VARS(PARENTPACK) - - # Append the subpackages to the dependencies list if this top-level package - SET(SUBPACKAGE_IDX 0) - FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - LIST(GET ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_IDX} SUBPACKAGE_OPTREQ) - LIST(APPEND LIB_${SUBPACKAGE_OPTREQ}_DEP_PACKAGES ${SUBPACKAGE_FULLNAME}) - MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") - ENDFOREACH() - - # Append this package to list of SE packages *after* subpackages are added! - LIST(APPEND ${PROJECT_NAME}_SE_PACKAGES ${PACKAGE_NAME}) - - # Process this parent package's dependency lists! - TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS(${PACKAGE_NAME}) - -ENDMACRO() - - -# Set a pacakge's regression email address -# ${PACKAGE_NAME}_REGRESSION_EMAIL_LIST -# -MACRO(TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST PACKAGE_NAME) - - # Lower-case package name To be used with auto email naming based on base email address - STRING(TOLOWER "${PACKAGE_NAME}" LPACKAGE) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(REGRESSION_EMAIL_LIST) - ENDIF() - - TRIBITS_GET_REPO_NAME(${${PACKAGE_NAME}_PARENT_REPOSITORY} REPOSITORY_NAME) - #PRINT_VAR(REPOSITORY_NAME) - - IF(${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST - ${${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST}) - ELSEIF (REGRESSION_EMAIL_LIST) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST ${REGRESSION_EMAIL_LIST}) - ELSEIF (${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST - "${LPACKAGE}-regression@${${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE}") - ELSEIF (${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST - "${${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS}") - ELSEIF (${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST - "${LPACKAGE}-regression@${${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE}") - ELSEIF (${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST - "${${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS}") - ELSE() - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "") - ENDIF() - - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST) - ENDIF() - -ENDMACRO() - - -# Get the REPO_NAME and REPO_DIR given the REPO -# -FUNCTION(TRIBITS_GET_REPO_NAME_DIR REPO_IN REPO_NAME_OUT REPO_DIR_OUT) - #MESSAGE("TRIBITS_GET_REPO_NAME_DIR: '${REPO_IN}' '${REPO_NAME_OUT}' '${REPO_DIR_OUT}'") - # This list of repositories is the list of directories! - SET(REPO_DIR ${REPO_IN}) - # Get the Repository name - IF (REPO_IN STREQUAL ".") - # The Project and the Reposiotry are one and the same - SET(REPO_NAME ${PROJECT_NAME}) - ELSE() - # The Repository name is the same as the repository directory - SET(REPO_NAME ${REPO_IN}) - ENDIF() - SET(${REPO_NAME_OUT} ${REPO_NAME} PARENT_SCOPE) - SET(${REPO_DIR_OUT} ${REPO_DIR} PARENT_SCOPE) -ENDFUNCTION() - - -# @MACRO: TRIBITS_READ_PROJECT_AND_PACKAGE_DEPENDENCIES_CREATE_GRAPH_PRINT_DEPS() -# -# Usage:: -# -# TRIBITS_READ_PROJECT_AND_PACKAGE_DEPENDENCIES_CREATE_GRAPH_PRINT_DEPS() -# -# This macro reads of all the package dependencies and builds the package -# dependency graph. This first executes the logic in the files -# `/cmake/RepositoryDependenciesSetup.cmake`_ (for each TriBITS repo) -# and `/cmake/ProjectDependenciesSetup.cmake`_ and then reads in -# all of the `/cmake/Dependencies.cmake`_ and -# `//cmake/Dependencies.cmake`_ files and builds the -# package depenency graph varibles. -# -# This macro reads from the variables:: -# -# ${PROJECT_NAME}_ALL_REPOSITORIES (old) -# ${PROJECT_NAME}_PACKAGES (old) -# -# And writes to the variable: -# -# ${PROJECT_NAME}_SE_PACKAGES (old) -# -# as well creates the package dependency varaibles described in `List -# variables defining the package dependencies graph`_ that defines the -# directed acyclic depenency (DAG) package dependency graph (with navigation -# up and down the graph). -# -MACRO(TRIBITS_READ_PROJECT_AND_PACKAGE_DEPENDENCIES_CREATE_GRAPH_PRINT_DEPS) - - MESSAGE("") - MESSAGE("Processing Project, Repository, and Package dependency files and building internal dependencies graph ...") - MESSAGE("") - - TRIBITS_PROCESS_ALL_REPOSITORY_DEPENDENCY_SETUP_LOGIC() - - TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_LOGIC() - - TRIBITS_READ_ALL_PACKAGE_DEPS_AND_CREATE_DEPS_GRAPH() - - TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() - - TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() - -ENDMACRO() - - -# @MACRO: TRIBITS_PROCESS_ALL_REPOSITORY_DEPENDENCY_SETUP_LOGIC() -# -# Process any dependency logic at the repo level by loading -# `/cmake/RepositoryDependenciesSetup.cmake`_ files. -# -MACRO(TRIBITS_PROCESS_ALL_REPOSITORY_DEPENDENCY_SETUP_LOGIC) - FOREACH(TIBITS_REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) - TRIBITS_GET_REPO_NAME_DIR(${TIBITS_REPO} REPO_NAME REPO_DIR) - TRIBITS_SET_BASE_REPO_DIR(${PROJECT_SOURCE_DIR} ${REPO_DIR} BASE_REPO_DIR) - TRIBITS_GET_REPO_NAME(${TIBITS_REPO} REPOSITORY_NAME) - #PRINT_VAR(TIBITS_REPO) - #PRINT_VAR(REPO_NAME) - #PRINT_VAR(REPO_DIR) - #PRINT_VAR(REPOSITORY_NAME) - SET(REPO_DEPENDENCIES_SETUP_FILE - "${BASE_REPO_DIR}/cmake/RepositoryDependenciesSetup.cmake") - #PRINT_VAR(REPO_DEPENDENCIES_SETUP_FILE) - IF (EXISTS ${REPO_DEPENDENCIES_SETUP_FILE}) - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE - "${REPO_DEPENDENCIES_SETUP_FILE}") - INCLUDE(${REPO_DEPENDENCIES_SETUP_FILE}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${REPO_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) - PRINT_VAR(${REPO_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) - ENDIF() - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " - "The ${REPO_NAME} file ${REPO_DEPENDENCIES_SETUP_FILE} does not exist! ...") - ENDIF() - ENDIF() - ENDFOREACH() -ENDMACRO() - -# @MACRO: TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_LOGIC() -# -# Process any dependency logic at the project level by loading the -# `/cmake/ProjectDependenciesSetup.cmake`_ file -# -MACRO(TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_LOGIC) - SET(PROJECT_DEPENDENCIES_SETUP_FILE - "${PROJECT_SOURCE_DIR}/cmake/ProjectDependenciesSetup.cmake") - IF (EXISTS ${PROJECT_DEPENDENCIES_SETUP_FILE}) - TRIBITS_TRACE_FILE_PROCESSING(PROJECT INCLUDE - "${PROJECT_DEPENDENCIES_SETUP_FILE}") - INCLUDE(${PROJECT_DEPENDENCIES_SETUP_FILE}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) - PRINT_VAR(${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) - ENDIF() - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " - "The ${PROJECT_NAME} file ${PROJECT_DEPENDENCIES_SETUP_FILE} does not exist! ...") - ENDIF() - ENDIF() -ENDMACRO() - - -# @MACRO: TRIBITS_READ_ALL_PACKAGE_DEPS_AND_CREATE_DEPS_GRAPH() -# -# Usage:: -# -# TRIBITS_READ_ALL_PACKAGE_DEPS_AND_CREATE_DEPS_GRAPH() -# -# This macro reads in all of the `/cmake/Dependencies.cmake`_ and -# `//cmake/Dependencies.cmake`_ files for top-level -# packages and subpackages, respectively, and builds the package dependency -# graph variables. -# -# This macro reads from the variables:: -# -# ${PROJECT_NAME}_ALL_REPOSITORIES -# ${PROJECT_NAME}_PACKAGES (old) -# -# And writes to the variable:: -# -# ${PROJECT_NAME}_SE_PACKAGES (old) -# -# as well creates the package dependency variables described in `List -# variables defining the package dependencies graph`_ that defines the -# directed acyclic dependency (DAG) package dependency graph (with navigation -# up and down the graph). -# -MACRO(TRIBITS_READ_ALL_PACKAGE_DEPS_AND_CREATE_DEPS_GRAPH) - - SET(${PROJECT_NAME}_SE_PACKAGES) # Packages and subpackages - - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) - TRIBITS_READ_PACKAGE_DEPENDENCIES(${TRIBITS_PACKAGE} - ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) - ENDFOREACH() - - # Create a reverse SE packages list for later use - SET(${PROJECT_NAME}_REVERSE_SE_PACKAGES ${${PROJECT_NAME}_SE_PACKAGES}) - IF (${PROJECT_NAME}_REVERSE_SE_PACKAGES) - LIST(REVERSE ${PROJECT_NAME}_REVERSE_SE_PACKAGES) - ENDIF() - - LIST(LENGTH ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME}_NUM_SE_PACKAGES) - PRINT_VAR(${PROJECT_NAME}_NUM_SE_PACKAGES) - -ENDMACRO() - - -# @FUNCTION: TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() -# -# Usage:: -# -# TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() -# -# Function that print the set of tentatively enabled TPLs. -# -# Does **not** modify any state! -# -FUNCTION(TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS) - FOREACH(TPL ${${PROJECT_NAME}_TPLS}) - IF (TPL_TENTATIVE_ENABLE_${TPL}) - MESSAGE("-- Tentatively enabling TPL '${TPL}'") - #PRINT_VAR(TPL_ENABLE_${TPL}) - ENDIF() - ENDFOREACH() -ENDFUNCTION() - - -# @FUNCTION: TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() -# -# Usage: -# -# TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() -# -# Funtion that dumps (prints to STDOUT) the package dependency info if -# ``${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES==TRUE``. -# -# Does **not** modify state! -# -FUNCTION(TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO) - - ADVANCED_OPTION(${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES - "Dump the package dependency information." - "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) - - ADVANCED_OPTION(${PROJECT_NAME}_DUMP_FORWARD_PACKAGE_DEPENDENCIES - "Dump the package forwrad dependency information." - "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) - - IF (${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES) - MESSAGE("") - MESSAGE("Printing package dependencies ...") - MESSAGE("") - PRINT_NONEMPTY_VAR_WITH_SPACES(${PROJECT_NAME}_PACKAGES DUMMY_OUT) - MESSAGE("") - PRINT_NONEMPTY_VAR_WITH_SPACES(${PROJECT_NAME}_SE_PACKAGES DUMMY_OUT) - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) - TRIBITS_PRINT_PACKAGE_DEPENDENCIES(${TRIBITS_PACKAGE}) - MESSAGE("") - ENDFOREACH() - ENDIF() - -ENDFUNCTION() - - -# Function that sets a varaible to DECLARED-UNDEFINED -# -FUNCTION(TRIBITS_DECLARE_UNDEFINED VAR_NAME) - SET(${VAR_NAME} DECLARED-UNDEFINED PARENT_SCOPE) -ENDFUNCTION() - - -# Function that asserts that a package dependency variable is defined -# correctly -# -FUNCTION(TRIBITS_ASSERT_DEFINED_PACKAGE_VAR PACKAGE_VAR PACKAGE_NAME) - IF (${PACKAGE_VAR} STREQUAL DECLARED-UNDEFINED) - MESSAGE(FATAL_ERROR - "Error, the package variable ${PACKAGE_VAR} was not defined correctly for package ${PACKAGE_NAME}!" - ) - ENDIF() -ENDFUNCTION() - - # # Private helper macros # @@ -2293,162 +1080,6 @@ MACRO(TRIBITS_ENABLE_REQUIRED_TPLS PACKAGE_NAME) ENDMACRO() -# Get the list of explicitly enabled entries -# -# These is the list of entires in ${LISTVAR} for which: -# -# IF (${ENABLED_PREFIX}_ENABLE_{ENTRY}) -# -# evaluates to true. -# -FUNCTION(TRIBITS_GET_ENABLED_LIST LISTVAR ENABLED_PREFIX - ENABLED_LIST_OUT_OUT NUM_ENABLED_OUT_OUT - ) - SET(ENABLED_LIST_OUT) - FOREACH(ENTITY ${${LISTVAR}}) - SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) - ASSERT_DEFINED(${ENTITY_NAME}) - SET(INCLUDE_ENTITY FALSE) - IF (${ENTITY_NAME}) - LIST(APPEND ENABLED_LIST_OUT ${ENTITY}) - ENDIF() - ENDFOREACH() - LIST(LENGTH ENABLED_LIST_OUT NUM_ENABLED_OUT) - SET(${ENABLED_LIST_OUT_OUT} ${ENABLED_LIST_OUT} PARENT_SCOPE) - IF (NUM_ENABLED_OUT_OUT) - SET(${NUM_ENABLED_OUT_OUT} ${NUM_ENABLED_OUT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() - - -# Get the list non-disabled entries -# -# These is the list of entires in ${LISTVAR} for which: -# -# IF ( -# (${ENABLED_PREFIX}_ENABLE_{ENTRY}) -# OR -# (${ENABLED_PREFIX}_ENABLE_{ENTRY} STREQUAL "" ) -# ) -# -# evaluates to true. -# -FUNCTION(TRIBITS_GET_NONDISABLED_LIST LISTVAR ENABLED_PREFIX - NONDISABLED_LIST_OUT_OUT NUM_NONDISABLED_OUT_OUT - ) - SET(NONDISABLED_LIST_OUT) - FOREACH(ENTITY ${${LISTVAR}}) - SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) - ASSERT_DEFINED(${ENTITY_NAME}) - SET(INCLUDE_ENTITY FALSE) - IF (${ENTITY_NAME} OR ${ENTITY_NAME} STREQUAL "") - LIST(APPEND NONDISABLED_LIST_OUT ${ENTITY}) - ENDIF() - ENDFOREACH() - LIST(LENGTH NONDISABLED_LIST_OUT NUM_NONDISABLED_OUT) - SET(${NONDISABLED_LIST_OUT_OUT} ${NONDISABLED_LIST_OUT} PARENT_SCOPE) - IF (NUM_NONDISABLED_OUT_OUT) - SET(${NUM_NONDISABLED_OUT_OUT} ${NUM_NONDISABLED_OUT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() - - -# Get the list of explicitly disabled entries -# -# These is the list of entires in ${LISTVAR} for which: -# -# IF ( -# (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY}) -# AND -# (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY} STREQUAL "" ) -# ) -# -# evaluates to true. -# -FUNCTION(TRIBITS_GET_DISABLED_LIST LISTVAR ENABLED_PREFIX - DISABLED_LIST_OUT_OUT NUM_DISABLED_OUT_OUT - ) - SET(DISABLED_LIST_OUT) - FOREACH(ENTITY ${${LISTVAR}}) - SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) - ASSERT_DEFINED(${ENTITY_NAME}) - SET(INCLUDE_ENTITY FALSE) - IF ( (NOT ${ENTITY_NAME}) AND (NOT ${ENTITY_NAME} STREQUAL "") ) - LIST(APPEND DISABLED_LIST_OUT ${ENTITY}) - ENDIF() - ENDFOREACH() - LIST(LENGTH DISABLED_LIST_OUT NUM_DISABLED_OUT) - SET(${DISABLED_LIST_OUT_OUT} ${DISABLED_LIST_OUT} PARENT_SCOPE) - IF (NUM_DISABLED_OUT_OUT) - SET(${NUM_DISABLED_OUT_OUT} ${NUM_DISABLED_OUT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() - - -# Get the list of non-enabled entries -# -# These is the list of entires in ${LISTVAR} for which: -# -# IF (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY}) -# -# evaluates to true. -# -FUNCTION(TRIBITS_GET_NONENABLED_LIST LISTVAR ENABLED_PREFIX - NONENABLED_LIST_OUT_OUT NUM_NONENABLED_OUT_OUT - ) - SET(NONENABLED_LIST_OUT) - FOREACH(ENTITY ${${LISTVAR}}) - SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) - ASSERT_DEFINED(${ENTITY_NAME}) - SET(INCLUDE_ENTITY FALSE) - IF (NOT ${ENTITY_NAME}) # Note that empty "" is also false! - LIST(APPEND NONENABLED_LIST_OUT ${ENTITY}) - ENDIF() - ENDFOREACH() - LIST(LENGTH NONENABLED_LIST_OUT NUM_NONENABLED_OUT) - SET(${NONENABLED_LIST_OUT_OUT} ${NONENABLED_LIST_OUT} PARENT_SCOPE) - IF (NUM_NONENABLED_OUT_OUT) - SET(${NUM_NONENABLED_OUT_OUT} ${NUM_NONENABLED_OUT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() - - -# Macro that sets up the basic lists of enabled packages and SE packages. -# -MACRO(TRIBITS_SET_UP_ENABLED_LISTS_AND_SE_PKG_IDX) - - # ${PROJECT_NAME}_ENABLED_PACKAGES - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} - ${PROJECT_NAME}_ENABLED_PACKAGES ${PROJECT_NAME}_NUM_ENABLED_PACKAGES) - - # ${PROJECT_NAME}_ENABLED_SE_PACKAGES - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} - ${PROJECT_NAME}_ENABLED_SE_PACKAGES ${PROJECT_NAME}_NUM_ENABLED_SE_PACKAGES) - - # ${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES - SET(${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES - "${${PROJECT_NAME}_ENABLED_SE_PACKAGES}") - LIST(REVERSE ${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES) - - # ${PACKAGE_NAME}_SE_PKG_IDX - SET(SE_PKG_IDX 0) - FOREACH(TRIBITS_SE_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - SET(${TRIBITS_SE_PACKAGE}_SE_PKG_IDX ${SE_PKG_IDX}) - MATH(EXPR SE_PKG_IDX "${SE_PKG_IDX} + 1") - ENDFOREACH() - - # ${PROJECT_NAME}_ENABLED_TPLS - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_TPLS TPL - ${PROJECT_NAME}_ENABLED_TPLS ${PROJECT_NAME}_NUM_ENABLED_TPLS) - - # ${PROJECT_NAME}_REVERSE_ENABLED_TPLS - SET(${PROJECT_NAME}_REVERSE_ENABLED_TPLS - "${${PROJECT_NAME}_ENABLED_TPLS}") - LIST(REVERSE ${PROJECT_NAME}_REVERSE_ENABLED_TPLS) - -ENDMACRO() - - # @MACRO: TRIBITS_ADJUST_PACKAGE_ENABLES() # # Usage: diff --git a/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake b/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake index bed37213efed..c8655183849b 100644 --- a/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake +++ b/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake @@ -535,10 +535,7 @@ ENDFUNCTION() # FUNCTION(TRIBITS_DETERMINE_IF_CURRENT_PACKAGE_NEEDS_REBUILT) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(TIMER_START_SECONDS) - ENDIF() - + TRIBITS_CONFIG_CODE_START_TIMER(TIMER_START_SECONDS) # # A) Parse the input arguments @@ -703,11 +700,8 @@ FUNCTION(TRIBITS_DETERMINE_IF_CURRENT_PACKAGE_NEEDS_REBUILT) SET(${PARSE_CURRENT_PACKAGE_OUT_OF_DATE_OUT} ${CURRENT_PACKAGE_OUT_OF_DATE_OUT} PARENT_SCOPE) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(TIMER_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${TIMER_START_SECONDS} ${TIMER_STOP_SECONDS} - "\nTotal time to check for most recent modified files") - ENDIF() + TRIBITS_CONFIG_CODE_STOP_TIMER(TIMER_START_SECONDS + "\nTotal time to check for most recent modified files") ENDFUNCTION() diff --git a/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake b/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake index fe611a05c61f..219ff4016f6b 100644 --- a/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake @@ -43,11 +43,304 @@ INCLUDE(MessageWrapper) INCLUDE(TribitsSortListAccordingToMasterList) +# Optionally start CMake code configure timing # +FUNCTION(TRIBITS_CONFIG_CODE_START_TIMER START_TIMER_SECONDS_VAR_OUT) + IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) + TIMER_GET_RAW_SECONDS(START_TIMER_SECONDS) + SET(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) + ENDIF() +ENDFUNCTION() + + +# Optionally stop CMake code configure timing +# +FUNCTION(TRIBITS_CONFIG_CODE_STOP_TIMER START_TIMER_SECONDS_VAR_IN + TIMER_STR + ) + IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) + TIMER_GET_RAW_SECONDS(TIMER_STOP_SECONDS) + TIMER_PRINT_REL_TIME(${${START_TIMER_SECONDS_VAR_IN}} + ${TIMER_STOP_SECONDS} + "${TIMER_STR}") + ENDIF() +ENDFUNCTION() + + +# Optionally start CMake code **package** configure timing +# +FUNCTION(TRIBITS_PACKAGE_CONFIG_CODE_START_TIMER START_TIMER_SECONDS_VAR_OUT) + IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING + AND + ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING + OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) + ) + TIMER_GET_RAW_SECONDS(START_TIMER_SECONDS) + SET(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) + ENDIF() +ENDFUNCTION() + + +# Optionally stop CMake code **package** configure timing +# +FUNCTION(TRIBITS_PACKAGE_CONFIG_CODE_STOP_TIMER START_TIMER_SECONDS_VAR_IN + TIMER_STR + ) + IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING + AND + ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING + OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) + ) + TIMER_GET_RAW_SECONDS(TIMER_STOP_SECONDS) + TIMER_PRINT_REL_TIME(${${START_TIMER_SECONDS_VAR_IN}} + ${TIMER_STOP_SECONDS} + "${TIMER_STR}") + ENDIF() +ENDFUNCTION() + + +# Set the combined directory name taking into account '.' repos. +# +FUNCTION(TRIBITS_GET_REPO_NAME REPO_DIR REPO_NAME_OUT) + IF (REPO_DIR STREQUAL ".") + SET(REPO_NAME ${PROJECT_NAME}) + ELSE() + SET(REPO_NAME ${REPO_DIR}) + ENDIF() + SET(${REPO_NAME_OUT} "${REPO_NAME}" PARENT_SCOPE) +ENDFUNCTION() + + +# Get the REPO_NAME and REPO_DIR given the REPO +# +FUNCTION(TRIBITS_GET_REPO_NAME_DIR REPO_IN REPO_NAME_OUT REPO_DIR_OUT) + #MESSAGE("TRIBITS_GET_REPO_NAME_DIR: '${REPO_IN}' '${REPO_NAME_OUT}' '${REPO_DIR_OUT}'") + # This list of repositories is the list of directories! + SET(REPO_DIR ${REPO_IN}) + # Get the Repository name + IF (REPO_IN STREQUAL ".") + # The Project and the Reposiotry are one and the same + SET(REPO_NAME ${PROJECT_NAME}) + ELSE() + # The Repository name is the same as the repository directory + SET(REPO_NAME ${REPO_IN}) + ENDIF() + SET(${REPO_NAME_OUT} ${REPO_NAME} PARENT_SCOPE) + SET(${REPO_DIR_OUT} ${REPO_DIR} PARENT_SCOPE) +ENDFUNCTION() + + +# Set the combined directory name taking into account '.' repos. +# +FUNCTION(TRIBITS_SET_BASE_REPO_DIR BASE_DIR REPO_DIR BASE_REPO_DIR_OUT) + IF (REPO_DIR STREQUAL ".") + SET(REPO_DIR_STR "") + ELSE() + SET(REPO_DIR_STR "/${REPO_DIR}") + ENDIF() + SET(${BASE_REPO_DIR_OUT} "${BASE_DIR}${REPO_DIR_STR}" PARENT_SCOPE) +ENDFUNCTION() +# Get the list of explicitly enabled entries +# +# These is the list of entires in ${LISTVAR} for which: +# +# IF (${ENABLED_PREFIX}_ENABLE_{ENTRY}) +# +# evaluates to true. +# +FUNCTION(TRIBITS_GET_ENABLED_LIST LISTVAR ENABLED_PREFIX + ENABLED_LIST_OUT_OUT NUM_ENABLED_OUT_OUT + ) + SET(ENABLED_LIST_OUT) + FOREACH(ENTITY ${${LISTVAR}}) + SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) + ASSERT_DEFINED(${ENTITY_NAME}) + SET(INCLUDE_ENTITY FALSE) + IF (${ENTITY_NAME}) + LIST(APPEND ENABLED_LIST_OUT ${ENTITY}) + ENDIF() + ENDFOREACH() + LIST(LENGTH ENABLED_LIST_OUT NUM_ENABLED_OUT) + SET(${ENABLED_LIST_OUT_OUT} ${ENABLED_LIST_OUT} PARENT_SCOPE) + IF (NUM_ENABLED_OUT_OUT) + SET(${NUM_ENABLED_OUT_OUT} ${NUM_ENABLED_OUT} PARENT_SCOPE) + ENDIF() +ENDFUNCTION() + + +# Get the list non-disabled entries +# +# These is the list of entires in ${LISTVAR} for which: +# +# IF ( +# (${ENABLED_PREFIX}_ENABLE_{ENTRY}) +# OR +# (${ENABLED_PREFIX}_ENABLE_{ENTRY} STREQUAL "" ) +# ) +# +# evaluates to true. +# +FUNCTION(TRIBITS_GET_NONDISABLED_LIST LISTVAR ENABLED_PREFIX + NONDISABLED_LIST_OUT_OUT NUM_NONDISABLED_OUT_OUT + ) + SET(NONDISABLED_LIST_OUT) + FOREACH(ENTITY ${${LISTVAR}}) + SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) + ASSERT_DEFINED(${ENTITY_NAME}) + SET(INCLUDE_ENTITY FALSE) + IF (${ENTITY_NAME} OR ${ENTITY_NAME} STREQUAL "") + LIST(APPEND NONDISABLED_LIST_OUT ${ENTITY}) + ENDIF() + ENDFOREACH() + LIST(LENGTH NONDISABLED_LIST_OUT NUM_NONDISABLED_OUT) + SET(${NONDISABLED_LIST_OUT_OUT} ${NONDISABLED_LIST_OUT} PARENT_SCOPE) + IF (NUM_NONDISABLED_OUT_OUT) + SET(${NUM_NONDISABLED_OUT_OUT} ${NUM_NONDISABLED_OUT} PARENT_SCOPE) + ENDIF() +ENDFUNCTION() + + +# Get the list of explicitly disabled entries +# +# These is the list of entires in ${LISTVAR} for which: +# +# IF ( +# (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY}) +# AND +# (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY} STREQUAL "" ) +# ) +# +# evaluates to true. +# +FUNCTION(TRIBITS_GET_DISABLED_LIST LISTVAR ENABLED_PREFIX + DISABLED_LIST_OUT_OUT NUM_DISABLED_OUT_OUT + ) + SET(DISABLED_LIST_OUT) + FOREACH(ENTITY ${${LISTVAR}}) + SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) + ASSERT_DEFINED(${ENTITY_NAME}) + SET(INCLUDE_ENTITY FALSE) + IF ( (NOT ${ENTITY_NAME}) AND (NOT ${ENTITY_NAME} STREQUAL "") ) + LIST(APPEND DISABLED_LIST_OUT ${ENTITY}) + ENDIF() + ENDFOREACH() + LIST(LENGTH DISABLED_LIST_OUT NUM_DISABLED_OUT) + SET(${DISABLED_LIST_OUT_OUT} ${DISABLED_LIST_OUT} PARENT_SCOPE) + IF (NUM_DISABLED_OUT_OUT) + SET(${NUM_DISABLED_OUT_OUT} ${NUM_DISABLED_OUT} PARENT_SCOPE) + ENDIF() +ENDFUNCTION() + + +# Get the list of non-enabled entries +# +# These is the list of entires in ${LISTVAR} for which: +# +# IF (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY}) +# +# evaluates to true. +# +FUNCTION(TRIBITS_GET_NONENABLED_LIST LISTVAR ENABLED_PREFIX + NONENABLED_LIST_OUT_OUT NUM_NONENABLED_OUT_OUT + ) + SET(NONENABLED_LIST_OUT) + FOREACH(ENTITY ${${LISTVAR}}) + SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) + ASSERT_DEFINED(${ENTITY_NAME}) + SET(INCLUDE_ENTITY FALSE) + IF (NOT ${ENTITY_NAME}) # Note that empty "" is also false! + LIST(APPEND NONENABLED_LIST_OUT ${ENTITY}) + ENDIF() + ENDFOREACH() + LIST(LENGTH NONENABLED_LIST_OUT NUM_NONENABLED_OUT) + SET(${NONENABLED_LIST_OUT_OUT} ${NONENABLED_LIST_OUT} PARENT_SCOPE) + IF (NUM_NONENABLED_OUT_OUT) + SET(${NUM_NONENABLED_OUT_OUT} ${NUM_NONENABLED_OUT} PARENT_SCOPE) + ENDIF() +ENDFUNCTION() + + +# Macro that sets up the basic lists of enabled packages and SE packages. +# +MACRO(TRIBITS_SET_UP_ENABLED_LISTS_AND_SE_PKG_IDX) + + # ${PROJECT_NAME}_ENABLED_PACKAGES + TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} + ${PROJECT_NAME}_ENABLED_PACKAGES ${PROJECT_NAME}_NUM_ENABLED_PACKAGES) + + # ${PROJECT_NAME}_ENABLED_SE_PACKAGES + TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} + ${PROJECT_NAME}_ENABLED_SE_PACKAGES ${PROJECT_NAME}_NUM_ENABLED_SE_PACKAGES) + + # ${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES + SET(${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES + "${${PROJECT_NAME}_ENABLED_SE_PACKAGES}") + LIST(REVERSE ${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES) + + # ${PACKAGE_NAME}_SE_PKG_IDX + SET(SE_PKG_IDX 0) + FOREACH(TRIBITS_SE_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + SET(${TRIBITS_SE_PACKAGE}_SE_PKG_IDX ${SE_PKG_IDX}) + MATH(EXPR SE_PKG_IDX "${SE_PKG_IDX} + 1") + ENDFOREACH() + + # ${PROJECT_NAME}_ENABLED_TPLS + TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_TPLS TPL + ${PROJECT_NAME}_ENABLED_TPLS ${PROJECT_NAME}_NUM_ENABLED_TPLS) + + # ${PROJECT_NAME}_REVERSE_ENABLED_TPLS + SET(${PROJECT_NAME}_REVERSE_ENABLED_TPLS + "${${PROJECT_NAME}_ENABLED_TPLS}") + LIST(REVERSE ${PROJECT_NAME}_REVERSE_ENABLED_TPLS) + +ENDMACRO() + + +# @FUNCTION: TRIBITS_SET_ST_FOR_DEV_MODE() +# +# Function that allows packages to easily make a feature ``ST`` for +# development builds and ``PT`` for release builds by default. +# +# Usage:: +# +# TRIBITS_SET_ST_FOR_DEV_MODE() +# +# This function is typically called in a package's top-level +# `/CMakeLists.txt`_ file before defining other options for the +# package. The output variable ``${}`` is set to ``ON`` or ``OFF`` +# based on the configure state. In development mode +# (i.e. ``${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE==ON``), ``${}`` +# will be set to ``ON`` only if ``ST`` code is enabled +# (i.e. ``${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE==ON``), otherwise it is +# set to ``OFF``. In release mode +# (i.e. ``${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE==OFF``), ``${}`` +# is always set to ``ON``. This allows some parts of a TriBITS package to be +# considered ``ST`` for development mode (thereby reducing testing time by not +# enabling the dependent features/tests), while still having important +# functionality available to users by default in a release of the package. +# +FUNCTION(TRIBITS_SET_ST_FOR_DEV_MODE OUTPUT_VAR) + IF(${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE) + SET(OUTPUT_VAL ${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}) + ELSE() + SET(OUTPUT_VAL ON) + ENDIF() + SET(${OUTPUT_VAR} ${OUTPUT_VAL} PARENT_SCOPE) +ENDFUNCTION() + + +# For backward compatibility +MACRO(TRIBITS_SET_SS_FOR_DEV_MODE OUTPUT_VAR) + MESSAGE(WARNING + "WARNING: TRIBITS_SET_SS_FOR_DEV_MODE() is deprecated," + " use TRIBITS_SET_ST_FOR_DEV_MODE() instead!") + TRIBITS_SET_ST_FOR_DEV_MODE(${OUTPUT_VAR}) +ENDMACRO() + + # Function that extracts all of the required and optional # items for a given class of package lists # - FUNCTION( TRIBITS_GATHER_ENABLED_ITEMS PACKAGE_NAME LISTTYPE_PREFIX LISTTYPE_POSTFIX GATHERED_ITEMS_LIST_OUT ) @@ -79,7 +372,6 @@ FUNCTION( TRIBITS_GATHER_ENABLED_ITEMS PACKAGE_NAME LISTTYPE_PREFIX ENDFUNCTION() -# # Function that appends the Package/TPL include and library paths for given # list of enabled Packages/TPLs # @@ -89,12 +381,9 @@ ENDFUNCTION() # NOTE: The Packages/TPLs should be sorted in decending dependency order # before calling this function. # - # NOTE: Because this function may be called in cases where a package's # required subpackages are not actually enabled (e.g. SEACAS subpackages) - # - FUNCTION( TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS TPL_OR_PACKAGE PREFIX LIST EXTRA_DEP_LIBS_INOUT ) @@ -147,11 +436,9 @@ FUNCTION( TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS TPL_OR_PACKAGE PREFIX ENDFUNCTION() -# # Function that sorts and appends all the items in a dependency list for # packages or TPLs. # - FUNCTION( TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS TPL_OR_PACKAGE MASTER_SORT_LIST LIST PREFIX EXTRA_DEP_LIBS_INOUT @@ -187,12 +474,10 @@ FUNCTION( TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS ENDFUNCTION() -# # Fully process the include and link directories and list of libraries for a # package's list of dependent packages for use in creating a library or an # executable # - FUNCTION( TRIBITS_SORT_AND_APPEND_PACKAGE_INCLUDE_AND_LINK_DIRS_AND_LIBS PACKAGE_NAME LIB_OR_TEST_ARG EXTRA_DEP_LIBS_INOUT ) @@ -210,12 +495,10 @@ FUNCTION( TRIBITS_SORT_AND_APPEND_PACKAGE_INCLUDE_AND_LINK_DIRS_AND_LIBS ENDFUNCTION() -# # Fully process the include and link directories and list of libraries for a # package's list of dependent TPLs for use in creating a library or an # executable # - FUNCTION( TRIBITS_SORT_AND_APPEND_TPL_INCLUDE_AND_LINK_DIRS_AND_LIBS PACKAGE_NAME LIB_OR_TEST_ARG EXTRA_DEP_LIBS_INOUT ) @@ -233,7 +516,6 @@ FUNCTION( TRIBITS_SORT_AND_APPEND_TPL_INCLUDE_AND_LINK_DIRS_AND_LIBS ENDFUNCTION() -# # Print trace of file processing # FUNCTION(TRIBITS_TRACE_FILE_PROCESSING TYPE_IN PROCESSING_TYPE_IN FILE_PATH) @@ -272,10 +554,9 @@ FUNCTION(TRIBITS_TRACE_FILE_PROCESSING TYPE_IN PROCESSING_TYPE_IN FILE_PATH) ENDFUNCTION() -# + # Check to see if there are unparsed arguments after calling CMAKE_PARSE_ARGUMENTS # - MACRO(TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS) IF( NOT "${PARSE_UNPARSED_ARGUMENTS}" STREQUAL "") @@ -288,10 +569,9 @@ MACRO(TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS) ENDMACRO() -# + # Check that a parase argument has at least one value # - MACRO(TRIBITS_ASSERT_PARSE_ARG_ONE_OR_MORE_VALUES PREFIX ARGNAME) SET(PREFIX_ARGNAME "${PREFIX}_${ARGNAME}") LIST( LENGTH ${PREFIX_ARGNAME} ARG_NUM_VALS ) @@ -302,10 +582,10 @@ MACRO(TRIBITS_ASSERT_PARSE_ARG_ONE_OR_MORE_VALUES PREFIX ARGNAME) # NOTE: The return is needed in unit testing mode ENDIF() ENDMACRO() -# + + # Check that a parase argument has zero or one value # - MACRO(TRIBITS_ASSERT_PARSE_ARG_ZERO_OR_ONE_VALUE PREFIX ARGNAME) SET(PREFIX_ARGNAME "${PREFIX}_${ARGNAME}") IF (NOT "${${PREFIX_ARGNAME}}" STREQUAL "") @@ -317,4 +597,4 @@ MACRO(TRIBITS_ASSERT_PARSE_ARG_ZERO_OR_ONE_VALUE PREFIX ARGNAME) # NOTE: The return is needed in unit testing mode ENDIF() ENDIF() -ENDMACRO() \ No newline at end of file +ENDMACRO() diff --git a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake index b3e233510ce6..2bf5969da123 100644 --- a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -48,7 +48,8 @@ INCLUDE(TribitsProcessEnabledTpl) INCLUDE(TribitsInstallHeaders) INCLUDE(TribitsGetVersionDate) INCLUDE(TribitsReportInvalidTribitsUsage) -INCLUDE(TribitsReadPackagesProcessDepenenciesWriteXml) +INCLUDE(TribitsReadAllProjectDepsFilesCreateDepsGraph) +INCLUDE(TribitsAdjustPackageEnables) # Standard TriBITS utilities includes INCLUDE(TribitsAddOptionAndDefine) @@ -1552,9 +1553,7 @@ ENDFUNCTION() # MACRO(TRIBITS_ADJUST_AND_PRINT_PACKAGE_DEPENDENCIES) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(ADJUST_PACKAGE_DEPS_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(ADJUST_PACKAGE_DEPS_TIME_START_SECONDS) TRIBITS_PRINT_ENABLED_PACKAGE_LIST( "\nExplicitly enabled packages on input (by user)" ON FALSE) @@ -1586,12 +1585,8 @@ MACRO(TRIBITS_ADJUST_AND_PRINT_PACKAGE_DEPENDENCIES) TRIBITS_SET_UP_ENABLED_ONLY_DEPENDENCIES() - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(ADJUST_PACKAGE_DEPS_TIME_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${ADJUST_PACKAGE_DEPS_TIME_START_SECONDS} - ${ADJUST_PACKAGE_DEPS_TIME_STOP_SECONDS} - "\nTotal time to adjust package and TPL enables") - ENDIF() + TRIBITS_CONFIG_CODE_STOP_TIMER(ADJUST_PACKAGE_DEPS_TIME_START_SECONDS + "\nTotal time to adjust package and TPL enables") ENDMACRO() @@ -1602,9 +1597,7 @@ ENDMACRO() MACRO(TRIBITS_PROCESS_ENABLED_TPLS) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(CONFIGURE_TPLS_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(CONFIGURE_TPLS_TIME_START_SECONDS) FOREACH(TPL_NAME ${${PROJECT_NAME}_TPLS}) IF (TPL_ENABLE_${TPL_NAME}) @@ -1612,12 +1605,8 @@ MACRO(TRIBITS_PROCESS_ENABLED_TPLS) ENDIF() ENDFOREACH() - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(CONFIGURE_TPLS_TIME_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${CONFIGURE_TPLS_TIME_START_SECONDS} - ${CONFIGURE_TPLS_TIME_STOP_SECONDS} - "\nTotal time to configure enabled TPLs") - ENDIF() + TRIBITS_CONFIG_CODE_STOP_TIMER(CONFIGURE_TPLS_TIME_START_SECONDS + "\nTotal time to configure enabled TPLs") ENDMACRO() @@ -1629,9 +1618,7 @@ ENDMACRO() MACRO(TRIBITS_SETUP_ENV) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(SETUP_ENV_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(SETUP_ENV_TIME_START_SECONDS) IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) SET(TRIBITS_SETUP_ENV_DEBUG TRUE) @@ -1910,12 +1897,8 @@ MACRO(TRIBITS_SETUP_ENV) PRINT_VAR(CMAKE_CONFIGURATION_TYPES) ENDIF() - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(SETUP_ENV_TIME_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${SETUP_ENV_TIME_START_SECONDS} - ${SETUP_ENV_TIME_STOP_SECONDS} - "\nTotal time to probe and setup the environment") - ENDIF() + TRIBITS_CONFIG_CODE_STOP_TIMER(SETUP_ENV_TIME_START_SECONDS + "\nTotal time to probe and setup the environment") # Set ninja compile and link parallel job limits @@ -2243,9 +2226,7 @@ ENDFUNCTION() # MACRO(TRIBITS_CONFIGURE_ENABLED_PACKAGES) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(CONFIGURE_PACKAGES_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(CONFIGURE_PACKAGES_TIME_START_SECONDS) # # A) Global variable initialization @@ -2324,13 +2305,7 @@ MACRO(TRIBITS_CONFIGURE_ENABLED_PACKAGES) IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING - AND - ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING - OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) - ) - TIMER_GET_RAW_SECONDS(PROCESS_THIS_PACKAGE_TIME_START_SECONDS) - ENDIF() + TRIBITS_PACKAGE_CONFIG_CODE_START_TIMER(PROCESS_THIS_PACKAGE_TIME_START_SECONDS) SET(PACKAGE_NAME ${TRIBITS_PACKAGE}) # Used in CMake code in downstream package SET(PARENT_PACKAGE_NAME ${TRIBITS_PACKAGE}) @@ -2366,16 +2341,8 @@ MACRO(TRIBITS_CONFIGURE_ENABLED_PACKAGES) LIST(APPEND ${PROJECT_NAME}_LIBRARY_DIRS ${${TRIBITS_PACKAGE}_LIBRARY_DIRS}) LIST(APPEND ${PROJECT_NAME}_LIBRARIES ${${TRIBITS_PACKAGE}_LIBRARIES}) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING - AND - ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING - OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) - ) - TIMER_GET_RAW_SECONDS(PROCESS_THIS_PACKAGE_TIME_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${PROCESS_THIS_PACKAGE_TIME_START_SECONDS} - ${PROCESS_THIS_PACKAGE_TIME_STOP_SECONDS} - "-- Total time to configure package ${TRIBITS_PACKAGE}") - ENDIF() + TRIBITS_PACKAGE_CONFIG_CODE_STOP_TIMER(PROCESS_THIS_PACKAGE_TIME_START_SECONDS + "-- Total time to configure package ${TRIBITS_PACKAGE}") ENDIF() @@ -2402,29 +2369,17 @@ MACRO(TRIBITS_CONFIGURE_ENABLED_PACKAGES) LIST(REVERSE REVERSE_ETI_LIST) FOREACH(PACKAGE_NAME ${REVERSE_ETI_LIST}) MESSAGE("Processing ETI support: ${PACKAGE_NAME}") - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING - AND - ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING - OR ${PACKAGE_NAME}_PACKAGE_CONFIGURE_TIMING ) - ) - TIMER_GET_RAW_SECONDS(PROCESS_ETI_START_SECONDS) - ENDIF() - SET(ETIFILE ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/ExplicitInstantiationSupport.cmake) + TRIBITS_PACKAGE_CONFIG_CODE_START_TIMER(PROCESS_ETI_START_SECONDS) + SET(ETIFILE + ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/ExplicitInstantiationSupport.cmake) IF(NOT EXISTS "${ETIFILE}") - MESSAGE(FATAL_ERROR "Could not find ${PACKAGE_NAME} ETI support file ${ETIFILE}") + MESSAGE(FATAL_ERROR + "Could not find ${PACKAGE_NAME} ETI support file ${ETIFILE}") ENDIF() TRIBITS_TRACE_FILE_PROCESSING(PACKAGE INCLUDE "${ETIFILE}") INCLUDE("${ETIFILE}") - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING - AND - ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING - OR ${PACKAGE_NAME}_PACKAGE_CONFIGURE_TIMING ) - ) - TIMER_GET_RAW_SECONDS(PROCESS_ETI_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${PROCESS_ETI_START_SECONDS} - ${PROCESS_ETI_STOP_SECONDS} - "-- Time to process ETI support for package ${PACKAGE_NAME}") - ENDIF() + TRIBITS_PACKAGE_CONFIG_CODE_STOP_TIMER(PROCESS_ETI_START_SECONDS + "-- Time to process ETI support for package ${PACKAGE_NAME}") ENDFOREACH() ENDIF() @@ -2484,12 +2439,8 @@ MACRO(TRIBITS_CONFIGURE_ENABLED_PACKAGES) ENDIF() - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(CONFIGURE_PACKAGES_TIME_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${CONFIGURE_PACKAGES_TIME_START_SECONDS} - ${CONFIGURE_PACKAGES_TIME_STOP_SECONDS} - "\nTotal time to configure enabled packages") - ENDIF() + TRIBITS_CONFIG_CODE_STOP_TIMER(CONFIGURE_PACKAGES_TIME_START_SECONDS + "\nTotal time to configure enabled packages") ENDMACRO() @@ -2499,10 +2450,7 @@ ENDMACRO() # MACRO(TRIBITS_SETUP_PACKAGING_AND_DISTRIBUTION) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - # Start the global timer - TIMER_GET_RAW_SECONDS(CPACK_SETUP_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(CPACK_SETUP_TIME_START_SECONDS) # K.1) Run callback function for the base project. @@ -2639,11 +2587,8 @@ MACRO(TRIBITS_SETUP_PACKAGING_AND_DISTRIBUTION) # K.8) Finally process with CPack INCLUDE(CPack) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(CPACK_SETUP_TIME_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${CPACK_SETUP_TIME_START_SECONDS} ${CPACK_SETUP_TIME_STOP_SECONDS} - "Total time to set up for CPack packaging") - ENDIF() + TRIBITS_CONFIG_CODE_STOP_TIMER(CPACK_SETUP_TIME_START_SECONDS + "Total time to set up for CPack packaging") ENDMACRO() diff --git a/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake b/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake new file mode 100644 index 000000000000..3489ef1c61d1 --- /dev/null +++ b/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake @@ -0,0 +1,256 @@ +# @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 + +INCLUDE(TribitsGeneralMacros) + + +# @MACRO: TRIBITS_PACKAGE_DEFINE_DEPENDENCIES() +# +# Define the dependencies for a given `TriBITS SE Package`_ (i.e. a top-level +# `TriBITS Package`_ or a `TriBITS Subpackage`_) in the package's +# `/cmake/Dependencies.cmake`_ file. +# +# Usage:: +# +# TRIBITS_PACKAGE_DEFINE_DEPENDENCIES( +# [LIB_REQUIRED_PACKAGES ...] +# [LIB_OPTIONAL_PACKAGES ...] +# [TEST_REQUIRED_PACKAGES ...] +# [TEST_OPTIONAL_PACKAGES ...] +# [LIB_REQUIRED_TPLS ...] +# [LIB_OPTIONAL_TPLS ...] +# [TEST_REQUIRED_TPLS ...] +# [TEST_OPTIONAL_TPLS ...] +# [REGRESSION_EMAIL_LIST ] +# [SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS +# +# +# ... +# ] +# ) +# +# Every argument in this macro is optional (that is, an SE package can have no +# upstream dependencies). The arguments that apply to all SE packages are: +# +# ``LIB_REQUIRED_PACKAGES`` +# +# List of required upstream SE packages that must be enabled in order to +# build and use the libraries (or capabilities) in this SE package. +# +# ``LIB_OPTIONAL_PACKAGES`` +# +# List of additional optional upstream SE packages that can be used in +# this SE package if enabled. These upstream SE packages need not be +# enabled in order to enable this SE package but not enabling one or more +# of these optional upstream SE packages will result in diminished +# capabilities of this SE package. +# +# ``TEST_REQUIRED_PACKAGES`` +# +# List of additional upstream SE packages that must be enabled in order to +# build and/or run the tests and/or examples in this SE package. If any +# of these upstream SE packages are not enabled, then there will be no +# tests or examples defined or run for this SE package. +# +# ``TEST_OPTIONAL_PACKAGES`` +# +# List of additional optional upstream SE packages that can be used by the +# tests in this SE package. These upstream SE packages need not be +# enabled in order to run some basic tests or examples for this SE +# package. Typically, extra tests that depend on optional test SE +# packages involve integration testing of some type. +# +# ``LIB_REQUIRED_TPLS`` +# +# List of required upstream TPLs that must be enabled in order to build +# and use the libraries (or capabilities) in this SE package. +# +# ``LIB_OPTIONAL_TPLS`` +# +# List of additional optional upstream TPLs that can be used in this SE +# package if enabled. These upstream TPLs need not be enabled in order to +# use this SE package but not enabling one or more of these optional +# upstream TPLs will result in diminished capabilities of this SE package. +# +# ``TEST_REQUIRED_TPLS`` +# +# List of additional upstream TPLs that must be enabled in order to build +# and/or run the tests and/or examples in this SE package. If any of +# these upstream TPLs are not enabled, then there will be no tests or +# examples defined or run for this SE package. +# +# ``TEST_OPTIONAL_TPLS`` +# +# List of additional optional upstream TPLs that can be used by the tests +# in this SE package. These upstream TPLs need not be enabled in order to +# run basic tests for this SE package. Typically, extra tests that depend +# on optional TPLs involve integration testing or some additional testing +# of some type. +# +# Only upstream SE packages can be listed (as defined by the order the SE +# packages are listed in `TRIBITS_REPOSITORY_DEFINE_PACKAGES()`_ in the +# `/PackagesList.cmake`_ file). Otherwise an error will occur and +# processing will stop. Misspelled SE package names are caught as well. +# +# Only direct SE package dependencies need to be listed. Indirect SE package +# dependencies are automatically handled. For example, if this SE package +# directly depends on SE package ``PKG2`` which depends on SE package ``PKG1`` +# (but this SE package does not directly depend on anything in ``PKG1``) then +# this SE package only needs to list a dependency on ``PKG2``, not ``PKG1``. +# The dependency on ``PKG1`` will be taken care of automatically by the +# TriBITS dependency management system. +# +# However, currently, all TPL dependencies must be listed, even the indirect +# ones. This is a requirement that will be dropped in a future version of +# TriBITS. +# +# The SE packages listed in ``LIB_REQUIRED_PACKAGES`` are implicitly also +# dependencies in ``TEST_REQUIRED_PACKAGES``. Likewise +# ``LIB_OPTIONAL_PACKAGES`` are implicitly also dependencies in +# ``TEST_OPTIONAL_PACKAGES``. Same goes for TPL dependencies. +# +# The upstream dependencies within a single list do not need to be listed in +# any order. For example if ``PKG2`` depends on ``PKG1``, and this given SE +# package depends on both, then one can list:: +# +# LIB_REQUIRED_PACKAGES PKG2 PKG1 +# +# or:: +# +# "LIB_REQUIRED_PACKAGES PKG1 PKG2 +# +# Likewise the order that dependent TPLs are listed is not significant. +# +# If some upstream SE packages are allowed to be missing, this can be specified +# by calling the macro `TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES()`_. +# +# A top-level `TriBITS Package`_ can also be broken down into `TriBITS +# Subpackages`_. In this case, the following argument must be passed in: +# +# .. _SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS: +# +# ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` +# +# 2D array with rows listing the subpackages where each row has the +# columns: +# +# * **SUBPACKAGE** (Column 0): The name of the subpackage ````. +# The full SE package name is ``${PARENT_PACKAGE_NAME}``. +# The full SE package name is what is used in listing dependencies in +# other SE packages. +# +# * **DIRS** (Column 1): The subdirectory ```` relative to the +# parent package's base directory. All of the contents of the +# subpackage should be under this subdirectory. This is assumed by the +# TriBITS testing support software when mapping modified files to SE +# packages that need to be tested (see `checkin-test.py`_). +# +# * **CLASSIFICATIONS** (Column 2): The `Test Test Category`_ `PT`_, +# `ST`_, `EX`_ and the maturity level ``EP``, ``RS``, ``PG``, ``PM``, +# ``GRS``, ``GPG``, ``GPM``, and ``UM``, separated by a coma ',' with no +# spaces in between (e.g. ``"PT,GPM"``). These have exactly the same +# meaning as for full packages (see +# `TRIBITS_REPOSITORY_DEFINE_PACKAGES()`_). +# +# * **OPTREQ** (Column 3): Determines if the outer parent package has an +# ``OPTIONAL`` or ``REQUIRED`` dependence on this subpackage. +# +# Other variables that this macro handles: +# +# ``REGRESSION_EMAIL_LIST`` +# +# The email list that is used to send CDash error messages. If this +# argument is missing, then the email list that CDash errors go to is +# determined by other means (see `CDash regression email addresses`_). +# +# NOTE: All this macro really does is to just define the variables: +# +# * ``LIB_REQUIRED_DEP_PACKAGES`` +# * ``LIB_OPTIONAL_DEP_PACKAGES`` +# * ``TEST_REQUIRED_DEP_PACKAGES`` +# * ``TEST_OPTIONAL_DEP_PACKAGES`` +# * ``LIB_REQUIRED_DEP_TPLS`` +# * ``LIB_OPTIONAL_DEP_TPLS`` +# * ``TEST_REQUIRED_DEP_TPLS`` +# * ``TEST_OPTIONAL_DEP_TPLS`` +# * ``REGRESSION_EMAIL_LIST`` +# * ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` +# +# which are then read by the TriBITS cmake code to build the SE package +# dependency graph. The advantage of using this macro instead of just +# directly setting the variables is that an SE package only needs to list +# dependencies that exist. Otherwise, the ``Dependencies.cmake`` file will +# need to set all of the above local variables, even those that are empty. +# This is an error checking property of the TriBITS system to avoid misspelling +# the names of these variables. +# +MACRO(TRIBITS_PACKAGE_DEFINE_DEPENDENCIES) + + CMAKE_PARSE_ARGUMENTS( + #prefix + PARSE + #options + "" + #one_value_keywords + "" + #multi_value_keywords + "LIB_REQUIRED_PACKAGES;LIB_OPTIONAL_PACKAGES;TEST_REQUIRED_PACKAGES;TEST_OPTIONAL_PACKAGES;LIB_REQUIRED_TPLS;LIB_OPTIONAL_TPLS;TEST_REQUIRED_TPLS;TEST_OPTIONAL_TPLS;REGRESSION_EMAIL_LIST;SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS" + ${ARGN} + ) + + TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + + SET(LIB_REQUIRED_DEP_PACKAGES ${PARSE_LIB_REQUIRED_PACKAGES}) + SET(LIB_OPTIONAL_DEP_PACKAGES ${PARSE_LIB_OPTIONAL_PACKAGES}) + SET(TEST_REQUIRED_DEP_PACKAGES ${PARSE_TEST_REQUIRED_PACKAGES}) + SET(TEST_OPTIONAL_DEP_PACKAGES ${PARSE_TEST_OPTIONAL_PACKAGES}) + SET(LIB_REQUIRED_DEP_TPLS ${PARSE_LIB_REQUIRED_TPLS}) + SET(LIB_OPTIONAL_DEP_TPLS ${PARSE_LIB_OPTIONAL_TPLS}) + SET(TEST_REQUIRED_DEP_TPLS ${PARSE_TEST_REQUIRED_TPLS}) + SET(TEST_OPTIONAL_DEP_TPLS ${PARSE_TEST_OPTIONAL_TPLS}) + SET(REGRESSION_EMAIL_LIST ${PARSE_REGRESSION_EMAIL_LIST}) + SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS + ${PARSE_SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS}) + + # ToDo: + # * Assert that REGRESSION_EMAIL_LIST has only one entry + # * Assert that SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS is divisible + # by the number of columns! + +ENDMACRO() diff --git a/cmake/tribits/core/package_arch/TribitsPrintDependencyInfo.cmake b/cmake/tribits/core/package_arch/TribitsPrintDependencyInfo.cmake new file mode 100644 index 000000000000..408d7567e8d6 --- /dev/null +++ b/cmake/tribits/core/package_arch/TribitsPrintDependencyInfo.cmake @@ -0,0 +1,120 @@ +# @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 + + +# @FUNCTION: TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() +# +# Usage:: +# +# TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() +# +# Function that prints whatever initial dependency information that is +# available that is requested by the user after the initial construction of +# the package dependency graph but **before** the call of +# `TRIBITS_ADJUST_PACKAGE_ENABLES()`_. +# +# Calls: +# +# * `TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS()`_ +# * `TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO()`_ +# +FUNCTION(TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO) + TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() + TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() +ENDFUNCTION() + + +# @FUNCTION: TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() +# +# Usage:: +# +# TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() +# +# Function that print the set of tentatively enabled TPLs. +# +# Does **not** modify any state! +# +FUNCTION(TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS) + FOREACH(TPL ${${PROJECT_NAME}_TPLS}) + IF (TPL_TENTATIVE_ENABLE_${TPL}) + MESSAGE("-- Tentatively enabling TPL '${TPL}'") + #PRINT_VAR(TPL_ENABLE_${TPL}) + ENDIF() + ENDFOREACH() +ENDFUNCTION() + + +# @FUNCTION: TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() +# +# Usage: +# +# TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() +# +# Function that dumps (prints to STDOUT) the package dependency info if +# ``${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES==TRUE``. +# +# Does **not** modify state! +# +FUNCTION(TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO) + + ADVANCED_OPTION(${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES + "Dump the package dependency information." + "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) + + ADVANCED_OPTION(${PROJECT_NAME}_DUMP_FORWARD_PACKAGE_DEPENDENCIES + "Dump the package forward dependency information." + "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) + + IF (${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES) + MESSAGE("") + MESSAGE("Printing package dependencies ...") + MESSAGE("") + PRINT_NONEMPTY_VAR_WITH_SPACES(${PROJECT_NAME}_PACKAGES DUMMY_OUT) + MESSAGE("") + PRINT_NONEMPTY_VAR_WITH_SPACES(${PROJECT_NAME}_SE_PACKAGES DUMMY_OUT) + MESSAGE("") + FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) + TRIBITS_PRINT_PACKAGE_DEPENDENCIES(${TRIBITS_PACKAGE}) + MESSAGE("") + ENDFOREACH() + ENDIF() + +ENDFUNCTION() + +# LocalWords: TRIBITS diff --git a/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake b/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake index 902db1391391..6435cd7c95e7 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake @@ -53,7 +53,6 @@ INCLUDE(TribitsListHelpers) # -# # @MACRO: TRIBITS_REPOSITORY_DEFINE_PACKAGES() # # Define the set of packages for a given `TriBITS Repository`_. This macro is @@ -141,7 +140,6 @@ MACRO(TRIBITS_REPOSITORY_DEFINE_PACKAGES) ENDMACRO() -# # @FUNCTION: TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES() # # Allow listed packages to be missing and automatically excluded from the @@ -226,14 +224,12 @@ ENDFUNCTION() # -# # Macro that sets up standard user options a package # # On completion, the following variables are set: # # * ${PACKAGE_NAME_IN}_TESTGROUP: Set to PT, ST, or EX # - MACRO(TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS PACKAGE_NAME_IN PACKAGE_TESTGROUP_IN) IF (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) @@ -297,12 +293,10 @@ MACRO(TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS PACKAGE_NAME_IN PACKAGE_TESTGROU ENDMACRO() -# # Function that determines if a package is a primary meta-project package # according to the variables # ${PARENT_REPO_NAME}_NO_PRIMARY_META_PROJECT_PACKAGES[_EXCEPT]. # - FUNCTION(TRIBITS_IS_PRIMARY_META_PROJECT_PACKAGE PACKAGE_NAME_IN IS_PRIMARY_META_PROJECT_PACKAGE_OUT ) @@ -340,11 +334,9 @@ FUNCTION(TRIBITS_IS_PRIMARY_META_PROJECT_PACKAGE PACKAGE_NAME_IN ENDFUNCTION() -# # Function that determines if it is okay to allow an implicit package enable # based on its classification. # - FUNCTION(TRIBITS_IMPLICIT_PACKAGE_ENABLE_IS_ALLOWED UPSTREAM_PACKAGE_NAME_IN PACKAGE_NAME_IN IMPLICIT_PACKAGE_ENABLE_ALLOWED_OUT ) @@ -370,7 +362,6 @@ FUNCTION(TRIBITS_IMPLICIT_PACKAGE_ENABLE_IS_ALLOWED UPSTREAM_PACKAGE_NAME_IN ENDFUNCTION() -# # @MACRO: TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS() # # Usage:: @@ -403,6 +394,8 @@ ENDFUNCTION() # NOTE: Set TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE=TRUE to see really # verbose debug ouptut from this macro. # +# See `Function call tree for constructing package dependency graph`_ +# MACRO(TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS REPOSITORY_NAME REPOSITORY_DIR) IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) diff --git a/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake b/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake index cdc053cba197..4b087e97f668 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake @@ -121,7 +121,6 @@ MACRO(TRIBITS_REPOSITORY_DEFINE_TPLS) ENDMACRO() -# # @MACRO: TRIBITS_PROCESS_TPLS_LISTS() # # This macro that processes the project-level variable:: @@ -139,6 +138,8 @@ ENDMACRO() # ${TPL_NAME}_FINDMOD # ${TPL_NAME}_TESTGROUP # +# See `Function call tree for constructing package dependency graph`_ +# MACRO(TRIBITS_PROCESS_TPLS_LISTS REPOSITORY_NAME REPOSITORY_DIR) IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) diff --git a/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake b/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake index eae6208fbbcb..eadc0c81253d 100644 --- a/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake +++ b/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake @@ -43,7 +43,6 @@ # tribits implementation to use in {PROJECT_NAME}_TRIBITS_DIR. # - SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake @@ -67,6 +66,7 @@ INCLUDE(TribitsFindPythonInterp) INCLUDE(TribitsGlobalMacros) INCLUDE(TribitsConfigureCTestCustom) INCLUDE(TribitsGenerateResourceSpecFile) +INCLUDE(TribitsPrintDependencyInfo) INCLUDE(AdvancedSet) INCLUDE(AdvancedOption) @@ -130,9 +130,7 @@ MACRO(TRIBITS_PROJECT_IMPL) # Have to start timing after we read in the major options since that # determines the timing option var. - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(GLOBAL_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(GLOBAL_TIME_START_SECONDS) TRIBITS_READ_IN_NATIVE_REPOSITORIES() @@ -151,28 +149,19 @@ MACRO(TRIBITS_PROJECT_IMPL) TRIBITS_GENERATE_REPO_VERSION_OUTPUT_AND_FILE_AND_INSTALL() # Read in and process all of the project's package, TPL, listss and - # dependency definition files. The order these are read in are: - # - # * Read in all PackagesList.cmake and TPLsList.cmake files for all - # native and extra repos in repo order. - # * Process each repos's cmake/RepositoryDependenciesSetup.cmake file - # in repo order. - # * Process the project's cmake/cmake/ProjectDependenciesSetup.cmake - # * Process each package's Dependencies.cmake file. If a package a subpackages, - # The subpackage Dependencies.cmake files are read before setting up the - # parent package's dependenices. - # - TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML() + # dependency definition files. + TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() + TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() + TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED() # - # D) Apply dependency logic to enable and disable TriBITS packages packages - # and tests + # D) Apply dependency logic to enable and disable TriBITS packages and tests # TRIBITS_ADJUST_AND_PRINT_PACKAGE_DEPENDENCIES() # - # E) Stop after all dependencies handling is finished if asked. + # E) Stop after all dependencies handling is finished if asked # IF (${PROJECT_NAME}_SHORTCIRCUIT_AFTER_DEPENDENCY_HANDLING) @@ -268,19 +257,13 @@ MACRO(TRIBITS_PROJECT_IMPL) MESSAGE("Generating dummy makefiles in each directory to call Ninja ...") MESSAGE("") - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(NINJA_MAKEFILES_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(NINJA_MAKEFILES_TIME_START_SECONDS) INCLUDE(GenerateNinjaMakefiles) GENERATE_NINJA_MAKEFILES(${CMAKE_SOURCE_DIR}) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(NINJA_MAKEFILES_TIME_END_SECONDS) - TIMER_PRINT_REL_TIME(${NINJA_MAKEFILES_TIME_START_SECONDS} - ${NINJA_MAKEFILES_TIME_END_SECONDS} - "Total time generate Ninja makefiles ${PROJECT_NAME}") - ENDIF() + TRIBITS_CONFIG_CODE_STOP_TIMER(NINJA_MAKEFILES_TIME_START_SECONDS + "Total time generate Ninja makefiles ${PROJECT_NAME}") ELSE() @@ -334,11 +317,8 @@ MACRO(TRIBITS_PROJECT_IMPL) MESSAGE("") MESSAGE("Finished configuring ${PROJECT_NAME}!") MESSAGE("") - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(GLOBAL_TIME_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${GLOBAL_TIME_START_SECONDS} ${GLOBAL_TIME_STOP_SECONDS} - "Total time to configure ${PROJECT_NAME}") - ENDIF() + TRIBITS_CONFIG_CODE_STOP_TIMER(GLOBAL_TIME_START_SECONDS + "Total time to configure ${PROJECT_NAME}") ENDMACRO() diff --git a/cmake/tribits/core/package_arch/TribitsReadPackagesProcessDepenenciesWriteXml.cmake b/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake similarity index 92% rename from cmake/tribits/core/package_arch/TribitsReadPackagesProcessDepenenciesWriteXml.cmake rename to cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake index afbb7c3ccf08..e7cbb787c2bd 100644 --- a/cmake/tribits/core/package_arch/TribitsReadPackagesProcessDepenenciesWriteXml.cmake +++ b/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake @@ -43,17 +43,17 @@ INCLUDE(TribitsConstants) INCLUDE(TribitsProcessExtraRepositoriesList) INCLUDE(TribitsProcessPackagesAndDirsLists) INCLUDE(TribitsProcessTplsLists) -INCLUDE(TribitsAdjustPackageEnables) +INCLUDE(TribitsReadDepsFilesCreateDepsGraph) # Standard TriBITS utilities includes INCLUDE(TimingUtils) -# @MACRO: TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML() +# @MACRO: TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() # # Usage:: # -# TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML() +# TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() # # Macro run at the top project-level scope that reads in packages and TPLs, # process dependencies, and (optimally) writes XML files of dependency @@ -63,32 +63,18 @@ INCLUDE(TimingUtils) # data-structures described in `TriBITS System Data Structures and # Functions`_. # -MACRO(TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML) - - # - # A) Read in list of packages and package dependencies - # +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(SET_UP_DEPENDENCIES_TIME_START_SECONDS) - ENDIF() + TRIBITS_CONFIG_CODE_START_TIMER(SET_UP_DEPENDENCIES_TIME_START_SECONDS) TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS() - TRIBITS_READ_PROJECT_AND_PACKAGE_DEPENDENCIES_CREATE_GRAPH_PRINT_DEPS() + TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH() - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(SET_UP_DEPENDENCIES_TIME_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${SET_UP_DEPENDENCIES_TIME_START_SECONDS} - ${SET_UP_DEPENDENCIES_TIME_STOP_SECONDS} - "\nTotal time to read in and process all package dependencies") - ENDIF() - - # - # B) Dump dependnecy info as XML files if asked - # - - TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED() + TRIBITS_CONFIG_CODE_STOP_TIMER(SET_UP_DEPENDENCIES_TIME_START_SECONDS + "\nTotal time to read in all dependencies files and build dependencies graph") ENDMACRO() @@ -109,7 +95,6 @@ ENDMACRO() # ${PROJECT_NAME}_DEFINED_TPLS # ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES # ${PROJECT_NAME}_ALL_DEFINED_TOPLEVEL_PACKAGES -# ${PROJECT_NAME}_NUM_ALL_DEFINED_TOPLEVEL_PACKAGES # # ${PROJECT_NAME}_NUM_DEFINED_TPLS # ${PROJECT_NAME}_NUM_DEFINED_INTERNAL_PACKAGES @@ -132,6 +117,8 @@ ENDMACRO() # # which set their varaibles. # +# See `Function call tree for constructing package dependency graph`_ +# MACRO(TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS) TRIBITS_SET_ALL_EXTRA_REPOSITORIES() @@ -247,14 +234,22 @@ MACRO(TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS) ENDMACRO() +# @FUNCTION: TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED() +# +# Usage:: +# +# TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED() +# # Function that writes XML dependnecy files if support for that exists in this -# installation of TriBITS. +# instance of TriBITs. +# +# See `Function call tree for constructing package dependency graph`_ # FUNCTION(TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED) SET(TRIBITS_PROJECT_CI_SUPPORT_DIR "${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CI_SUPPORT_DIR}") SET(TRIBITS_DUMP_XML_DEPS_MODULE - "${TRIBITS_PROJECT_CI_SUPPORT_DIR}/TribitsDumpXmlDependenciesFiles.cmake") + "${TRIBITS_PROJECT_CI_SUPPORT_DIR}/TribitsWriteXmlDependenciesFiles.cmake") IF (EXISTS "${TRIBITS_DUMP_XML_DEPS_MODULE}") INCLUDE(${TRIBITS_DUMP_XML_DEPS_MODULE}) TRIBITS_WRITE_XML_DEPENDENCY_FILES() diff --git a/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake b/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake new file mode 100644 index 000000000000..c778c4054d10 --- /dev/null +++ b/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake @@ -0,0 +1,943 @@ +# @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 + +INCLUDE(TribitsPackageDefineDependencies) +INCLUDE(SetDefault) +INCLUDE(DualScopeSet) + +# @MACRO: TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH() +# +# Usage:: +# +# TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH() +# +# This macro reads of all the package dependencies and builds the package +# dependency graph. This first executes the logic in the files +# `/cmake/RepositoryDependenciesSetup.cmake`_ (for each TriBITS repo) +# and `/cmake/ProjectDependenciesSetup.cmake`_ and then reads in +# all of the `/cmake/Dependencies.cmake`_ and +# `//cmake/Dependencies.cmake`_ files and builds the +# package depenency graph varibles. +# +# This macro reads from the variables:: +# +# ${PROJECT_NAME}_ALL_REPOSITORIES (old) +# ${PROJECT_NAME}_PACKAGES (old) +# +# and writes to the variable:: +# +# ${PROJECT_NAME}_SE_PACKAGES (old) +# +# as well creates the package dependency varaibles described in `List +# variables defining the package dependencies graph`_ that defines the +# directed acyclic depenency (DAG) package dependency graph (with navigation +# up and down the graph). +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH) + + MESSAGE("") + MESSAGE("Processing Project, Repository, and Package dependency files and building internal dependencies graph ...") + MESSAGE("") + + TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES() + + TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE() + + TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH() + +ENDMACRO() + + +# @MACRO: TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES() +# +# Process any dependency logic at the repo level by loading +# `/cmake/RepositoryDependenciesSetup.cmake`_ files. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES) + FOREACH(TIBITS_REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) + TRIBITS_GET_REPO_NAME_DIR(${TIBITS_REPO} REPO_NAME REPO_DIR) + TRIBITS_SET_BASE_REPO_DIR(${PROJECT_SOURCE_DIR} ${REPO_DIR} BASE_REPO_DIR) + TRIBITS_GET_REPO_NAME(${TIBITS_REPO} REPOSITORY_NAME) + #PRINT_VAR(TIBITS_REPO) + #PRINT_VAR(REPO_NAME) + #PRINT_VAR(REPO_DIR) + #PRINT_VAR(REPOSITORY_NAME) + SET(REPO_DEPENDENCIES_SETUP_FILE + "${BASE_REPO_DIR}/cmake/RepositoryDependenciesSetup.cmake") + #PRINT_VAR(REPO_DEPENDENCIES_SETUP_FILE) + IF (EXISTS ${REPO_DEPENDENCIES_SETUP_FILE}) + TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE + "${REPO_DEPENDENCIES_SETUP_FILE}") + INCLUDE(${REPO_DEPENDENCIES_SETUP_FILE}) + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + PRINT_VAR(${REPO_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) + PRINT_VAR(${REPO_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) + ENDIF() + ELSE() + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + MESSAGE("-- " + "The ${REPO_NAME} file ${REPO_DEPENDENCIES_SETUP_FILE} does not exist! ...") + ENDIF() + ENDIF() + ENDFOREACH() +ENDMACRO() + + +# @MACRO: TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE() +# +# Process any dependency logic at the project level by loading the +# `/cmake/ProjectDependenciesSetup.cmake`_ file +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE) + SET(PROJECT_DEPENDENCIES_SETUP_FILE + "${PROJECT_SOURCE_DIR}/cmake/ProjectDependenciesSetup.cmake") + IF (EXISTS ${PROJECT_DEPENDENCIES_SETUP_FILE}) + TRIBITS_TRACE_FILE_PROCESSING(PROJECT INCLUDE + "${PROJECT_DEPENDENCIES_SETUP_FILE}") + INCLUDE(${PROJECT_DEPENDENCIES_SETUP_FILE}) + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + PRINT_VAR(${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) + PRINT_VAR(${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) + ENDIF() + ELSE() + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + MESSAGE("-- " + "The ${PROJECT_NAME} file ${PROJECT_DEPENDENCIES_SETUP_FILE} does not exist! ...") + ENDIF() + ENDIF() +ENDMACRO() + + +# @MACRO: TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH() +# +# Usage:: +# +# TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH() +# +# This macro reads in all of the `/cmake/Dependencies.cmake`_ and +# `//cmake/Dependencies.cmake`_ files for top-level +# packages and subpackages, respectively, and builds the package dependency +# graph variables. +# +# This macro reads from the variables:: +# +# ${PROJECT_NAME}_ALL_REPOSITORIES +# ${PROJECT_NAME}_PACKAGES (old) +# +# And writes to the variable:: +# +# ${PROJECT_NAME}_SE_PACKAGES (old) +# +# as well creates the package dependency variables described in `List +# variables defining the package dependencies graph`_ that defines the +# directed acyclic dependency (DAG) package dependency graph (with navigation +# up and down the graph). +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH) + + SET(${PROJECT_NAME}_SE_PACKAGES) # Packages and subpackages + + FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) + TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH(${TRIBITS_PACKAGE} + ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) + ENDFOREACH() + + # Create a reverse SE packages list for later use + SET(${PROJECT_NAME}_REVERSE_SE_PACKAGES ${${PROJECT_NAME}_SE_PACKAGES}) + IF (${PROJECT_NAME}_REVERSE_SE_PACKAGES) + LIST(REVERSE ${PROJECT_NAME}_REVERSE_SE_PACKAGES) + ENDIF() + + LIST(LENGTH ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME}_NUM_SE_PACKAGES) + PRINT_VAR(${PROJECT_NAME}_NUM_SE_PACKAGES) + +ENDMACRO() + + +# @MACRO: TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH() +# +# Usage:: +# +# TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH() +# +# Macro that reads in package dependencies for a top-level package from the +# file `/cmake/Dependencies.cmake`_ and appends the forward +# dependencies list vars for packages already read in for this package +# ````. +# +# Modifies the global variables:: +# +# ${PACKAGE_NAME}_LIB_REQUIRED_DEP_PACKAGES +# ${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES +# ${PACKAGE_NAME}_TEST_REQUIRED_DEP_PACKAGES +# ${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES +# ${PACKAGE_NAME}_FORWARD_LIB_REQUIRED_DEP_PACKAGES +# ${PACKAGE_NAME}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES +# ${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES +# ${PACKAGE_NAME}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES +# +# It also appends the list varaible:: +# +# ${PROJECT_NAME}_SE_PACKAGES (old) +# +# as for the subpackage dependencies under this top-level package are read in +# order and then this top-level package is appended and dependencies are +# dependencies are created for them. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH PACKAGE_NAME) + + # A) Get ready to read in the contents of this this pakages's Dependencies.cmake file + + TRIBITS_PREP_TO_READ_DEPENDENCIES(${PACKAGE_NAME}) + + # Listing of subpakages + SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) # Allow to be empty + + # B) Read in this package's Dependencies file and save off read dependency vars. + + SET(PACKAGE_DEPENDENCIES_FILE + "${PROJECT_SOURCE_DIR}/${${PACKAGE_NAME}_REL_SOURCE_DIR}/cmake/Dependencies.cmake") + + TRIBITS_TRACE_FILE_PROCESSING(PACKAGE INCLUDE "${PACKAGE_DEPENDENCIES_FILE}") + INCLUDE(${PACKAGE_DEPENDENCIES_FILE}) + + TRIBITS_ASSERT_READ_DEPENDENCY_VARS(${PACKAGE_NAME}) + + TRIBITS_SAVE_OFF_DEPENDENCIES_VARS(PARENTPACK) + + # B.1) Set up the mail addresses (one regression email list for the package + # and all subpackages) + + TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST(${PACKAGE_NAME}) + + # B.2) Process this package's subpackages first *before* finishing this packages! + + TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS(${PACKAGE_NAME}) + + TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH(${PACKAGE_NAME}) + + # C) Finish processing this package's dependencies into dependency graph vars + # + # NOTE: The subpackages for this package are automatically treated as + # optional or required library dependent packages for this outer package! + + TRIBITS_READ_BACK_DEPENDENCIES_VARS(PARENTPACK) + + # Append the subpackages to the dependencies list if this top-level package + SET(SUBPACKAGE_IDX 0) + FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) + SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + LIST(GET ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_IDX} SUBPACKAGE_OPTREQ) + LIST(APPEND LIB_${SUBPACKAGE_OPTREQ}_DEP_PACKAGES ${SUBPACKAGE_FULLNAME}) + MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") + ENDFOREACH() + + # Append this package to list of SE packages *after* subpackages are added! + LIST(APPEND ${PROJECT_NAME}_SE_PACKAGES ${PACKAGE_NAME}) + + # Process this parent package's dependency lists! + TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS(${PACKAGE_NAME}) + +ENDMACRO() + + +################################################################################ +# Helper macros for reading in and processing dependency lists from a single +# Dependencies.cmake file. +################################################################################ + + +# @MACRO: TRIBITS_PREP_TO_READ_DEPENDENCIES() +# +# Usage:: +# +# TRIBITS_PREP_TO_READ_DEPENDENCIES() +# +# Macro that sets to undefined all of the variables that must be set by the +# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ macro. +# +# It also sets to empty the forward dependency list vars:: +# +# _FORWARD_ +# +# for each of the forward/downstream in `List variables defining the package +# dependencies graph`_. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_PREP_TO_READ_DEPENDENCIES PACKAGE_NAME_IN) + + TRIBITS_DECLARE_UNDEFINED(LIB_REQUIRED_DEP_PACKAGES) + TRIBITS_DECLARE_UNDEFINED(LIB_OPTIONAL_DEP_PACKAGES) + TRIBITS_DECLARE_UNDEFINED(TEST_REQUIRED_DEP_PACKAGES) + TRIBITS_DECLARE_UNDEFINED(TEST_OPTIONAL_DEP_PACKAGES) + + TRIBITS_DECLARE_UNDEFINED(LIB_REQUIRED_DEP_TPLS "") + TRIBITS_DECLARE_UNDEFINED(LIB_OPTIONAL_DEP_TPLS "") + TRIBITS_DECLARE_UNDEFINED(TEST_REQUIRED_DEP_TPLS "") + TRIBITS_DECLARE_UNDEFINED(TEST_OPTIONAL_DEP_TPLS "") + + SET(REGRESSION_EMAIL_LIST "") # Allow to be empty + + SET(${PACKAGE_NAME_IN}_FORWARD_LIB_REQUIRED_DEP_PACKAGES "") + SET(${PACKAGE_NAME_IN}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES "") + SET(${PACKAGE_NAME_IN}_FORWARD_TEST_REQUIRED_DEP_PACKAGES "") + SET(${PACKAGE_NAME_IN}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES "") + +ENDMACRO() + + +# @MACRO: TRIBITS_ASSERT_READ_DEPENDENCY_VARS() +# +# Usage:: +# +# TRIBITS_ASSERT_READ_DEPENDENCY_VARS() +# +# Assert that all of the required variables set by the function +# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ in the file +# `/cmake/Dependencies.cmake`_ have been set. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_ASSERT_READ_DEPENDENCY_VARS PACKAGE_NAME) + + TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) + TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) + TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) + TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) + + TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) + TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) + TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) + TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) + +ENDMACRO() + + +# @MACRO: TRIBITS_SAVE_OFF_DEPENDENCIES_VARS() +# +# Usage:: +# +# TRIBITS_SAVE_OFF_DEPENDENCIES_VARS() +# +# Saves off package depeneency varaibles with variable suffix ``_``. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_SAVE_OFF_DEPENDENCIES_VARS POSTFIX) + + SET(LIB_REQUIRED_DEP_PACKAGES_${POSTFIX} ${LIB_REQUIRED_DEP_PACKAGES}) + SET(LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${LIB_OPTIONAL_DEP_PACKAGES}) + SET(TEST_REQUIRED_DEP_PACKAGES_${POSTFIX} ${TEST_REQUIRED_DEP_PACKAGES}) + SET(TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${TEST_OPTIONAL_DEP_PACKAGES}) + + SET(LIB_REQUIRED_DEP_TPLS_${POSTFIX} ${LIB_REQUIRED_DEP_TPLS}) + SET(LIB_OPTIONAL_DEP_TPLS_${POSTFIX} ${LIB_OPTIONAL_DEP_TPLS}) + SET(TEST_REQUIRED_DEP_TPLS_${POSTFIX} ${TEST_REQUIRED_DEP_TPLS}) + SET(TEST_OPTIONAL_DEP_TPLS_${POSTFIX} ${TEST_OPTIONAL_DEP_TPLS}) + +ENDMACRO() + + +# @MACRO: TRIBITS_READ_BACK_DEPENDENCIES_VARS() +# +# Usage:: +# +# TRIBITS_READ_BACK_DEPENDENCIES_VARS() +# +# Read back the local package dependency vars from the saved-off vars with +# suffix ``_``. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_READ_BACK_DEPENDENCIES_VARS POSTFIX) + + SET(LIB_REQUIRED_DEP_PACKAGES ${LIB_REQUIRED_DEP_PACKAGES_${POSTFIX}}) + SET(LIB_OPTIONAL_DEP_PACKAGES ${LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) + SET(TEST_REQUIRED_DEP_PACKAGES ${TEST_REQUIRED_DEP_PACKAGES_${POSTFIX}}) + SET(TEST_OPTIONAL_DEP_PACKAGES ${TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) + + SET(LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS_${POSTFIX}}) + SET(LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS_${POSTFIX}}) + SET(TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS_${POSTFIX}}) + SET(TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS_${POSTFIX}}) + +ENDMACRO() + + +# @MACRO: TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS() +# +# Usage:: +# +# TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS() +# +# Sets up the upstsream and downstream/forward package dependency list +# varaibles for ```` descrdibed in `List variables defining the +# package dependencies graph`_. Note that the downstream/forward dependencies +# of upstream packages on this package ```` are built up +# incrimentally. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS PACKAGE_NAME) + + TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} LIB REQUIRED) + TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} LIB OPTIONAL) + TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} TEST REQUIRED) + TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} TEST OPTIONAL) + + SET(${PACKAGE_NAME}_LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS}) + SET(${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS}) + SET(${PACKAGE_NAME}_TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS}) + SET(${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS}) + + TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} LIB_REQUIRED_DEP_PACKAGES) + TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} LIB_OPTIONAL_DEP_PACKAGES) + TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} TEST_REQUIRED_DEP_PACKAGES) + TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} TEST_OPTIONAL_DEP_PACKAGES) + +ENDMACRO() + + +# @FUNCTION: TRIBITS_SET_DEP_PACKAGES() +# +# Usage:: +# +# TRIBITS_SET_DEP_PACKAGES( LIB|TEST REQUIRED|OPTIONAL) +# +# Function that helps to set up backward package dependency lists for a given +# package given the vars read in from the macro +# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_. +# +# Sets the upstream/backward dependency variables defined in the section `List +# variables defining the package dependencies graph`_. +# +# This also handles the several types of issues: +# +# * A package declaring a dependency on itself +# (`TRIBITS_ABORT_ON_SELF_DEP()`_). +# +# * A missing upstream dependent package (either error out with +# `TRIBITS_ABORT_ON_MISSING_PACKAGE()`_ or allow to be missing and disable +# this package if this is a required dependency). +# +# See `Function call tree for constructing package dependency graph`_ +# +FUNCTION(TRIBITS_SET_DEP_PACKAGES PACKAGE_NAME LIB_OR_TEST REQUIRED_OR_OPTIONAL) + + IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) + MESSAGE("\nTRIBITS_SET_DEP_PACKAGES: ${PACKAGE_NAME} ${LIB_OR_TEST} ${REQUIRED_OR_OPTIONAL})") + ENDIF() + + SET(LIST_TYPE ${LIB_OR_TEST}_${REQUIRED_OR_OPTIONAL}_DEP_PACKAGES) + SET(PACKAGE_DEPS_LIST) + SET(SE_PACKAGE_ENABLE_VAR ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + + FOREACH(DEP_PKG ${${LIST_TYPE}}) + IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) + PRINT_VAR(DEP_PKG) + ENDIF() + IF (${DEP_PKG} STREQUAL ${PACKAGE_NAME}) + TRIBITS_ABORT_ON_SELF_DEP("${PACKAGE_NAME}" "${LIST_TYPE}") + ENDIF() + IF (${DEP_PKG}_SOURCE_DIR) + SET(DEP_PKG_DEFINED_AND_EXISTS TRUE) + ELSE() + SET(DEP_PKG_DEFINED_AND_EXISTS FALSE) + ENDIF() + IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) + PRINT_VAR(DEP_PKG_DEFINED_AND_EXISTS) + ENDIF() + IF (DEP_PKG_DEFINED_AND_EXISTS) + LIST(APPEND PACKAGE_DEPS_LIST ${DEP_PKG}) + ELSE() + IF (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES + AND NOT ${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE + ) + TRIBITS_ABORT_ON_MISSING_PACKAGE( + "${DEP_PKG}" "${PACKAGE_NAME}" "${PROJECT_NAME}_SE_PACKAGES") + ELSE() + IF (${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE) + IF (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES) + MESSAGE_WRAPPER("NOTE: ${DEP_PKG} is being ignored since its directory" + " is missing and ${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE =" + " ${${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE}!") + ENDIF() + IF (REQUIRED_OR_OPTIONAL STREQUAL "REQUIRED") + MESSAGE_WRAPPER("NOTE: Setting ${SE_PACKAGE_ENABLE_VAR}=OFF because" + " package ${PACKAGE_NAME} has a required dependency on missing" + " package ${DEP_PKG}!") + DUAL_SCOPE_SET(${SE_PACKAGE_ENABLE_VAR} OFF) + ENDIF() + ENDIF() + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + MESSAGE( + "\n***" + "\n*** NOTE: The package ${DEP_PKG} which is a dependent package of" + " ${PACKAGE_NAME} being ignored because ${DEP_PKG} is missing!" + "\n***\n" ) + 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. + DUAL_SCOPE_SET(${PROJECT_NAME}_ENABLE_${DEP_PKG} OFF) + DUAL_SCOPE_SET(${PACKAGE_NAME}_ENABLE_${DEP_PKG} OFF) + ENDIF() + ENDIF() + ENDFOREACH() + + #PRINT_VAR(PACKAGE_DEPS_LIST) + + GLOBAL_SET(${PACKAGE_NAME}_${LIST_TYPE} ${PACKAGE_DEPS_LIST}) + +ENDFUNCTION() + + +# @FUNCTION: TRIBITS_APPEND_FORWARD_DEP_PACKAGES() +# +# Usage: TRIBITS_APPEND_FORWARD_DEP_PACKAGES( ) +# +# Function that helps to set up forward package dependency lists for an +# upstream package given that a downstream package declared a dependency on +# it. In particular, it appends the var:: +# +# _FORWARD_ +# +# for one of the vars listed in `List variables defining the package +# dependencies graph`_. +# +# This function is called multiple times to build up the forward package +# dependencies for a given ```` by the downstream packages that +# declare dependencies on it. +# +# See `Function call tree for constructing package dependency graph`_ +# +FUNCTION(TRIBITS_APPEND_FORWARD_DEP_PACKAGES PACKAGE_NAME LIST_TYPE) + + SET(DEP_PKG_LIST_NAME "${PACKAGE_NAME}_${LIST_TYPE}") + + ASSERT_DEFINED(${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + FOREACH(DEP_PKG ${${DEP_PKG_LIST_NAME}}) + SET(FWD_DEP_PKG_LIST_NAME "${DEP_PKG}_FORWARD_${LIST_TYPE}") + IF (NOT DEFINED ${FWD_DEP_PKG_LIST_NAME}) + IF (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + TRIBITS_ABORT_ON_MISSING_PACKAGE(${DEP_PKG} ${PACKAGE_NAME} ${DEP_PKG_LIST_NAME}) + ELSE() + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + MESSAGE( + "\n***" + "\n*** NOTE: The package ${DEP_PKG} has forward dependent package" + " ${PACKAGE_NAME}, but that dependency is being ignored because the package" + " ${DEP_PKG} is missing!" + "\n***\n" ) + ENDIF() + ENDIF() + ELSE() + SET(${FWD_DEP_PKG_LIST_NAME} ${${FWD_DEP_PKG_LIST_NAME}} ${PACKAGE_NAME} + PARENT_SCOPE) + ENDIF() + ENDFOREACH() + +ENDFUNCTION() + + +# @MACRO: TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST() +# +# Usage:: +# +# TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST() +# +# Macro that sets a pacakge's regression email address +# ``${PACKAGE_NAME}_REGRESSION_EMAIL_LIST`` as described in ???. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST PACKAGE_NAME) + + # Lower-case package name To be used with auto email naming based on base email address + STRING(TOLOWER "${PACKAGE_NAME}" LPACKAGE) + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + PRINT_VAR(REGRESSION_EMAIL_LIST) + ENDIF() + + TRIBITS_GET_REPO_NAME(${${PACKAGE_NAME}_PARENT_REPOSITORY} REPOSITORY_NAME) + #PRINT_VAR(REPOSITORY_NAME) + + IF(${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST) + SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + ${${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST}) + ELSEIF (REGRESSION_EMAIL_LIST) + SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST ${REGRESSION_EMAIL_LIST}) + ELSEIF (${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) + SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + "${LPACKAGE}-regression@${${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE}") + ELSEIF (${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) + SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + "${${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS}") + ELSEIF (${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) + SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + "${LPACKAGE}-regression@${${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE}") + ELSEIF (${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) + SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + "${${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS}") + ELSE() + SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "") + ENDIF() + + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + PRINT_VAR(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST) + ENDIF() + +ENDMACRO() + + +# @FUNCTION: TRIBITS_ABORT_ON_MISSING_PACKAGE() +# +# Usage:: +# +# TRIBITS_ABORT_ON_MISSING_PACKAGE( ) +# +# Function that creates error message about missing/misspelled package. This +# error message also suggests that the package might be defining an upstream +# dependency on a downstream dependency (i.e. a circular dependency). +# +# See `Function call tree for constructing package dependency graph`_ +# +FUNCTION(TRIBITS_ABORT_ON_MISSING_PACKAGE DEP_PKG PACKAGE_NAME DEP_PKG_LIST_NAME) + MULTILINE_SET(ERRMSG + "Error, the package '${DEP_PKG}' is listed as a dependency of the package" + " '${PACKAGE_NAME}' is in the list '${DEP_PKG_LIST_NAME}' but the package" + " '${DEP_PKG}' is either not defined or is listed later in the package order." + " This may also be an attempt to create a circular dependency between" + " the packages '${DEP_PKG}' and '${PACKAGE_NAME}' (which is not allowed)." + " Check the spelling of '${DEP_PKG}' or see how it is listed in" + " a call to TRIBITS_REPOSITORY_DEFINE_PACKAGES() in relation to" + " '${PACKAGE_NAME}'.") + MESSAGE(FATAL_ERROR ${ERRMSG}) +ENDFUNCTION() + + +# @FUNCTION: TRIBITS_ABORT_ON_SELF_DEP() +# +# Usage:: +# +# TRIBITS_ABORT_ON_SELF_DEP( ) +# +# Prints a fatal error message for an attempt for a self dependency +# declaration and which list it comes from. +# +# See `Function call tree for constructing package dependency graph`_ +# +FUNCTION(TRIBITS_ABORT_ON_SELF_DEP PACKAGE_NAME DEP_PKG_LIST_NAME) + MULTILINE_SET(ERRMSG + "Error, the package '${PACKAGE_NAME}' is listed as a dependency of itself" + " in the list '${DEP_PKG_LIST_NAME}'!") + MESSAGE(FATAL_ERROR ${ERRMSG}) +ENDFUNCTION() + + +################################################################################ +# Macros/functions for processing dependency info for subpackages +################################################################################ + + +# @MACRO: TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS() +# +# Usage:: +# +# TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS() +# +# Macro that parses the read-in variable +# ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` set by the macro +# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ , add subpackages to the list of +# defined packages, and define user cache var options for those subpackages. +# +# This sets the list varaibles for the parent package ````:: +# +# _SUBPACKAGES +# _SUBPACKAGE_DIRS +# _SUBPACKAGE_OPTREQ +# +# For each subpackage ````, this sets:: +# +# _SOURCE_DIR +# _REL_SOURCE_DIR +# _PARENT_PACKAGE +# _PARENT_REPOSITORY +# +# And it appends for each subpackage to varaible:: +# +# ${PROJECT_NAME}_SE_PACKAGES (old) +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS + PACKAGE_NAME + ) + + #MESSAGE("TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS: ${PACKAGE_NAME}") + + # Structure of SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS + SET(SPDC_SP_NAME_OFFSET 0) + SET(SPDC_SP_DIR_OFFSET 1) + SET(SPDC_SP_CLASSIFICATION_OFFSET 2) + SET(SPDC_SP_OPTREQ_OFFSET 3) + SET(SPDC_NUM_FIELDS 4) + + SET(${PACKAGE_NAME}_SUBPACKAGES "") + SET(${PACKAGE_NAME}_SUBPACKAGE_DIRS "") + SET(${PACKAGE_NAME}_SUBPACKAGE_OPTREQ "") + + IF (SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) + + LIST(LENGTH SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS SPDC_TOTAL_LENGTH) + MATH(EXPR NUM_SUBPACKAGES "${SPDC_TOTAL_LENGTH}/${SPDC_NUM_FIELDS}") + MATH(EXPR SUBPACKAGES_LAST_IDX "${NUM_SUBPACKAGES}-1") + + FOREACH(SUBPACKAGE_IDX RANGE ${SUBPACKAGES_LAST_IDX}) + + #MESSAGE("") + #PRINT_VAR(SUBPACKAGE_IDX) + + # SUBPACKAGE_NAME + MATH(EXPR SUBPACKAGE_NAME_IDX + "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_NAME_OFFSET}") + LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_NAME_IDX} + SUBPACKAGE_NAME ) + + SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) + + # SUBPACKAGE_DIR + MATH(EXPR SUBPACKAGE_DIR_IDX + "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_DIR_OFFSET}") + LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_DIR_IDX} + SUBPACKAGE_DIR ) + + # SUBPACKAGE_CLASSIFICATION + MATH(EXPR SUBPACKAGE_CLASSIFICATION_IDX + "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_CLASSIFICATION_OFFSET}") + LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_CLASSIFICATION_IDX} + SUBPACKAGE_CLASSIFICATION ) + + # ToDo: Parse out TESTGROUP and MATURITYLEVEL (Trilinos #6042) + SET(SUBPACKAGE_TESTGROUP ${SUBPACKAGE_CLASSIFICATION}) + + TRIBITS_UPDATE_PS_PT_SS_ST(Subpackage ${SUBPACKAGE_FULLNAME} SUBPACKAGE_TESTGROUP) + + # SUBPACKAGE_OPTREQ + MATH(EXPR SUBPACKAGE_OPTREQ_IDX + "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_OPTREQ_OFFSET}") + LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_OPTREQ_IDX} + SUBPACKAGE_OPTREQ ) + + # Determine if this subpackage exists + SET(SUBPACKAGE_FULL_SOURCE_DIR + ${PROJECT_SOURCE_DIR}/${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}) + IF (EXISTS ${SUBPACKAGE_FULL_SOURCE_DIR}) + SET(SUBPACKAGE_EXISTS TRUE) + ELSE() + SET(SUBPACKAGE_EXISTS FALSE) + ENDIF() + + IF (NOT SUBPACKAGE_EXISTS AND ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + MESSAGE(SEND_ERROR "ERROR: Subpackage dir '${SUBPACKAGE_FULL_SOURCE_DIR}'" + " is missing!") + ENDIF() + + # Append to lists and global variables + + IF (SUBPACKAGE_EXISTS) + + LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGES ${SUBPACKAGE_NAME}) + LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_DIR}) + LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_OPTREQ}) + LIST(APPEND ${PROJECT_NAME}_SE_PACKAGES ${SUBPACKAGE_FULLNAME}) + SET(${SUBPACKAGE_FULLNAME}_SOURCE_DIR "${SUBPACKAGE_FULL_SOURCE_DIR}") + SET(${SUBPACKAGE_FULLNAME}_REL_SOURCE_DIR + "${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}") + SET(${SUBPACKAGE_FULLNAME}_PARENT_PACKAGE ${PACKAGE_NAME}) + SET(${SUBPACKAGE_FULLNAME}_PARENT_REPOSITORY + ${${PACKAGE_NAME}_PARENT_REPOSITORY}) + + IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) + PRINT_VAR(${SUBPACKAGE_FULLNAME}_PARENT_PACKAGE) + PRINT_VAR(${SUBPACKAGE_FULLNAME}_PARENT_REPOSITORY) + ENDIF() + + # Set up the input options for this subpackage + TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS(${SUBPACKAGE_FULLNAME} + ${SUBPACKAGE_TESTGROUP}) + + ENDIF() + + ENDFOREACH() + + ENDIF() + + #PRINT_VAR(${PACKAGE_NAME}_SUBPACKAGES) + #PRINT_VAR(${PACKAGE_NAME}_SUBPACKAGE_OPTREQ) + +ENDMACRO() + + +# @MACRO: TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH() +# +# Usage:: +# +# TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH() +# +# Read in subpackages dependencies files and add to dependencies graph +# variables. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH PACKAGE_NAME) + + #MESSAGE("TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH: ${PACKAGE_NAME}") + + #PRINT_VAR(${PROJECT_NAME}_SE_PACKAGES) + + SET(SUBPACKAGE_IDX 0) + FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) + LIST(GET ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_IDX} SUBPACKAGE_DIR) + TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH(${TRIBITS_PACKAGE} + ${TRIBITS_SUBPACKAGE} ${SUBPACKAGE_DIR}) + MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") + ENDFOREACH() + +ENDMACRO() + + +# @MACRO: TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH() +# +# Usage:: +# +# TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH( +# ) +# +# Macro that reads in a single subpackage dependencies file +# `//cmake/Dependencies.cmake`_ and sets up the +# dependency structure for it. +# +# See `Function call tree for constructing package dependency graph`_ +# +MACRO(TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH PACKAGE_NAME + SUBPACKAGE_NAME SUBPACKAGE_DIR + ) + + #MESSAGE("TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH: ${PACKAGE_NAME} ${SUBPACKAGE_NAME} ${SUBPACKAGE_DIR}") + + SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) + + # + # A) Get ready to read in the contents of this this subpakages's + # Dependencies.cmake file + # + + TRIBITS_PREP_TO_READ_DEPENDENCIES(${SUBPACKAGE_FULLNAME}) + + # NOTE: Subpackages use the regression email list from the parent package. + + # NOTE: Subpackages are not allowed to have subpackages! + SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) + + # + # B) Read in this subpackage's Dependencies file + # + + SET(SUBPACKAGE_FULL_DIR "${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}") + + SET(SUBPACKAGE_ABS_DIR "${PROJECT_SOURCE_DIR}/${SUBPACKAGE_FULL_DIR}") + SET(SUBPAKCAGE_DEPENDENCIES_FILE "${SUBPACKAGE_ABS_DIR}/cmake/Dependencies.cmake") + + IF (EXISTS ${SUBPAKCAGE_DEPENDENCIES_FILE}) + SET(SUBPACKAGE_EXISTS TRUE) + ELSE() + SET(SUBPACKAGE_EXISTS FALSE) + ENDIF() + + IF (SUBPACKAGE_EXISTS OR ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + + TRIBITS_TRACE_FILE_PROCESSING(PACKAGE INCLUDE "${SUBPAKCAGE_DEPENDENCIES_FILE}") + INCLUDE(${SUBPAKCAGE_DEPENDENCIES_FILE}) + + TRIBITS_ASSERT_READ_DEPENDENCY_VARS(${SUBPACKAGE_FULLNAME}) + + TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS(${SUBPACKAGE_FULLNAME}) + + SET(${SUBPACKAGE_FULLNAME}_REGRESSION_EMAIL_LIST + ${${PACKAGE_NAME}_REGRESSION_EMAIL_LIST}) + + ENDIF() + +ENDMACRO() + + +# +# Private utility functions +# + + +# Function that sets a varaible to DECLARED-UNDEFINED +# +FUNCTION(TRIBITS_DECLARE_UNDEFINED VAR_NAME) + SET(${VAR_NAME} DECLARED-UNDEFINED PARENT_SCOPE) +ENDFUNCTION() + + +# Function that asserts that a package dependency variable is defined +# correctly +# +FUNCTION(TRIBITS_ASSERT_DEFINED_PACKAGE_VAR PACKAGE_VAR PACKAGE_NAME) + IF (${PACKAGE_VAR} STREQUAL DECLARED-UNDEFINED) + MESSAGE(FATAL_ERROR + "Error, the package variable ${PACKAGE_VAR} was not defined correctly for package ${PACKAGE_NAME}!" + ) + ENDIF() +ENDFUNCTION() diff --git a/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst b/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst index 75f1623fa17f..e2accf82761b 100644 --- a/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst +++ b/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst @@ -55,14 +55,14 @@ read in order. This list does **not** include any subpackages. Note that some of the packages listed in `${PACKAGE_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES`_ may actually be treated as external packages and not build from source code and instead will be found -out on the system and pre-built packages using -``find_package(${PACKAGE_NAME})``. The final decision for if a package is -treated as an internal or external package is determined by the variable:: +out on the system as pre-built/pre-installed packages using +``find_package()``. The final decision for if a package +is treated as an internal or external package is determined by the variable:: ${PACKAGE_NAME}_PACKAGE_STATUS=[INTERNAL|EXTERNAL] -which gets set by a set of different criteria as described in section -`Determining if a package is internal or external`_. This determines what +which gets set variouscriteria as described in section `Determining if a +package is internal or external`_. This varaible determines what pre-built/pre-installed packages must be found out on the system if enabled and what internal packages need to be built if enabled. @@ -73,6 +73,11 @@ is used with an adjective, it is usually meant in this more general context. ToDo: Describe the data-structures of all "Packages" which includes subpackages as well and the lists of enabled packages. +These data-stractures as well as the package dependencies graph is built up in +the macro `TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH()`_ with the +call graph described in the section `Function call tree for constructing +package dependency graph`_. + A set of enable/disable logic is applied in the macro `TRIBITS_ADJUST_PACKAGE_ENABLES()`_. Once all of this logic has been applied, the final list of enabled external packages, internal packages, and all @@ -124,7 +129,7 @@ project-level non-cache list variable:: That list is created from the information in the `/PackagesList.cmake`_ and `/cmake/Dependencies.cmake`_ files for the top-level packages read and processed in the macro -`TRIBITS_READ_PROJECT_AND_PACKAGE_DEPENDENCIES_CREATE_GRAPH_PRINT_DEPS()`_ using macros in the file:: +`TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH()`_ using macros in the file:: TribitsAdjustPackageEnables.cmake @@ -416,32 +421,35 @@ Function call tree for constructing package dependency graph Below is the CMake macro and function call graph for constructing the packages lists and dependency data-structures described above. -| `TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML()`_ +| `TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH()`_ | `TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS()`_ -| For each ```` in all defined TriBITS repositories: +| Foreach ```` in ``${PROJECT_NAME}_ALL_REPOSITORIES``: | ``INCLUDE(`` `/TPLsList.cmake`_ ``)`` | `TRIBITS_PROCESS_TPLS_LISTS()`_ | ``INCLUDE(`` `/PackagesList.cmake`_ ``)`` | `TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS()`_ -| `TRIBITS_READ_PROJECT_AND_PACKAGE_DEPENDENCIES_CREATE_GRAPH_PRINT_DEPS()`_ -| `TRIBITS_PROCESS_ALL_REPOSITORY_DEPENDENCY_SETUP_LOGIC()`_ -| `TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_LOGIC()`_ -| `TRIBITS_READ_ALL_PACKAGE_DEPS_AND_CREATE_DEPS_GRAPH()`_ +| `TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH()`_ +| `TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES()`_ +| Foreach ```` in ``${PROJECT_NAME}_ALL_REPOSITORIES``: +| ``INCLUDE(`` `/cmake/RepositoryDependenciesSetup.cmake`_ ``)`` +| `TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE()`_ +| ``INCLUDE(`` `/cmake/ProjectDependenciesSetup.cmake`_ ``)`` +| `TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH()`_ | Foreach ``TOPLEVEL_PACKAGE``: -| `TRIBITS_READ_PACKAGE_DEPENDENCIES()`_ +| `TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH()`_ | `TRIBITS_PREP_TO_READ_DEPENDENCIES()`_ | ``INCLUDE(`` `/cmake/Dependencies.cmake`_ ``)`` | `TRIBITS_ASSERT_READ_DEPENDENCY_VARS()`_ | `TRIBITS_SAVE_OFF_DEPENDENCIES_VARS()`_ -| `TRIBITS_PARSE_SUBPACKAGES_AND_APPEND_SE_PACKAGES_AND_ADD_OPTIONS()`_ -| `TRIBITS_READ_ALL_PACKAGE_SUBPACKAGE_DEPENDENCIES()`_ +| `TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS()`_ +| `TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH()`_ | Foreach ``SUBPACKAGE``: -| `TRIBITS_READ_SUBPACKAGE_DEPENDENCIES_AND_ADD_TO_GRAPH()`_ +| `TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH()`_ | `TRIBITS_PREP_TO_READ_DEPENDENCIES()`_ | ``INCLUDE(`` `//cmake/Dependencies.cmake`_ ``)`` | `TRIBITS_ASSERT_READ_DEPENDENCY_VARS()`_ | `TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS()`_ -| See same call stack for this macro below +| See same call stack for this macro as shown below | `TRIBITS_READ_BACK_DEPENDENCIES_VARS()`_ | `TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS()`_ | `TRIBITS_SET_DEP_PACKAGES()`_ @@ -449,8 +457,6 @@ lists and dependency data-structures described above. | `TRIBITS_ABORT_ON_MISSING_PACKAGE()`_ | `TRIBITS_APPEND_FORWARD_DEP_PACKAGES()`_ | `TRIBITS_ABORT_ON_MISSING_PACKAGE()`_ -| `TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS()`_ -| `TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO()`_ Notes on dependency logic diff --git a/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake b/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake index 6f42273fb31e..35a220bc4051 100644 --- a/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake +++ b/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake @@ -244,6 +244,9 @@ ENDMACRO() # MACRO(TRIBITS_SETUP_PACKAGES) + INCLUDE(TribitsPrintDependencyInfo) + INCLUDE(TribitsWriteXmlDependenciesFiles) + # Here, we must point into the source tree just cloned (or updated) # and not the "driver" source dir tree for two reasons. First, the # list of core packages may be more recent in what was checked out. @@ -279,7 +282,9 @@ MACRO(TRIBITS_SETUP_PACKAGES) TRIBITS_READ_IN_NATIVE_REPOSITORIES() TRIBITS_COMBINE_NATIVE_AND_EXTRA_REPOS() - TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML() + TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() + TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() + TRIBITS_WRITE_XML_DEPENDENCY_FILES() # When we get here, we will have the basic dependency structure set up # with only defaults set diff --git a/cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst b/cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst index 2f1bb9eba1bc..e412b0477126 100644 --- a/cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst +++ b/cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst @@ -2372,7 +2372,7 @@ proceeds through the call to `TRIBITS_PROJECT()`_. | 7) For each ```` in all defined TriBITS repositories: | * ``INCLUDE(`` `/cmake/CallbackSetupExtraOptions.cmake`_ ``)`` | * Call macro ``TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS()`` -| 9) Call `TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML()`_: +| 9) Call `TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH()`_: | a) For each ```` in all defined TriBITS repositories: | * ``INCLUDE(`` `/TPLsList.cmake`_ ``)`` and process list | * ``INCLUDE(`` `/PackagesList.cmake`_ ``)`` and process list @@ -2434,7 +2434,7 @@ is described below. | 1. Read `/ProjectName.cmake`_ (sets `PROJECT_NAME`_) | 2. ``INCLUDE(`` `/cmake/ExtraRepositoriesList.cmake`_ ``)`` -| 3. Call ``TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML()``: +| 3. Call ``TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH()``: | a) For each ```` in all defined TriBITS repositories: | * ``INCLUDE(`` `/TPLsList.cmake`_ ``)`` | * ``INCLUDE(`` `/PackagesList.cmake`_ ``)`` @@ -5039,7 +5039,7 @@ project's `/cmake/ProjectDependenciesSetup.cmake`_ file. All of the email dependency management logic must be accessible by just running the macro:: - TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML() + TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() The above email address configuration variables are read from the Repository and Project files `/cmake/RepositoryDependenciesSetup.cmake`_ and diff --git a/cmake/tribits/doc/developers_guide/TribitsSystemMacroFunctionDocTemplate.rst b/cmake/tribits/doc/developers_guide/TribitsSystemMacroFunctionDocTemplate.rst index c123ef0addf4..b274bfc759ea 100644 --- a/cmake/tribits/doc/developers_guide/TribitsSystemMacroFunctionDocTemplate.rst +++ b/cmake/tribits/doc/developers_guide/TribitsSystemMacroFunctionDocTemplate.rst @@ -16,21 +16,24 @@ understand the internals of TriBITS. @FUNCTION: TRIBITS_APPEND_FORWARD_DEP_PACKAGES() + @MACRO: TRIBITS_ASSERT_READ_DEPENDENCY_VARS() + @FUNCTION: TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() + +@FUNCTION: TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() + @FUNCTION: TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() + -@MACRO: TRIBITS_PROCESS_ALL_REPOSITORY_DEPENDENCY_SETUP_LOGIC() + +@MACRO: TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES() + @MACRO: TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS() + -@MACRO: TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_LOGIC() + +@MACRO: TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE() + @MACRO: TRIBITS_PROCESS_TPLS_LISTS() + -@MACRO: TRIBITS_READ_ALL_PACKAGE_DEPS_AND_CREATE_DEPS_GRAPH() + -@MACRO: TRIBITS_READ_ALL_PACKAGE_SUBPACKAGE_DEPENDENCIES() + +@MACRO: TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH() + +@MACRO: TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH() + @MACRO: TRIBITS_READ_BACK_DEPENDENCIES_VARS() + @MACRO: TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS() + -@MACRO: TRIBITS_READ_PACKAGES_PROCESS_DEPENDENCIES_WRITE_XML() + -@MACRO: TRIBITS_READ_PACKAGE_DEPENDENCIES() + -@MACRO: TRIBITS_READ_SUBPACKAGE_DEPENDENCIES_AND_ADD_TO_GRAPH() + -@MACRO: TRIBITS_PARSE_SUBPACKAGES_AND_APPEND_SE_PACKAGES_AND_ADD_OPTIONS() + +@MACRO: TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() + +@MACRO: TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH() + +@MACRO: TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH() + +@MACRO: TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS() + @MACRO: TRIBITS_PREP_TO_READ_DEPENDENCIES() + @MACRO: TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS() + -@MACRO: TRIBITS_READ_PROJECT_AND_PACKAGE_DEPENDENCIES_CREATE_GRAPH_PRINT_DEPS() + +@MACRO: TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH() + @MACRO: TRIBITS_SAVE_OFF_DEPENDENCIES_VARS() + @FUNCTION: TRIBITS_SET_DEP_PACKAGES() + +@MACRO: TRIBITS_WRITE_XML_DEPENDENCY_FILES() + +@FUNCTION: TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED() + diff --git a/cmake/tribits/doc/developers_guide/generate-dev-guide.sh b/cmake/tribits/doc/developers_guide/generate-dev-guide.sh index 20984bc12958..77424a57ffe3 100755 --- a/cmake/tribits/doc/developers_guide/generate-dev-guide.sh +++ b/cmake/tribits/doc/developers_guide/generate-dev-guide.sh @@ -69,7 +69,7 @@ if [ "$TRIBITS_DEV_GUIDE_SKIP_DOCUMENTATION_EXTRACTION" == "" ] ; then echo "Extracting TriBITS documentation from *.cmake files ..." echo ../../python_utils/extract_rst_cmake_doc.py \ - --extract-from=../../core/package_arch/,../../core/utils/,../../ctest_driver/ \ + --extract-from=../../core/package_arch/,../../ci_support/,../../core/utils/,../../ctest_driver/ \ --rst-file-pairs=TribitsMacroFunctionDocTemplate.rst:TribitsMacroFunctionDoc.rst.tmp,UtilsMacroFunctionDocTemplate.rst:UtilsMacroFunctionDoc.rst.tmp,TribitsSystemMacroFunctionDocTemplate.rst:TribitsSystemMacroFunctionDoc.rst.tmp \ --show-file-name-line-num \ --file-name-path-base-dir=../.. \ From 2beb90653bacdfed9a02b0c98f6fab3a2e84c827 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 3 Sep 2021 14:24:12 -0600 Subject: [PATCH 2/6] Automatic snapshot commit from tribits at aeb746c Origin repo remote tracking branch: 'github/master' Origin repo remote repo URL: 'github = git@github.com:TriBITSPub/TriBITS.git' At commit: commit aeb746cc4499d9364807cb1b40fc366429bad06c Author: Roscoe A. Bartlett Date: Thu Aug 26 06:40:10 2021 -0600 Summary: Change internal TriBITS target_link_libraries() to PUBLIC (#299) --- cmake/tribits/ReleaseNotes.txt | 16 +- cmake/tribits/TriBITS.cmake | 22 +- cmake/tribits/Version.cmake | 16 +- .../ci_support/CDashQueryAnalyzeReport.py | 92 +- cmake/tribits/ci_support/CheckinTest.py | 20 +- .../CreateIssueTrackerFromCDashQuery.py | 2 +- .../ci_support/TribitsDumpDepsXmlScript.cmake | 92 +- .../TribitsGetExtraReposForCheckinTest.cmake | 144 +- .../ci_support/TribitsPackageFilePathUtils.py | 10 +- ...ibitsStripCommentsFromCMakeCacheFile.cmake | 8 +- .../TribitsWriteXmlDependenciesFiles.cmake | 170 +- .../ci_support/cdash_analyze_and_report.py | 6 +- .../ci_support/cdash_build_testing_date.py | 4 +- cmake/tribits/ci_support/checkin-test.py | 6 +- cmake/tribits/ci_support/clone_extra_repos.py | 2 +- .../get-tribits-packages-from-files-list.py | 2 +- .../ci_support/is_checkin_tested_commit.py | 4 +- cmake/tribits/common_tpls/FindTPLBLAS.cmake | 44 +- .../tribits/common_tpls/FindTPLBinUtils.cmake | 40 +- cmake/tribits/common_tpls/FindTPLBoost.cmake | 2 +- cmake/tribits/common_tpls/FindTPLCGNS.cmake | 32 +- cmake/tribits/common_tpls/FindTPLHDF5.cmake | 76 +- cmake/tribits/common_tpls/FindTPLLAPACK.cmake | 46 +- cmake/tribits/common_tpls/FindTPLNetcdf.cmake | 36 +- cmake/tribits/common_tpls/FindTPLPETSC.cmake | 2 +- .../tribits/common_tpls/FindTPLPnetcdf.cmake | 2 +- .../common_tpls/find_modules/FindCGNS.cmake | 4 +- .../common_tpls/find_modules/FindHDF5.cmake | 76 +- .../common_tpls/find_modules/FindNetCDF.cmake | 2 +- .../find_modules/FindPNetCDF.cmake | 4 +- .../utils/AddImportedLibrary.cmake | 6 +- .../utils/AddPackageDependency.cmake | 12 +- .../common_tpls/utils/ParseLibraryList.cmake | 6 +- .../core/config_tests/BLASMangling.cmake | 114 +- .../core/config_tests/FiniteValue.cmake | 36 +- .../core/config_tests/FortranMangling.cmake | 240 +- .../core/config_tests/MathLibraryNeeded.cmake | 50 +- .../config_tests/blasmangle/CMakeLists.txt | 10 +- .../core/config_tests/fmangle/CMakeLists.txt | 14 +- .../TribitsConfigInclude.cmake.in | 10 +- .../TribitsInstallationTestingMacros.cmake | 56 +- .../TribitsPackageConfigTemplate.cmake.in | 58 +- .../TribitsProjectConfigTemplate.cmake.in | 150 +- .../CMakeLists.txt | 6 +- .../CMakeLists.txt | 20 +- .../installation/cmake_pbp_install.cmake.in | 4 +- ...t_installed_group_and_permissions.cmake.in | 112 +- .../package_arch/TribitsAddAdvancedTest.cmake | 944 +++--- .../TribitsAddAdvancedTestHelpers.cmake | 84 +- .../package_arch/TribitsAddExecutable.cmake | 534 ++-- .../TribitsAddExecutableAndTest.cmake | 218 +- .../TribitsAddExecutableTestHelpers.cmake | 98 +- ...TribitsAddInstallGroupAndPermsFixups.cmake | 108 +- .../TribitsAddOptionAndDefine.cmake | 32 +- .../core/package_arch/TribitsAddTest.cmake | 446 +-- .../package_arch/TribitsAddTestHelpers.cmake | 970 +++--- .../TribitsAdjustPackageEnables.cmake | 1467 +++++---- .../package_arch/TribitsBLASMangling.cmake | 20 +- .../package_arch/TribitsCMakePolicies.cmake | 10 +- .../TribitsCommonArgsHelpers.cmake | 40 +- .../TribitsConfigureCTestCustom.cmake | 18 +- .../core/package_arch/TribitsConstants.cmake | 58 +- .../TribitsCopyFilesToBinaryDir.cmake | 188 +- .../TribitsCreateClientTemplateHeaders.cmake | 106 +- .../TribitsDefineStandardCompileVars.cmake | 114 +- .../core/package_arch/TribitsETISupport.cmake | 440 +-- .../TribitsFindMostRecentFileTimestamp.cmake | 442 +-- .../TribitsFindPythonInterp.cmake | 78 +- .../package_arch/TribitsFortranMangling.cmake | 68 +- .../package_arch/TribitsGeneralMacros.cmake | 584 ++-- .../TribitsGenerateResourceSpecFile.cmake | 44 +- .../package_arch/TribitsGetVersionDate.cmake | 16 +- .../package_arch/TribitsGlobalMacros.cmake | 2694 ++++++++--------- .../core/package_arch/TribitsHostType.cmake | 6 +- .../TribitsIncludeDirectories.cmake | 44 +- .../package_arch/TribitsInstallHeaders.cmake | 66 +- .../package_arch/TribitsLibraryMacros.cmake | 682 ++--- .../package_arch/TribitsListHelpers.cmake | 124 +- .../TribitsPackageDefineDependencies.cmake | 40 +- .../package_arch/TribitsPackageMacros.cmake | 783 ++--- .../TribitsPackageSetupCompilerFlags.cmake | 124 +- .../TribitsPrintDependencyInfo.cmake | 76 +- .../TribitsProcessEnabledTpl.cmake | 122 +- .../TribitsProcessExtraRepositoriesList.cmake | 696 ++--- .../TribitsProcessPackagesAndDirsLists.cmake | 500 +-- .../TribitsProcessTplsLists.cmake | 222 +- .../core/package_arch/TribitsProject.cmake | 46 +- .../package_arch/TribitsProjectImpl.cmake | 254 +- ...adAllProjectDepsFilesCreateDepsGraph.cmake | 367 +-- .../TribitsReadDepsFilesCreateDepsGraph.cmake | 796 ++--- .../TribitsReportInvalidTribitsUsage.cmake | 62 +- .../TribitsSetupBasicCompileLinkFlags.cmake | 176 +- .../core/package_arch/TribitsSetupMPI.cmake | 174 +- .../TribitsSetupStrongCompileWarnings.cmake | 52 +- ...TribitsSortListAccordingToMasterList.cmake | 36 +- .../TribitsSubPackageMacros.cmake | 106 +- ...itsSystemDataStructuresMacrosFunctions.rst | 100 +- .../package_arch/TribitsTestCategories.cmake | 84 +- .../TribitsTplDeclareLibraries.cmake | 14 +- ...ribitsTplFindIncludeDirsAndLibraries.cmake | 580 ++-- .../package_arch/TribitsVerbosePrintVar.cmake | 22 +- .../TribitsWriteClientExportFiles.cmake | 840 ++--- .../core/package_arch/Tribits_version.h.in | 2 +- .../package_arch/Tribits_version_date.h.in | 2 +- .../tribits_get_version_date.cmake | 2 +- cmake/tribits/core/std_tpls/FindTPLCUDA.cmake | 60 +- cmake/tribits/core/std_tpls/FindTPLMPI.cmake | 18 +- .../core/utils/AddSubdirectories.cmake | 18 +- cmake/tribits/core/utils/AdvancedOption.cmake | 16 +- cmake/tribits/core/utils/AdvancedSet.cmake | 16 +- .../core/utils/AppendCmndlineArgs.cmake | 20 +- cmake/tribits/core/utils/AppendGlob.cmake | 16 +- .../tribits/core/utils/AppendGlobalSet.cmake | 20 +- cmake/tribits/core/utils/AppendSet.cmake | 12 +- .../tribits/core/utils/AppendStringVar.cmake | 38 +- .../core/utils/AppendStringVarWithSep.cmake | 34 +- .../core/utils/AssertAndTouchDefined.cmake | 20 +- cmake/tribits/core/utils/AssertDefined.cmake | 30 +- .../core/utils/CMakeBuildTypesList.cmake | 2 +- cmake/tribits/core/utils/CMakeOverrides.cmake | 34 +- cmake/tribits/core/utils/CombinedOption.cmake | 84 +- cmake/tribits/core/utils/ConcatStrings.cmake | 30 +- .../core/utils/DriveAdvancedTest.cmake | 594 ++-- .../utils/DualScopeAppendCmndlineArgs.cmake | 18 +- .../utils/DualScopePrependCmndlineArgs.cmake | 18 +- cmake/tribits/core/utils/DualScopeSet.cmake | 18 +- .../tribits/core/utils/FindListElement.cmake | 24 +- .../tribits/core/utils/FindProgramPlus.cmake | 42 +- .../core/utils/GetCurrentListDir.cmake | 12 +- cmake/tribits/core/utils/GetLastDirName.cmake | 10 +- cmake/tribits/core/utils/GlobalNullSet.cmake | 12 +- cmake/tribits/core/utils/GlobalSet.cmake | 12 +- cmake/tribits/core/utils/Join.cmake | 36 +- cmake/tribits/core/utils/MessageWrapper.cmake | 40 +- cmake/tribits/core/utils/MultilineSet.cmake | 20 +- .../core/utils/ParseVariableArguments.cmake | 130 +- .../core/utils/PrependCmndlineArgs.cmake | 20 +- .../tribits/core/utils/PrependGlobalSet.cmake | 18 +- cmake/tribits/core/utils/PrependSet.cmake | 16 +- .../tribits/core/utils/PrintNonemptyVar.cmake | 22 +- .../utils/PrintNonemptyVarWithSpaces.cmake | 28 +- cmake/tribits/core/utils/PrintVar.cmake | 32 +- .../core/utils/RemoveGlobalDuplicates.cmake | 26 +- cmake/tribits/core/utils/SetAndIncDirs.cmake | 16 +- .../core/utils/SetCacheOnOffEmpty.cmake | 28 +- cmake/tribits/core/utils/SetDefault.cmake | 14 +- .../core/utils/SetDefaultAndFromEnv.cmake | 28 +- cmake/tribits/core/utils/SetNotFound.cmake | 6 +- cmake/tribits/core/utils/Split.cmake | 14 +- cmake/tribits/core/utils/TimingUtils.cmake | 174 +- .../core/utils/TribitsFilepathHelpers.cmake | 86 +- .../utils/TribitsGetCategoriesString.cmake | 16 +- .../core/utils/TribitsStandardizePaths.cmake | 26 +- .../utils/TribitsStripQuotesFromStr.cmake | 6 +- .../tribits/core/utils/UnitTestHelpers.cmake | 198 +- .../core/utils/UseCcacheIfExists.cmake | 10 +- cmake/tribits/ctest_driver/README | 6 +- .../TribitsAddDashboardTarget.cmake | 176 +- .../ctest_driver/TribitsCTestDriverCore.cmake | 1382 +++++---- .../TribitsCTestDriverCoreHelpers.cmake | 1596 +++++----- .../TribitsGetCDashUrlFromTagFile.cmake | 194 ++ .../TribitsGetCTestTestXmlDir.cmake | 30 +- .../ctest_driver/TribitsReadTagFile.cmake | 29 +- .../ctest_driver/dump-cdash-deps-xml-file.py | 2 +- .../experimental_build_test.cmake | 44 +- .../tribits_ctest_update_commands.cmake | 2 +- .../dashboard_driver/CTestCustom.cmake.in | 4 +- .../TribitsDriverCMakeLists.cmake | 12 +- .../TribitsDriverDashboard.cmake | 128 +- .../TribitsDriverSupport.cmake | 52 +- .../devtools_install/InstallProgramDriver.py | 2 +- cmake/tribits/devtools_install/install-git.py | 2 +- .../devtools_install/install-openmpi.py | 2 +- .../devtools_install/install_devtools.py | 6 +- cmake/tribits/doc/build_docs.sh | 77 +- cmake/tribits/doc/build_ref/Makefile | 18 +- .../build_ref/TribitsBuildReferenceBody.rst | 98 +- .../tribits/doc/build_ref/create-build-ref.sh | 46 +- .../doc/build_ref/create-project-build-ref.py | 3 +- cmake/tribits/doc/developers_guide/Makefile | 60 - cmake/tribits/doc/developers_guide/README | 17 - .../TribitsMacroFunctionDocTemplate.rst | 47 - .../TribitsSystemMacroFunctionDocTemplate.rst | 39 - .../UtilsMacroFunctionDocTemplate.rst | 47 - .../developers_guide/generate-dev-guide.sh | 196 -- .../{developers_guide => guides}/.gitignore | 8 - .../ExtraReposList.cmake | 2 +- .../guides/Makefile.common_generated_files | 36 + cmake/tribits/doc/guides/README | 16 + .../EnableAllPackages.txt | 0 ...EnableEpetra_EnableRTOp_DisableTeuchos.txt | 2 +- ...leTeuchos_DisableEnabledFwdDepPackages.txt | 2 +- .../EnableThyraCoreLibs_EnableTests.txt | 0 .../EnableThyraEpetra_EnableTests.txt | 0 .../EnableThyra_DisableEpetra_EnableTests.txt | 2 +- .../EnableThyra_EnableTests.txt | 2 +- ...EnableThyra_EnableTests_EnableBoost_ST.txt | 2 +- ...nableTests_EnableBoost_ST_RequiredOnly.txt | 2 +- .../ExpectedDependencies.txt | 0 .../ReducedMockTrilinosOutput/NoEnables.txt | 0 .../guides/TribitsCoreDetailedReference.rst | 863 ++++++ .../guides/TribitsDesignConsiderations.rst | 27 + cmake/tribits/doc/guides/TribitsFAQ.rst | 9 + .../TribitsGuidesBody.rst} | 2198 +++----------- .../doc/guides/TribitsGuidesReferences.rst | 128 + cmake/tribits/doc/guides/TribitsHistory.rst | 44 + .../TribitsMacroFunctionDocTemplate.rst | 47 + .../guides/TribitsPackageNotCMakePackage.rst | 22 + .../TribitsSystemMacroFunctionDocTemplate.rst | 39 + .../doc/guides/TribitsToolsDocumentation.rst | 193 ++ .../guides/UtilsMacroFunctionDocTemplate.rst | 47 + cmake/tribits/doc/guides/generate-guide.sh | 289 ++ .../doc/guides/maintainers_guide/.gitignore | 9 + .../doc/guides/maintainers_guide/Makefile | 37 + .../TribitsCoreDetailedReference.rst | 1 + .../TribitsMaintainersGuide.rst | 80 + .../rst2latex.tex | 0 .../scripts/dummy_test_commit.sh | 2 +- .../tribits/doc/guides/users_guide/.gitignore | 16 + cmake/tribits/doc/guides/users_guide/Makefile | 36 + .../TribitsCoreDetailedReference.rst | 1 + .../guides/users_guide/TribitsUsersGuide.rst | 106 + cmake/tribits/doc/publish_docs.sh | 41 +- cmake/tribits/doc/sphinx/build_ref/Makefile | 20 + .../tribits/doc/sphinx/build_ref/__init__.py | 0 cmake/tribits/doc/sphinx/build_ref/conf.py | 71 + cmake/tribits/doc/sphinx/build_ref/make.bat | 35 + cmake/tribits/doc/sphinx/build_sphinx_docs.sh | 22 + .../doc/sphinx/combined_docs/index.html | 132 + cmake/tribits/doc/sphinx/index.rst | 43 + .../doc/sphinx/maintainers_guide/Makefile | 20 + .../doc/sphinx/maintainers_guide/__init__.py | 0 .../doc/sphinx/maintainers_guide/conf.py | 71 + .../doc/sphinx/maintainers_guide/make.bat | 35 + cmake/tribits/doc/sphinx/requirements.txt | 2 + .../doc/sphinx/sphinx_rst_generator.py | 254 ++ cmake/tribits/doc/sphinx/users_guide/Makefile | 20 + .../doc/sphinx/users_guide/__init__.py | 0 cmake/tribits/doc/sphinx/users_guide/conf.py | 71 + cmake/tribits/doc/sphinx/users_guide/make.bat | 35 + .../src/TribitsTutorial_ConvertAProject.rst | 128 +- .../src/TribitsTutorial_Dependencies.rst | 16 +- .../src/TribitsTutorial_HelloWorld.rst | 94 +- .../src/TribitsTutorial_ProjectStructure.rst | 4 +- cmake/tribits/doc/utils/gen_doc_utils.sh | 2 +- .../examples/InsertedPkg/CMakeLists.txt | 10 +- .../InsertedPkg/cmake/Dependencies.cmake | 2 +- .../examples/InsertedPkg/test/CMakeLists.txt | 2 +- .../MixedSharedStaticLibs/CMakeLists.txt | 8 +- .../MixedSharedStaticLibs/PackagesList.cmake | 2 +- .../MixedSharedStaticLibs/TPLsList.cmake | 2 +- .../cmake/Dependencies.cmake | 2 +- .../shared_only/CMakeLists.txt | 10 +- .../shared_only/cmake/Dependencies.cmake | 2 +- .../shared_only/test/CMakeLists.txt | 2 +- .../static_exec/CMakeLists.txt | 6 +- .../static_exec/cmake/Dependencies.cmake | 2 +- .../static_exec/test/CMakeLists.txt | 2 +- .../static_only/CMakeLists.txt | 10 +- .../static_only/cmake/Dependencies.cmake | 2 +- .../examples/MockTrilinos/CMakeLists.txt | 12 +- .../examples/MockTrilinos/CTestConfig.cmake | 24 +- .../examples/MockTrilinos/PackagesList.cmake | 8 +- .../examples/MockTrilinos/ProjectName.cmake | 2 +- .../examples/MockTrilinos/TPLsList.cmake | 2 +- .../examples/MockTrilinos/Version.cmake | 10 +- .../cmake/CallbackSetupExtraOptions.cmake | 8 +- .../cmake/ExtraRepositoriesList.cmake | 2 +- .../cmake/NativeRepositoriesList1.cmake | 2 +- .../cmake/ProjectDependenciesSetup.cmake | 2 +- ...ed_preCopyrightTrilinos_PackagesList.cmake | 4 +- .../cmake/RepositoryDependenciesSetup.cmake | 2 +- .../cmake/cmake/Dependencies.cmake | 2 +- .../extraRepoOnePackage/PackagesList.cmake | 2 +- .../extraRepoOnePackage/TPLsList.cmake | 2 +- .../cmake/Dependencies.cmake | 2 +- .../PackagesList.cmake | 2 +- .../TPLsList.cmake | 2 +- .../cmake/Dependencies.cmake | 2 +- .../sp1/cmake/Dependencies.cmake | 2 +- .../sp2/cmake/Dependencies.cmake | 2 +- .../sp3/cmake/Dependencies.cmake | 2 +- .../extraRepoTwoPackages/PackagesList.cmake | 2 +- .../extraRepoTwoPackages/TPLsList.cmake | 2 +- .../package1/cmake/Dependencies.cmake | 26 +- .../package2/cmake/Dependencies.cmake | 2 +- .../extraTrilinosRepo/PackagesList.cmake | 2 +- .../extraTrilinosRepo/TPLsList.cmake | 2 +- .../extrapack/cmake/Dependencies.cmake | 2 +- .../packages/amesos/cmake/Dependencies.cmake | 2 +- .../packages/aztecoo/cmake/Dependencies.cmake | 2 +- .../packages/belos/cmake/Dependencies.cmake | 2 +- .../packages/epetra/cmake/Dependencies.cmake | 2 +- .../epetraext/cmake/Dependencies.cmake | 2 +- .../packages/galeri/cmake/Dependencies.cmake | 2 +- .../packages/ifpack/cmake/Dependencies.cmake | 2 +- .../intrepid/cmake/Dependencies.cmake | 2 +- .../isorropia/cmake/Dependencies.cmake | 2 +- .../packages/ml/cmake/Dependencies.cmake | 2 +- .../packages/panzer/cmake/Dependencies.cmake | 2 +- .../packages/phalanx/cmake/Dependencies.cmake | 2 +- .../packages/rbgen/cmake/Dependencies.cmake | 2 +- .../packages/rtop/cmake/Dependencies.cmake | 2 +- .../packages/sacado/cmake/Dependencies.cmake | 2 +- .../packages/shards/cmake/Dependencies.cmake | 2 +- .../packages/stokhos/cmake/Dependencies.cmake | 2 +- .../stratimikos/cmake/Dependencies.cmake | 2 +- .../packages/teuchos/cmake/Dependencies.cmake | 2 +- .../adapters/epetra/cmake/Dependencies.cmake | 2 +- .../epetraext/cmake/Dependencies.cmake | 2 +- .../adapters/tpetra/cmake/Dependencies.cmake | 10 +- .../packages/thyra/cmake/Dependencies.cmake | 4 +- .../thyra/src/cmake/Dependencies.cmake | 2 +- .../src/crazy_stuff/cmake/Dependencies.cmake | 2 +- .../src/good_stuff/cmake/Dependencies.cmake | 2 +- .../packages/tpetra/cmake/Dependencies.cmake | 2 +- .../triutils/cmake/Dependencies.cmake | 2 +- .../packages/zoltan/cmake/Dependencies.cmake | 2 +- .../preCopyrightTrilinos/PackagesList.cmake | 4 +- .../preCopyrightTrilinos/TPLsList.cmake | 2 +- .../stalix/cmake/Dependencies.cmake | 2 +- .../teko/cmake/Dependencies.cmake | 18 +- .../preRepoOnePackage/PackagesList.cmake | 2 +- .../preRepoOnePackage/TPLsList.cmake | 2 +- .../cmake/Dependencies.cmake | 2 +- .../PackagesList.cmake | 2 +- .../RawAndTribitsHelloWorld/TPLsList.cmake | 2 +- .../ReducedMockTrilinos/CMakeLists.txt | 14 +- .../ReducedMockTrilinos/PackagesList.cmake | 2 +- .../ReducedMockTrilinos/ProjectName.cmake | 2 +- .../ReducedMockTrilinos/TPLsList.cmake | 2 +- .../packages/epetra/cmake/Dependencies.cmake | 2 +- .../epetraext/cmake/Dependencies.cmake | 14 +- .../packages/rtop/cmake/Dependencies.cmake | 2 +- .../packages/teuchos/cmake/Dependencies.cmake | 2 +- .../adapters/epetra/cmake/Dependencies.cmake | 2 +- .../epetraext/cmake/Dependencies.cmake | 2 +- .../packages/thyra/cmake/Dependencies.cmake | 2 +- .../crazy_stuff/cmake/Dependencies.cmake | 2 +- .../thyra/good_stuff/cmake/Dependencies.cmake | 2 +- .../thyra/src/cmake/Dependencies.cmake | 2 +- .../triutils/cmake/Dependencies.cmake | 2 +- .../examples/TargetDefinesPkg/CMakeLists.txt | 10 +- .../TargetDefinesPkg/PackagesList.cmake | 2 +- .../examples/TargetDefinesPkg/TPLsList.cmake | 2 +- .../TargetDefinesPkg/cmake/Dependencies.cmake | 2 +- .../TargetDefinesPkg/test/CMakeLists.txt | 10 +- .../test/deprecated_defines/CMakeLists.txt | 8 +- .../TribitsExampleMetaProject/CMakeLists.txt | 16 +- .../CTestConfig.cmake | 24 +- .../PackagesList.cmake | 2 +- .../ProjectName.cmake | 12 +- .../TribitsExampleMetaProject/TPLsList.cmake | 2 +- .../TribitsExampleMetaProject/Version.cmake | 10 +- .../cmake/ExtraRepositoriesList.cmake | 4 +- .../cmake/ctest/CTestCustom.cmake.in | 4 +- .../ctest/TribitsExMetaProjCTestDriver.cmake | 32 +- .../general_gcc/ctest_serial_debug.cmake | 28 +- .../TribitsExampleProject/CMakeLists.txt | 16 +- .../TribitsExampleProject/CTestConfig.cmake | 24 +- .../examples/TribitsExampleProject/LICENSE | 2 +- .../TribitsExampleProject/PackagesList.cmake | 6 +- .../TribitsExampleProject/ProjectName.cmake | 8 +- .../{README => README.md} | 10 +- .../TribitsExampleProject/TPLsList.cmake | 2 +- .../TribitsExampleProject/Version.cmake | 10 +- .../CallbackDefineProjectPackaging.cmake | 36 +- .../CallbackDefineRepositoryPackaging.cmake | 8 +- .../cmake/CallbackSetupExtraOptions.cmake | 34 +- .../cmake/ExtraRepositoriesList.cmake | 4 +- .../cmake/ctest/CTestCustom.cmake.in | 8 +- .../ctest/TribitsExProjCTestDriver.cmake | 30 +- .../general_gcc/ctest_serial_debug.cmake | 24 +- .../cmake/tpls/FindTPLHeaderOnlyTpl.cmake | 2 +- .../cmake/tpls/FindTPLSimpleTpl.cmake | 2 +- .../packages/mixed_lang/CMakeLists.txt | 12 +- .../mixed_lang/cmake/Dependencies.cmake | 2 +- .../packages/mixed_lang/src/CMakeLists.txt | 18 +- .../mixed_lang/src/Ray_Tracer_Kernel.f90 | 2 +- .../packages/mixed_lang/src/Vector_Lite.hh | 4 +- .../packages/mixed_lang/test/CMakeLists.txt | 2 +- .../packages/simple_cxx/CMakeLists.txt | 18 +- .../simple_cxx/cmake/CheckFor__int64.cmake | 10 +- .../simple_cxx/cmake/Dependencies.cmake | 2 +- .../packages/simple_cxx/src/CMakeLists.txt | 20 +- .../packages/simple_cxx/test/CMakeLists.txt | 4 +- .../packages/with_subpackages/CMakeLists.txt | 12 +- .../with_subpackages/a/CMakeLists.txt | 10 +- .../a/cmake/Dependencies.cmake | 2 +- .../with_subpackages/a/tests/CMakeLists.txt | 4 +- .../with_subpackages/b/CMakeLists.txt | 10 +- .../b/cmake/Dependencies.cmake | 2 +- .../with_subpackages/b/src/CMakeLists.txt | 16 +- .../b/src/ShowLibErrors.cmake | 16 +- .../with_subpackages/b/tests/CMakeLists.txt | 46 +- .../b/tests/ShowLibErrors.cmake | 30 +- .../b/tests/testlib/CMakeLists.txt | 14 +- .../b/tests/testlib/ShowLibErrors.cmake | 12 +- .../with_subpackages/c/CMakeLists.txt | 14 +- .../with_subpackages/c/ShowLibErrors.cmake | 14 +- .../c/cmake/Dependencies.cmake | 2 +- .../with_subpackages/c/tests/CMakeLists.txt | 44 +- .../with_subpackages/cmake/Dependencies.cmake | 2 +- .../packages/wrap_external/CMakeLists.txt | 76 +- .../wrap_external/cmake/Dependencies.cmake | 2 +- .../CMakeLists.txt | 16 +- .../PackagesList.cmake | 2 +- .../ProjectName.cmake | 8 +- .../TPLsList.cmake | 2 +- .../TribitsExampleProjectAddons/Version.cmake | 10 +- .../cmake/ExtraRepositoriesList.cmake | 4 +- .../packages/addon1/CMakeLists.txt | 8 +- .../packages/addon1/cmake/Dependencies.cmake | 2 +- .../packages/addon1/src/CMakeLists.txt | 4 +- .../packages/addon1/tests/CMakeLists.txt | 4 +- .../TribitsHelloWorld/PackagesList.cmake | 2 +- .../TribitsHelloWorld/ProjectName.cmake | 4 +- .../examples/TribitsHelloWorld/TPLsList.cmake | 2 +- .../hello_world/cmake/Dependencies.cmake | 2 +- .../examples/tpls/SimpleTpl/CMakeLists.txt | 8 +- .../python_utils/GeneralScriptSupport.py | 6 +- cmake/tribits/python_utils/Python2and3.py | 6 +- cmake/tribits/python_utils/SnapshotDir.py | 2 +- .../python_utils/extract_rst_cmake_doc.py | 32 +- .../python_utils/generate-docutils-output.py | 2 +- .../python_utils/generic-looping-demon.py | 4 +- cmake/tribits/python_utils/gitdist.py | 2 +- .../tribits/python_utils/lower_case_cmake.py | 195 ++ cmake/tribits/python_utils/mockprogram.py | 2 +- cmake/tribits/python_utils/tree.py | 2 +- .../refactoring/lower-case-cmake-tree.sh | 11 + cmake/tribits/tpls/FindTPLCUDA.cmake | 4 +- cmake/tribits/tpls/FindTPLMPI.cmake | 4 +- cmake/tribits/tpls/FindTPLPETSC.cmake | 4 +- .../TribitsDeprecatedTplFindModInclude.cmake | 10 +- cmake/tribits/xsdk/XSDKDefaults.cmake | 144 +- 436 files changed, 17118 insertions(+), 15410 deletions(-) create mode 100644 cmake/tribits/ctest_driver/TribitsGetCDashUrlFromTagFile.cmake delete mode 100644 cmake/tribits/doc/developers_guide/Makefile delete mode 100644 cmake/tribits/doc/developers_guide/README delete mode 100644 cmake/tribits/doc/developers_guide/TribitsMacroFunctionDocTemplate.rst delete mode 100644 cmake/tribits/doc/developers_guide/TribitsSystemMacroFunctionDocTemplate.rst delete mode 100644 cmake/tribits/doc/developers_guide/UtilsMacroFunctionDocTemplate.rst delete mode 100755 cmake/tribits/doc/developers_guide/generate-dev-guide.sh rename cmake/tribits/doc/{developers_guide => guides}/.gitignore (79%) rename cmake/tribits/doc/{developers_guide => guides}/ExtraReposList.cmake (89%) create mode 100644 cmake/tribits/doc/guides/Makefile.common_generated_files create mode 100644 cmake/tribits/doc/guides/README rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableAllPackages.txt (100%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableEpetra_EnableRTOp_DisableTeuchos.txt (86%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableEpetra_EnableRTOp_DisableTeuchos_DisableEnabledFwdDepPackages.txt (89%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableThyraCoreLibs_EnableTests.txt (100%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableThyraEpetra_EnableTests.txt (100%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableThyra_DisableEpetra_EnableTests.txt (95%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableThyra_EnableTests.txt (98%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableThyra_EnableTests_EnableBoost_ST.txt (98%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/EnableThyra_EnableTests_EnableBoost_ST_RequiredOnly.txt (98%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/ExpectedDependencies.txt (100%) rename cmake/tribits/doc/{developers_guide => guides}/ReducedMockTrilinosOutput/NoEnables.txt (100%) create mode 100644 cmake/tribits/doc/guides/TribitsCoreDetailedReference.rst create mode 100644 cmake/tribits/doc/guides/TribitsDesignConsiderations.rst create mode 100644 cmake/tribits/doc/guides/TribitsFAQ.rst rename cmake/tribits/doc/{developers_guide/TribitsDevelopersGuide.rst => guides/TribitsGuidesBody.rst} (81%) create mode 100644 cmake/tribits/doc/guides/TribitsGuidesReferences.rst create mode 100644 cmake/tribits/doc/guides/TribitsHistory.rst create mode 100644 cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst create mode 100644 cmake/tribits/doc/guides/TribitsPackageNotCMakePackage.rst create mode 100644 cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst create mode 100644 cmake/tribits/doc/guides/TribitsToolsDocumentation.rst create mode 100644 cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst create mode 100755 cmake/tribits/doc/guides/generate-guide.sh create mode 100644 cmake/tribits/doc/guides/maintainers_guide/.gitignore create mode 100644 cmake/tribits/doc/guides/maintainers_guide/Makefile create mode 120000 cmake/tribits/doc/guides/maintainers_guide/TribitsCoreDetailedReference.rst create mode 100644 cmake/tribits/doc/guides/maintainers_guide/TribitsMaintainersGuide.rst rename cmake/tribits/doc/{developers_guide => guides}/rst2latex.tex (100%) rename cmake/tribits/doc/{developers_guide => guides}/scripts/dummy_test_commit.sh (99%) create mode 100644 cmake/tribits/doc/guides/users_guide/.gitignore create mode 100644 cmake/tribits/doc/guides/users_guide/Makefile create mode 120000 cmake/tribits/doc/guides/users_guide/TribitsCoreDetailedReference.rst create mode 100644 cmake/tribits/doc/guides/users_guide/TribitsUsersGuide.rst create mode 100644 cmake/tribits/doc/sphinx/build_ref/Makefile create mode 100644 cmake/tribits/doc/sphinx/build_ref/__init__.py create mode 100644 cmake/tribits/doc/sphinx/build_ref/conf.py create mode 100644 cmake/tribits/doc/sphinx/build_ref/make.bat create mode 100755 cmake/tribits/doc/sphinx/build_sphinx_docs.sh create mode 100644 cmake/tribits/doc/sphinx/combined_docs/index.html create mode 100644 cmake/tribits/doc/sphinx/index.rst create mode 100644 cmake/tribits/doc/sphinx/maintainers_guide/Makefile create mode 100644 cmake/tribits/doc/sphinx/maintainers_guide/__init__.py create mode 100644 cmake/tribits/doc/sphinx/maintainers_guide/conf.py create mode 100644 cmake/tribits/doc/sphinx/maintainers_guide/make.bat create mode 100644 cmake/tribits/doc/sphinx/requirements.txt create mode 100644 cmake/tribits/doc/sphinx/sphinx_rst_generator.py create mode 100644 cmake/tribits/doc/sphinx/users_guide/Makefile create mode 100644 cmake/tribits/doc/sphinx/users_guide/__init__.py create mode 100644 cmake/tribits/doc/sphinx/users_guide/conf.py create mode 100644 cmake/tribits/doc/sphinx/users_guide/make.bat rename cmake/tribits/examples/TribitsExampleProject/{README => README.md} (91%) create mode 100755 cmake/tribits/python_utils/lower_case_cmake.py create mode 100755 cmake/tribits/refactoring/lower-case-cmake-tree.sh diff --git a/cmake/tribits/ReleaseNotes.txt b/cmake/tribits/ReleaseNotes.txt index 1cb5b6150a3c..021bed044532 100644 --- a/cmake/tribits/ReleaseNotes.txt +++ b/cmake/tribits/ReleaseNotes.txt @@ -2,6 +2,16 @@ Release Notes for TriBITS ---------------------------------------- +2021/06/17: + +(*) MINOR: Added tool tribits/python_utils/lower_case_cmake.py and driver + tribits/refactoring/lower-case-cmake-tree.sh that can make CMake command + calls lower-case and make macro and function definition names lowe case. + This was applied to the entire TriBITS repository (and then minor + modifications for fix a few issues). This should not impact users of + TriBITS but it does change the case of commands in the TriBITS error + messages. (See TriBITSPub/TriBITS#274) + 2021/05/15: (*) MAJOR: Changed so that all arguments passed to ctest -S command in @@ -267,10 +277,10 @@ Trilinos 11.3: TRIBITS_ADD_EXECUTABLE_AND_TEST(). (*) MINOR: TriBITS Core: Fixed the generation of headers for explicit - instantation system for subpackages: Now subpackages that use the macro + instantiation system for subpackages: Now subpackages that use the macro TRIBITS_CREATE_CLIENT_TEMPLATE_HEADERS() to generate XXX.hpp header files - with or without explicit instantation will key off of the parent package's - explicit instantation setting. In addition, packages that use the macro + with or without explicit instantiation will key off of the parent package's + explicit instantiation setting. In addition, packages that use the macro TRIBITS_CREATE_CLIENT_TEMPLATE_HEADERS() will also need to add a call to TRIBITS_ADD_EXPLICIT_INSTANTIATION_OPTION() in their top-level CMakeLists.txt file. diff --git a/cmake/tribits/TriBITS.cmake b/cmake/tribits/TriBITS.cmake index bdc6bbcf9dc0..1ef5536ea83e 100644 --- a/cmake/tribits/TriBITS.cmake +++ b/cmake/tribits/TriBITS.cmake @@ -2,20 +2,20 @@ # Top-level include file that pulls in TriBITS so it can be used by a project. # A Project's top-level CMakeLists.cmake file just does: # -# INCLUDE(${${PROJECT_NAME}_TRIBITS_DIR}/TriBITS.cmake) +# include(${${PROJECT_NAME}_TRIBITS_DIR}/TriBITS.cmake) # # and then they can call: # -# TRIBITS_PROJECT() +# tribits_project() # -IF (${PROJECT_NAME}_TRIBITS_DIR) - SET(TRIBITS_BASE_DIR_LOCAL "${${PROJECT_NAME}_TRIBITS_DIR}") -ELSEIF(CMAKE_CURRENT_LIST_DIR) - SET(TRIBITS_BASE_DIR_LOCAL "${CMAKE_CURRENT_LIST_DIR}") -ELSE() - MESSAGE(FATAL_ERROR "Please set ${PROJECT_NAME}_TRIBITS_DIR!") -ENDIF() +if (${PROJECT_NAME}_TRIBITS_DIR) + set(TRIBITS_BASE_DIR_LOCAL "${${PROJECT_NAME}_TRIBITS_DIR}") +elseif(CMAKE_CURRENT_LIST_DIR) + set(TRIBITS_BASE_DIR_LOCAL "${CMAKE_CURRENT_LIST_DIR}") +else() + message(FATAL_ERROR "Please set ${PROJECT_NAME}_TRIBITS_DIR!") +endif() -INCLUDE("${TRIBITS_BASE_DIR_LOCAL}/core/package_arch/TribitsProject.cmake") -INCLUDE("${TRIBITS_BASE_DIR_LOCAL}/Version.cmake") +include("${TRIBITS_BASE_DIR_LOCAL}/core/package_arch/TribitsProject.cmake") +include("${TRIBITS_BASE_DIR_LOCAL}/Version.cmake") diff --git a/cmake/tribits/Version.cmake b/cmake/tribits/Version.cmake index 8e9d96324972..b4943eee9230 100644 --- a/cmake/tribits/Version.cmake +++ b/cmake/tribits/Version.cmake @@ -1,9 +1,9 @@ -IF ("${REPOSITORY_NAME}" STREQUAL "") - SET(REPOSITORY_NAME TriBITS) -ENDIF() +if ("${REPOSITORY_NAME}" STREQUAL "") + set(REPOSITORY_NAME TriBITS) +endif() -SET(${REPOSITORY_NAME}_VERSION 0.9) -SET(${REPOSITORY_NAME}_MAJOR_VERSION 00) -SET(${REPOSITORY_NAME}_MAJOR_MINOR_VERSION 000900) -SET(${REPOSITORY_NAME}_VERSION_STRING "0.9 (Dev)") -SET(${REPOSITORY_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT ON) # Change to 'OFF' for a release +set(${REPOSITORY_NAME}_VERSION 0.9) +set(${REPOSITORY_NAME}_MAJOR_VERSION 00) +set(${REPOSITORY_NAME}_MAJOR_MINOR_VERSION 000900) +set(${REPOSITORY_NAME}_VERSION_STRING "0.9 (Dev)") +set(${REPOSITORY_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT ON) # Change to 'OFF' for a release diff --git a/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py b/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py index d9b0601246f4..5556a65c2141 100644 --- a/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py +++ b/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py @@ -230,7 +230,7 @@ def foreachTransform(list_inout, transformFunctor): # Remove elements from a list given a list of indexes # -# This modifies the orginal list inplace but also returns it. Therefore, if +# This modifies the original list inplace but also returns it. Therefore, if # you want to keep the original list, you better create a copy of the base # list object before passing it in. # @@ -272,7 +272,7 @@ def writeCsvFileStructureToStr(csvFileStruct): # -# Collecton of data used to create the final HTML CDash report that is +# Collection of data used to create the final HTML CDash report that is # updated and queried by various functions. # # NOTE: This is put into a class object so that these vars can be updated in @@ -280,7 +280,7 @@ def writeCsvFileStructureToStr(csvFileStruct): # class CDashReportData(object): def __init__(self): - # Gives the final result (assume passing by defualt) + # Gives the final result (assume passing by default) self.globalPass = True # This is the top of the HTML body self.htmlEmailBodyTop = "" @@ -300,7 +300,7 @@ def cdashColorPassed(): return 'green' def cdashColorFailed(): return 'red' def cdashColorNotRun(): return 'orange' def cdashColorMissing(): return 'gray' -# ToDo: Make the above return different colors for a color-blind pallette +# ToDo: Make the above return different colors for a color-blind palette def getStandardTestsetAcroList(): @@ -368,6 +368,15 @@ def getStandardTestsetTypeInfo(testsetAcro, testsetColor=None): return tsti +# Return the 'status' field from a test dict +# +# Return 'Not Run' if the 'status' field is missing. (This happens with one +# customer's tests apparently, see SESW-383.) +# +def getTestDictStatusField(testDict): + return testDict.get('status', 'Not Run') + + # Get the Test-set acronym from the fields of a test dict # def getTestsetAcroFromTestDict(testDict): @@ -429,7 +438,7 @@ def getDefaultTestDictsSortKeyList() : return ['testname', 'buildName', 'site'] # The returned Python object will be a simple nested set of Python dicts and # lists. # -# NOTE: This function can't really be unit tested becuase it actually gets +# NOTE: This function can't really be unit tested because it actually gets # data from CDash. Therefore, the code below will be structured such that it # we can avoid getting call it in any automated tests. # @@ -487,7 +496,7 @@ def readCsvFileIntoListOfDicts(csvFileName, requiredColumnHeadersList=[], # Read the rows of the CSV file into dicts dataRow = 0 for lineList in csvReader: - if not lineList: continue # Ingore blank line + if not lineList: continue # Ignore blank line stripWhiltespaceFromStrList(lineList) assertExpectedNumColsFromCsvFile(csvFileName, dataRow, lineList, columnHeadersList) @@ -661,7 +670,7 @@ def pprintPythonDataToFile(pythonData, filePath): # # If alwaysUseCacheFileIfExists==True and the file cdashQueryDataCacheFile # already exists, then the file cdashQueryDataCacheFile will be used to get -# the dta instead of callig CDash. +# the dta instead of calling CDash. # # Otherwise, CDash will be called at cdashQueryUrl to get the data and then # the data will be written to the the file cdashQueryDataCacheFile if @@ -728,7 +737,16 @@ def getCDashIndexBrowserUrl(cdashUrl, projectName, date, filterFields): def getCDashQueryTestsQueryUrl(cdashUrl, projectName, date, filterFields): if date: dateArg = "&date="+date else: dateArg = "" - return cdashUrl+"/api/v1/queryTests.php?project="+projectName+dateArg+"&"+filterFields + cdashTestUrl = cdashUrl+"/api/v1/queryTests.php?project="+projectName+dateArg+"&"+filterFields + return replaceNonUrlCharsInUrl(cdashTestUrl) + + +# Replace non-URL chars and return new URL string +def replaceNonUrlCharsInUrl(url): + urlNew = url + urlNew = urlNew.replace(' ', '%20') + # ToDo: Replace other chars as needed + return urlNew # Construct full cdash/queryTests.php browser URL given the pieces @@ -934,7 +952,7 @@ def flattenCDashQueryTestsToListOfDicts(fullCDashQueryTestsJson): # same exact key/value pairs, then the later elements will be removed from the # list. But if just the key/value pairs listed in listOfKeys are duplicated # but one or more of the other key/value pairs is different, then then an -# excpetion is thrown. +# exception is thrown. # # NOTE: This is an implementation function that is used in the class # SearchableListOfDicts. Please use that class instead of this raw function. @@ -1075,13 +1093,13 @@ def lookupDictGivenLookupDict(lookupDict, listOfKeys, listOfValues, # multi-key/value pairs to find them. # # NOTE: The key values for the list of keys given in listOfKeys must be -# unique! If it is not, then an excpetion will be thrown. +# unique! If it is not, then an exception will be thrown. # class SearchableListOfDicts(object): # Constructor # - # listOfDicts [stored, may be modifed]: List of dicts that a search + # listOfDicts [stored, may be modified]: List of dicts that a search # data-structure will be created for. # # listOfKeys [stored, will not be modified]: List of the names of keys in @@ -1111,7 +1129,7 @@ def __init__(self, listOfDicts, listOfKeys, if keyMapList: if len(listOfKeys) != len(keyMapList): raise Exception("Error, listOfKeys="+str(listOfKeys)+\ - " keyMapList="+str(listOfKeys)+" have different lenghts!" ) + " keyMapList="+str(listOfKeys)+" have different lengths!" ) self.__listOfDicts = listOfDicts self.__listOfKeys = listOfKeys self.__keyMapList = keyMapList @@ -1189,7 +1207,7 @@ def createSearchableListOfTests( testsListOfDicts, # Create a SearchableListOfDicts object for a list of build dicts allows # lookups that match the 'site' and 'buildname' fields but uses input for the -# search that are test dicts that have the fiels 'site' and 'buildName'. +# search that are test dicts that have the fields 'site' and 'buildName'. def createTestToBuildSearchableListOfDicts(buildsLOD, removeExactDuplicateElements=False, ): @@ -1342,9 +1360,9 @@ def dateFromBuildStartTime(buildStartTime): # shallow copied before it is sorted and returned. # # currentTestDate [in]: The current testing day (as a string "YYYY-MM-DD"). -# This is needed to define a frame of reference for interpeting if the test +# This is needed to define a frame of reference for interpreting if the test # is currently 'Passed', 'Failed', 'Not Run', or is 'Missing' (i.e. does not -# have any test results for curent testing date). +# have any test results for current testing date). # # testingDayStartTimeUtc [in]: The CDash project testing day start time # ":" in UTC. For example, if the CDash project testing day start @@ -1369,8 +1387,8 @@ def dateFromBuildStartTime(buildStartTime): # sortedTestHistoryLOD: The sorted list of test dicts with most recent dict # at the top. New list object with references to the same test dict # elements. Therefore, if the list elements themselves are modified after -# the function returns, then the elements in the orignal list testHistoryLOD -# will be modifed as well. +# the function returns, then the elements in the original list testHistoryLOD +# will be modified as well. # # testHistoryStats: Dict that gives statistics for the test with fields: # - 'pass_last_x_days': Number of times test 'Passed' @@ -1438,10 +1456,10 @@ def decr(testDict, key): testDict[key] = testDict[key] - 1 # testStatus (for this test based on history) if topTestDictTestingDayDT == currentTestDateDT: - testStatus = topTestDict['status'] + testStatus = getTestDictStatusField(topTestDict) else: testStatus = "Missing" - #print("testStatus = "+testStatus) + #print("testStatus = '"+testStatus+"'") # testHistoryStats @@ -1465,7 +1483,7 @@ def decr(testDict, key): testDict[key] = testDict[key] - 1 # Loop over test history for each of the kth entries and update quantities for pastTestDict_k in sortedTestHistoryLOD: - pastTestStatus_k = pastTestDict_k['status'] + pastTestStatus_k = getTestDictStatusField(pastTestDict_k) pastTestDateUtc_k = testingDayTimeObj.getTestingDayDateFromBuildStartTimeStr( pastTestDict_k['buildstarttime']) # Count the initial consecutive streaks for passing and nonpassing @@ -1500,9 +1518,9 @@ def decr(testDict, key): testDict[key] = testDict[key] - 1 return (sortedTestHistoryLOD, testHistoryStats, testStatus) -# Get a new list with unique entires from an input sorted list of test dicts. +# Get a new list with unique entries from an input sorted list of test dicts. # -# The returned list is new and does not modify any of the entires in the input +# The returned list is new and does not modify any of the entries in the input # sorted inputSortedTestHistoryLOD object. # def getUniqueSortedTestsHistoryListOfDicts(inputSortedTestHistoryLOD): @@ -1522,7 +1540,7 @@ def getUniqueSortedTestsHistoryListOfDicts(inputSortedTestHistoryLOD): if not checkCDashTestDictsAreSame(candidateTestDict, "a", lastUniqueTestDict, "b")[0]: uniqueSortedTestHistoryLOD.append(candidateTestDict) lastUniqueTestDict = candidateTestDict - # Else, this is dupliate test entry so skip + # Else, this is duplicate test entry so skip idx += 1 return uniqueSortedTestHistoryLOD @@ -1629,7 +1647,7 @@ class AddTestHistoryToTestDictFunctor(object): # Constructor which takes additional data needed to get the test history and # other stuff. # - # By default, this wil always read the data from the cache file if that file + # By default, this will always read the data from the cache file if that file # already exists. # def __init__(self, cdashUrl, projectName, date, testingDayStartTimeUtc, daysOfHistory, @@ -1695,7 +1713,7 @@ def __call__(self, testDict): testHistoryQueryUrl = \ getCDashQueryTestsQueryUrl(cdashUrl, projectName, None, testHistoryQueryFilters) - # URL to imbed in email to show the history of the test to humans + # URL to embed in email to show the history of the test to humans testHistoryBrowserUrl = \ getCDashQueryTestsBrowserUrl(cdashUrl, projectName, None, testHistoryQueryFilters) @@ -1872,7 +1890,7 @@ def __call__(self, testDict): # # {'group':"???", 'site':"???", 'buildname':"???", 'status':"???", ...} # -# wher the '...' will be the rest of the fields for builds that exist on CDash +# where the '...' will be the rest of the fields for builds that exist on CDash # but don't have full results. # # The field 'status' will either be given either: @@ -1909,7 +1927,7 @@ def getMissingExpectedBuildsList(buildsSearchableListOfDicts, expectedBuildsList if not buildSummaryDict.get('test', None): compilationDict = buildSummaryDict.get('compilation', None) if compilationDict and compilationDict['time'] == '0s': - missingPartsList.append("build") # See NOTE below for explaination! + missingPartsList.append("build") # See NOTE below for explanation! missingPartsList.append("tests") # See if any parts are missing and report if there are as a missing # build @@ -1931,7 +1949,7 @@ def getMissingExpectedBuildsList(buildsSearchableListOfDicts, expectedBuildsList # we will assume that no build data was submitted to the dashboard. # Otherwise, we can't detect when build results are missing because if just # 'configure' data is updated to CDash, then CDash will automatically create - # a 'compilation' subdict and will set the initail time to '0s'. So we + # a 'compilation' subdict and will set the initial time to '0s'. So we # can't directly tell if build has missing build/compilation data or if it # just has configure data. (I consider this to be a defect in CDash and we # may ask Kitware to fix this but for now we can just use this heuristic.) @@ -2036,7 +2054,7 @@ def downloadTestsOffCDashQueryTestsAndFlatten( cdashQueryTestsUrl, fullCDashQueryTestsJsonCacheFile, useCachedCDashData, alwaysUseCacheFileIfExists, verbose=verbose, extractCDashApiQueryData_in=extractCDashApiQueryData_in ) - # Get flattend set of tests + # Get flattened set of tests testsListOfDicts = \ flattenCDashQueryTestsToListOfDicts(fullCDashQueryTestsJson) return testsListOfDicts @@ -2203,7 +2221,7 @@ def __init__(self, colHeader, dictKey, colAlign="left"): self.colHeader = colHeader self.dictKey = dictKey if not colAlign in self.validColAlignList: - raise Excpetion( + raise Exception( "Error, colAlign="+colAlign+" not valid. Please choose from"+\ " the list ['" + "', '".join(validColAlignList) + "']!" ) self.colAlign = colAlign @@ -2437,14 +2455,14 @@ def createCDashDataSummaryHtmlTableStr( dataTitle, dataCountAcronym, # from the data). # # limitRowsToDisplay [in]: Limit of the number of rows to display. If this -# limited then this arugment is needed in order to print "(limited it ???)" in +# limited then this argument is needed in order to print "(limited it ???)" in # the table title. Should be 'None' if this listing is not limited. (default # None) # -# htmlStyle [in]: HTML sytle for the entire table (see createHtmlTableStr()) +# htmlStyle [in]: HTML style for the entire table (see createHtmlTableStr()) # (default None) # -# htmlTableStyle [in]: Sytle inside of (see createHtmlTableStr()) +# htmlTableStyle [in]: Style inside of
(see createHtmlTableStr()) # (default None) # def createCDashTestHtmlTableStr(testsetTypeInfo, testTypeCountNum, testsLOD, @@ -2562,7 +2580,7 @@ def getIssueTrackerTestsStatusReport(self): # Get the issue tracker fields from a list of test dicts and assert they are # all the same. # -# Formal Paremeters: +# Formal Parameters: # # testsLOD [in]: List of test dicts the must have the 'issue_tracker' and # the 'issuer_tracker_url' fields and they must all be identical to each @@ -2747,7 +2765,7 @@ class SingleTestsetReporter(object): # CDashReportData). # # testDictsSortKeyList [persisting]: The sort order array tests dicts (input - # to DictSortFunctor()). (Defualt getDefaultTestDictsSortKeyList()). + # to DictSortFunctor()). (Default getDefaultTestDictsSortKeyList()). # # addTestHistoryStrategy [persisting]: Strategy object that can set the test # history on a list of dicts. Must have member function @@ -2896,7 +2914,7 @@ def getTestsHtmlReportStr(self, testsSummaryTitle, detailsBlockSummary=None): # { 'testname':'test6' ... 'issue_tracker':'#1235' }, # { 'testname':'test7' ... 'issue_tracker':'#1236' }, # -# would yeild: +# would yield: # # testDictsByIssueTracker = { # '#1234' : [ @@ -2953,7 +2971,7 @@ def binTestDictsByIssueTracker(testsLOD): # { 'testname':'test6', 'status':'Missing' ... 'issue_tracker':'#1235' }, # { 'testname':'test7', 'status':'Not Run' ... 'issue_tracker':'#1236' }, # -# would yeild: +# would yield: # # testDictsByTestsetAcro = { # 'twoif' : [ diff --git a/cmake/tribits/ci_support/CheckinTest.py b/cmake/tribits/ci_support/CheckinTest.py index 8959701ace75..7566143c7551 100644 --- a/cmake/tribits/ci_support/CheckinTest.py +++ b/cmake/tribits/ci_support/CheckinTest.py @@ -297,7 +297,7 @@ def getReposStats(inOptions, tribitsGitRepos): print(gitdist.createTable(repoStatTable.getTableData())) return hasChangesToPush # NOTE: Above, we could just call 'gitdist dist-repo-status' but by - # printing the table here with the actualy gitRepoStat data, we ensure + # printing the table here with the actually gitRepoStat data, we ensure # that it gets collected correctly and that the selection of repos is # exactly the same. @@ -753,7 +753,7 @@ def writeDefaultBuildSpecificConfigFile(buildTestCaseName): else: - # ToDo: Get rid fo these! These are too specific! + # ToDo: Get rid of these! These are too specific! print("\nCreating a default skeleton file " + buildSpecificConfigFileName + " ...") @@ -864,7 +864,7 @@ def extractPackageEnablesFromChangeStatus(changedFileDiffOutputStr, inOptions_in : if inOptions_inout.enableAllPackages == 'auto': if verbose: - print("\nModifed file: '" + modifiedFileFullPath + "'\n" + + print("\nModified file: '" + modifiedFileFullPath + "'\n" + " => Enabling all " + inOptions_inout.projectName + " packages!") inOptions_inout.enableAllPackages = 'on' @@ -1163,7 +1163,7 @@ def analyzeResultsSendEmail(inOptions, buildTestCase, emailBody += "Hostname: " + getHostname() + "\n" emailBody += "Source Dir: " + inOptions.srcDir + "\n" emailBody += "Build Dir: " + os.getcwd() + "\n" - emailBody += "\nCMake Cache Varibles: " + ' '.join(cmakeOptions) + "\n" + emailBody += "\nCMake Cache Variables: " + ' '.join(cmakeOptions) + "\n" if inOptions.extraCmakeOptions: emailBody += "Extra CMake Options: " + inOptions.extraCmakeOptions + "\n" if inOptions.makeOptions: @@ -1488,7 +1488,7 @@ def runBuildTestCase(inOptions, tribitsGitRepos, buildTestCase, timings): True) if not result: preConfigurePassed = False - reuslt = readAndAppendCMakeOptions( + result = readAndAppendCMakeOptions( inOptions.projectName, os.path.join("..", getBuildSpecificConfigFileName(buildTestCaseName)), cmakeBaseOptions, @@ -1865,7 +1865,7 @@ def getEnableStatusList(inOptions, enabledPackagesList): # trailing build/test summary data. # # NOTE: This function assumes that there will be at least one blank line -# between the buid/test summay data block and the original text message. If +# between the build/test summary data block and the original text message. If # there is not, this function will throw! # def getLastCommitMessageStrFromRawCommitLogStr(rawLogOutput): @@ -2257,7 +2257,7 @@ def checkinTest(tribitsDir, inOptions, configuration={}): if doingAtLeastOnePull and pullPassed: # - print("\n3.a) Check that there are no uncommited and no new unknown " + print("\n3.a) Check that there are no uncommitted and no new unknown " "files before doing the pull(s) ...\n") # @@ -2451,7 +2451,7 @@ def checkinTest(tribitsDir, inOptions, configuration={}): elif reposAreClean and not hasChangesToPush and \ inOptions.abortGracefullyIfNoChangesToPush \ : - print("\nNot perfoming any build cases because there are no local " + print("\nNot performing any build cases because there are no local " "changes to push and --abort-gracefully-if-no-changes-to-push!\n") abortGracefullyDueToNoChangesToPush = True runBuildCases = False @@ -2566,7 +2566,7 @@ def checkinTest(tribitsDir, inOptions, configuration={}): atLeastOneConfigureBuildAttemptPassed = True if not atLeastOneConfigureBuildAttemptPassed: - print("\nThere were no successfuly attempts to configure/build/test!") + print("\nThere were no successful attempts to configure/build/test!") okayToCommit = False if not okayToCommit: @@ -2712,7 +2712,7 @@ def checkinTest(tribitsDir, inOptions, configuration={}): else: # inOptions.appendTestResults and okayToPush - print("\nAttempting to amend the final commmit message ...\n") + print("\nAttempting to amend the final commit message ...\n") repoIdx = 0 for gitRepo in tribitsGitRepos.gitRepoList(): diff --git a/cmake/tribits/ci_support/CreateIssueTrackerFromCDashQuery.py b/cmake/tribits/ci_support/CreateIssueTrackerFromCDashQuery.py index f2ae1a40fc05..ebdafb0ea823 100644 --- a/cmake/tribits/ci_support/CreateIssueTrackerFromCDashQuery.py +++ b/cmake/tribits/ci_support/CreateIssueTrackerFromCDashQuery.py @@ -22,7 +22,7 @@ # given the data provided by the argument 'issueTrackerData' of type # 'IssueTrackerData'. The format of this text can be anything such as # Markdown, RestructredText, JIRA Issue Markup, etc. The only assumption -# about formatting is in the HTML table passed in the arugment +# about formatting is in the HTML table passed in the argument # 'issueTrackerData.testHistoryHtmlTableText'. # # The object 'issueTrackerFormatter' can format the issue tracker text anyway diff --git a/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake b/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake index 88b2b8ed233c..459f8665380e 100644 --- a/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake +++ b/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake @@ -53,77 +53,77 @@ # A) Echo input options (must be specified with -D arguments to CMake command) # PROJECT_SOURCE_DIR -MESSAGE("Input: PROJECT_SOURCE_DIR = '${PROJECT_SOURCE_DIR}'") -IF ("${PROJECT_SOURCE_DIR}" STREQUAL "") - GET_FILENAME_COMPONENT( DEFAULT_PROJECT_SOURCE_DIR +message("Input: PROJECT_SOURCE_DIR = '${PROJECT_SOURCE_DIR}'") +if ("${PROJECT_SOURCE_DIR}" STREQUAL "") + get_filename_component( DEFAULT_PROJECT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE ) - MESSAGE("-- DEFAULT_PROJECT_SOURCE_DIR='${DEFAULT_PROJECT_SOURCE_DIR}'") - IF (EXISTS "${DEFAULT_PROJECT_SOURCE_DIR}/ProjectName.cmake") - MESSAGE("-- Setting default PROJECT_SOURCE_DIR=${DEFAULT_PROJECT_SOURCE_DIR}") - SET(PROJECT_SOURCE_DIR "${DEFAULT_PROJECT_SOURCE_DIR}") - ELSE() - MESSAGE(FATAL_ERROR + message("-- DEFAULT_PROJECT_SOURCE_DIR='${DEFAULT_PROJECT_SOURCE_DIR}'") + if (EXISTS "${DEFAULT_PROJECT_SOURCE_DIR}/ProjectName.cmake") + message("-- Setting default PROJECT_SOURCE_DIR=${DEFAULT_PROJECT_SOURCE_DIR}") + set(PROJECT_SOURCE_DIR "${DEFAULT_PROJECT_SOURCE_DIR}") + else() + message(FATAL_ERROR "ERROR: Cannot determine a default PROJECT_SOURCE_DIR location, please set PROJECT_SOURCE_DIR!") - ENDIF() -ELSE() - SET(PROJECT_NAME_FILE "${PROJECT_SOURCE_DIR}/ProjectName.cmake") - IF (NOT EXISTS "${PROJECT_NAME_FILE}") - MESSAGE(FATAL_ERROR + endif() +else() + set(PROJECT_NAME_FILE "${PROJECT_SOURCE_DIR}/ProjectName.cmake") + if (NOT EXISTS "${PROJECT_NAME_FILE}") + message(FATAL_ERROR "ERROR: PROJECT_SOURCE_DIR='${PROJECT_SOURCE_DIR}' is not a TriBITS project" " base dir since it is missing the file ProjectName.cmake!") - ENDIF() + endif() # Else, this is a valid project source dir location -ENDIF() +endif() # Read in ProjectName.cmake to get PROJECT_NAME var -SET(PROJECT_NAME_FILE "${PROJECT_SOURCE_DIR}/ProjectName.cmake") -INCLUDE("${PROJECT_NAME_FILE}") +set(PROJECT_NAME_FILE "${PROJECT_SOURCE_DIR}/ProjectName.cmake") +include("${PROJECT_NAME_FILE}") # Print the other vars -MESSAGE("Input: ${PROJECT_NAME}_PRE_REPOSITORIES = '${${PROJECT_NAME}_PRE_REPOSITORIES}'") -MESSAGE("Input: ${PROJECT_NAME}_EXTRA_REPOSITORIES = '${${PROJECT_NAME}_EXTRA_REPOSITORIES}'") -MESSAGE("Input: ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE = '${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE}'") +message("Input: ${PROJECT_NAME}_PRE_REPOSITORIES = '${${PROJECT_NAME}_PRE_REPOSITORIES}'") +message("Input: ${PROJECT_NAME}_EXTRA_REPOSITORIES = '${${PROJECT_NAME}_EXTRA_REPOSITORIES}'") +message("Input: ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE = '${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE}'") -IF ("${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE}" STREQUAL "") - MESSAGE(FATAL_ERROR +if ("${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE}" STREQUAL "") + message(FATAL_ERROR "ERROR: ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE cannot be empty." " Please set ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE!") -ENDIF() +endif() # # Execute the rest of the script now that everything has been asserted or found # # Get the TRIBITS_DIR (we can always find this easy since this scrit is in TriBITS) -GET_FILENAME_COMPONENT( ${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE ) -MESSAGE("-- Setting ${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}") +get_filename_component( ${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE ) +message("-- Setting ${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}") -SET( CMAKE_MODULE_PATH +set( CMAKE_MODULE_PATH "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" "${${PROJECT_NAME}_TRIBITS_DIR}/ci_support" ) -INCLUDE(TribitsConstants) -TRIBITS_ASESRT_MINIMUM_CMAKE_VERSION() -INCLUDE(TribitsCMakePolicies) +include(TribitsConstants) +tribits_asesrt_minimum_cmake_version() +include(TribitsCMakePolicies) -INCLUDE(TribitsGlobalMacros) -INCLUDE(TribitsPrintDependencyInfo) -INCLUDE(TribitsWriteXmlDependenciesFiles) +include(TribitsGlobalMacros) +include(TribitsPrintDependencyInfo) +include(TribitsWriteXmlDependenciesFiles) # Generate the dependencies file -SET(${PROJECT_NAME}_ASSERT_MISSING_PACKAGES FALSE) -SET(${PROJECT_NAME}_OUTPUT_DEPENDENCY_FILES FALSE) -IF (NOT ${PROJECT_NAME}_PRE_REPOSITORIES) # Make sure is defined! - SET(${PROJECT_NAME}_PRE_REPOSITORIES "") -ENDIF() -IF (NOT ${PROJECT_NAME}_EXTRA_REPOSITORIES) # Make sure is defined! - SET(${PROJECT_NAME}_EXTRA_REPOSITORIES "") -ENDIF() -TRIBITS_READ_IN_NATIVE_REPOSITORIES() -TRIBITS_COMBINE_NATIVE_AND_EXTRA_REPOS() -TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() -TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() -TRIBITS_WRITE_XML_DEPENDENCY_FILES() +set(${PROJECT_NAME}_ASSERT_MISSING_PACKAGES FALSE) +set(${PROJECT_NAME}_OUTPUT_DEPENDENCY_FILES FALSE) +if (NOT ${PROJECT_NAME}_PRE_REPOSITORIES) # Make sure is defined! + set(${PROJECT_NAME}_PRE_REPOSITORIES "") +endif() +if (NOT ${PROJECT_NAME}_EXTRA_REPOSITORIES) # Make sure is defined! + set(${PROJECT_NAME}_EXTRA_REPOSITORIES "") +endif() +tribits_read_in_native_repositories() +tribits_combine_native_and_extra_repos() +tribits_read_all_project_deps_files_create_deps_graph() +tribits_print_initial_dependency_info() +tribits_write_xml_dependency_files() diff --git a/cmake/tribits/ci_support/TribitsGetExtraReposForCheckinTest.cmake b/cmake/tribits/ci_support/TribitsGetExtraReposForCheckinTest.cmake index 757fe1a04a40..7ba66a93d313 100644 --- a/cmake/tribits/ci_support/TribitsGetExtraReposForCheckinTest.cmake +++ b/cmake/tribits/ci_support/TribitsGetExtraReposForCheckinTest.cmake @@ -47,123 +47,123 @@ # # Echo input commandline -MESSAGE("*** Generate a Python datastructure containing TriBITS/git repos ...") -IF (NOT SUPPRESS_PRINT_VAR_OUTPUT) - MESSAGE("PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}") - MESSAGE("TRIBITS_BASE_DIR = ${TRIBITS_BASE_DIR}") - MESSAGE("EXTRA_REPOS_FILE = ${EXTRA_REPOS_FILE}") - MESSAGE("EXTRA_REPOS = ${EXTRA_REPOS}") - MESSAGE("EXTRA_REPOS_PYTHON_OUT_FILE = ${EXTRA_REPOS_PYTHON_OUT_FILE}") - MESSAGE("ENABLE_KNOWN_EXTERNAL_REPOS_TYPE = ${ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}") - MESSAGE("IGNORE_MISSING_EXTRA_REPOSITORIES = ${IGNORE_MISSING_EXTRA_REPOSITORIES}") - MESSAGE("CHECK_EXTRAREPOS_EXIST = ${CHECK_EXTRAREPOS_EXIST}") -ENDIF() - -IF ("${CHECK_EXTRAREPOS_EXIST}" STREQUAL "") - SET(CHECK_EXTRAREPOS_EXIST TRUE) -ENDIF() +message("*** Generate a Python datastructure containing TriBITS/git repos ...") +if (NOT SUPPRESS_PRINT_VAR_OUTPUT) + message("PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}") + message("TRIBITS_BASE_DIR = ${TRIBITS_BASE_DIR}") + message("EXTRA_REPOS_FILE = ${EXTRA_REPOS_FILE}") + message("EXTRA_REPOS = ${EXTRA_REPOS}") + message("EXTRA_REPOS_PYTHON_OUT_FILE = ${EXTRA_REPOS_PYTHON_OUT_FILE}") + message("ENABLE_KNOWN_EXTERNAL_REPOS_TYPE = ${ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}") + message("IGNORE_MISSING_EXTRA_REPOSITORIES = ${IGNORE_MISSING_EXTRA_REPOSITORIES}") + message("CHECK_EXTRAREPOS_EXIST = ${CHECK_EXTRAREPOS_EXIST}") +endif() + +if ("${CHECK_EXTRAREPOS_EXIST}" STREQUAL "") + set(CHECK_EXTRAREPOS_EXIST TRUE) +endif() # Set up necessary variables -INCLUDE(${PROJECT_SOURCE_DIR}/ProjectName.cmake) -IF (NOT SUPPRESS_PRINT_VAR_OUTPUT) - MESSAGE("PROJECT_NAME = ${PROJECT_NAME}") -ENDIF() -SET(${PROJECT_NAME}_TRIBITS_DIR ${TRIBITS_BASE_DIR}) -SET(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE ${ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}) -SET(${PROJECT_NAME}_EXTRAREPOS_FILE ${EXTRA_REPOS_FILE}) -SET(${PROJECT_NAME}_EXTRA_REPOSITORIES ${EXTRA_REPOS}) -SET(${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES ${IGNORE_MISSING_EXTRA_REPOSITORIES}) -SET(${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST ${CHECK_EXTRAREPOS_EXIST}) -#MESSAGE("${PROJECT_NAME}_TRIBITS_DIR = ${${PROJECT_NAME}_TRIBITS_DIR}") +include(${PROJECT_SOURCE_DIR}/ProjectName.cmake) +if (NOT SUPPRESS_PRINT_VAR_OUTPUT) + message("PROJECT_NAME = ${PROJECT_NAME}") +endif() +set(${PROJECT_NAME}_TRIBITS_DIR ${TRIBITS_BASE_DIR}) +set(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE ${ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}) +set(${PROJECT_NAME}_EXTRAREPOS_FILE ${EXTRA_REPOS_FILE}) +set(${PROJECT_NAME}_EXTRA_REPOSITORIES ${EXTRA_REPOS}) +set(${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES ${IGNORE_MISSING_EXTRA_REPOSITORIES}) +set(${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST ${CHECK_EXTRAREPOS_EXIST}) +#message("${PROJECT_NAME}_TRIBITS_DIR = ${${PROJECT_NAME}_TRIBITS_DIR}") -#SET(${PROJECT_NAME}_VERBOSE_CONFIGURE TRUE) +#set(${PROJECT_NAME}_VERBOSE_CONFIGURE TRUE) # # B) Include files from TriBITS # -SET( CMAKE_MODULE_PATH +set( CMAKE_MODULE_PATH "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" ) -INCLUDE(TribitsCMakePolicies) -INCLUDE(Split) -INCLUDE(AppendStringVar) -INCLUDE(SetDefaultAndFromEnv) # Used in ExtraRepositoriesList.cmake file? -INCLUDE(TribitsProcessExtraRepositoriesList) +include(TribitsCMakePolicies) +include(Split) +include(AppendStringVar) +include(SetDefaultAndFromEnv) # Used in ExtraRepositoriesList.cmake file? +include(TribitsProcessExtraRepositoriesList) # Need to split this argument -SPLIT("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" "," +split("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" "," ${PROJECT_NAME}_EXTRA_REPOSITORIES) -IF (NOT ${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) - SET(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE "Continuous") -ENDIF() +if (NOT ${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) + set(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE "Continuous") +endif() # # C) Read in and process the extra repos list variable and process the list # -TRIBITS_GET_AND_PROCESS_EXTRA_REPOSITORIES_LISTS() +tribits_get_and_process_extra_repositories_lists() # # D) Write the python dictionary/string that will be evaluated by checkin-test.py # -SET(EXTRA_REPOS_PYTHON_STRING) +set(EXTRA_REPOS_PYTHON_STRING) -APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING +append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "[\n") -IF ("${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}" STREQUAL "" +if ("${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}" STREQUAL "" AND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT}) -ENDIF() +endif() -SET(EXTRAREPO_IDX 0) -FOREACH(EXTRAREPO_NAME ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}) +set(EXTRAREPO_IDX 0) +foreach(EXTRAREPO_NAME ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}) # Extract the data for current extra repo - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_IDX} EXTRAREPO_DIR ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${EXTRAREPO_IDX} EXTRAREPO_REPOTYPE ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${EXTRAREPO_IDX} EXTRAREPO_REPOURL ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_IDX} EXTRAREPO_HASPKGS ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${EXTRAREPO_IDX} EXTRAREPO_PREPOST ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES ${EXTRAREPO_IDX} EXTRAREPO_CATEGORY ) # Write the dictorary entries for this extra rep - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "{" ) - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "'NAME' : '${EXTRAREPO_NAME}', " ) - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "'DIR' : '${EXTRAREPO_DIR}', " ) - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "'REPOTYPE' : '${EXTRAREPO_REPOTYPE}', " ) - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "'REPOURL' : '${EXTRAREPO_REPOURL}', " ) - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "'HASPKGS' : '${EXTRAREPO_HASPKGS}', " ) - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "'PREPOST' : '${EXTRAREPO_PREPOST}', " ) - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "'CATEGORY' : '${EXTRAREPO_CATEGORY}', " ) - APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING + append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "},\n" ) - MATH(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") + math(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") -ENDFOREACH() +endforeach() -APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING +append_string_var_ext(EXTRA_REPOS_PYTHON_STRING "]\n") # @@ -171,16 +171,16 @@ APPEND_STRING_VAR_EXT(EXTRA_REPOS_PYTHON_STRING # # NOTE: This must be the only output from this script since it gets evaluated. # -# NOTE: You could use MESSAGE(STATUS ...) to print to stdout but then it would +# NOTE: You could use message(STATUS ...) to print to stdout but then it would # also print an annoying '-- ' at the beginning which might not be porable to just # remove it. CMake is not a great general scripting language :-( # -MESSAGE("") -IF (EXTRA_REPOS_PYTHON_OUT_FILE) - MESSAGE("Writing Python datastructure to ${EXTRA_REPOS_PYTHON_OUT_FILE} ...") - FILE(WRITE ${EXTRA_REPOS_PYTHON_OUT_FILE} "${EXTRA_REPOS_PYTHON_STRING}") -ELSE() - MESSAGE("*** Extra Repositories Python Dictionary") - MESSAGE("${EXTRA_REPOS_PYTHON_STRING}") -ENDIF() +message("") +if (EXTRA_REPOS_PYTHON_OUT_FILE) + message("Writing Python datastructure to ${EXTRA_REPOS_PYTHON_OUT_FILE} ...") + file(WRITE ${EXTRA_REPOS_PYTHON_OUT_FILE} "${EXTRA_REPOS_PYTHON_STRING}") +else() + message("*** Extra Repositories Python Dictionary") + message("${EXTRA_REPOS_PYTHON_STRING}") +endif() diff --git a/cmake/tribits/ci_support/TribitsPackageFilePathUtils.py b/cmake/tribits/ci_support/TribitsPackageFilePathUtils.py index 98ee850ce01a..e2a662ab4641 100644 --- a/cmake/tribits/ci_support/TribitsPackageFilePathUtils.py +++ b/cmake/tribits/ci_support/TribitsPackageFilePathUtils.py @@ -50,7 +50,7 @@ # -# Default logic to determine if a changed file should tigger testing all of +# Default logic to determine if a changed file should trigger testing all of # the packages. # # In general, any file at the top level / or under the @@ -61,23 +61,23 @@ # # PackagesList.cmake: This file gets modified frequently to add new packages # and rearrange packages. We don't need to do a global rebuild because this -# list of pakages is validated if we do even a single rebuild. If a package +# list of packages is validated if we do even a single rebuild. If a package # line gets removed, the code that reads the Dependencies.cmake files will # fail and stop. However, this has the risk that if only the test test # category changes (e.g. from 'ST' to 'PT') then this would not trigger a # rebuild. But if the package itself was also modified, then that would be -# sufficent for testing. +# sufficient for testing. # # TPLsList.cmake: This file also gets modified frequently. We don't need to # enable all packages either for the same reason as for the PackagesList.cmake # file. # # cmake/ctest/: These drive nightly automated builds and should not require -# testing every pakage. +# testing every package. # # cmake/TPLs/*.cmake: Any FileTPLSOMETHING.cmake file is assumed not to be # needed for Primary Tested code and therefore does not need to trigger a -# global rebulid. +# global rebuild. # class DefaultProjectCiFileChangeLogic: diff --git a/cmake/tribits/ci_support/TribitsStripCommentsFromCMakeCacheFile.cmake b/cmake/tribits/ci_support/TribitsStripCommentsFromCMakeCacheFile.cmake index fb1ebb837585..4395b543a68b 100644 --- a/cmake/tribits/ci_support/TribitsStripCommentsFromCMakeCacheFile.cmake +++ b/cmake/tribits/ci_support/TribitsStripCommentsFromCMakeCacheFile.cmake @@ -38,15 +38,15 @@ # @HEADER -INCLUDE(AppendStringVar) +include(AppendStringVar) -FUNCTION(TRIBITS_STRIP_COMMENTS_FROM_CMAKE_CACHE_FILE INPUT_FILE OUTPUT_FILE) - EXECUTE_PROCESS( +function(tribits_strip_comments_from_cmake_cache_file INPUT_FILE OUTPUT_FILE) + execute_process( COMMAND cat "${INPUT_FILE}" COMMAND grep -v "^#" COMMAND grep -v "^//" COMMAND grep -v "^$" OUTPUT_FILE "${OUTPUT_FILE}" ) -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake b/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake index 6f5672e71d2e..9d9df8e5f2d5 100644 --- a/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake +++ b/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake @@ -44,48 +44,48 @@ # -FUNCTION(TRIBITS_WRITE_DEPS_TO_XML_STRING PACKAGE_NAME LIST_TYPE +function(tribits_write_deps_to_xml_string PACKAGE_NAME LIST_TYPE XML_VAR ) - SET(LOC_XML "${${XML_VAR}}") + set(LOC_XML "${${XML_VAR}}") - SET(DEPS_VAR ${PACKAGE_NAME}_${LIST_TYPE}) - ASSERT_DEFINED(DEPS_VAR) - SET(DEPS ${${DEPS_VAR}}) + set(DEPS_VAR ${PACKAGE_NAME}_${LIST_TYPE}) + assert_defined(DEPS_VAR) + set(DEPS ${${DEPS_VAR}}) - #PRINT_VAR(PACKAGE_NAME) - #PRINT_VAR(DEPS) + #print_var(PACKAGE_NAME) + #print_var(DEPS) - IF (NOT DEPS) + if (NOT DEPS) - LIST(APPEND LOC_XML + list(APPEND LOC_XML " <${LIST_TYPE}/>\n" ) - ELSE() + else() - SET(VALUE_STR "") + set(VALUE_STR "") - FOREACH(DEP ${DEPS}) + foreach(DEP ${DEPS}) - IF(VALUE_STR) - SET(VALUE_STR "${VALUE_STR},") - ENDIF() + if(VALUE_STR) + set(VALUE_STR "${VALUE_STR},") + endif() - SET(VALUE_STR "${VALUE_STR}${DEP}") + set(VALUE_STR "${VALUE_STR}${DEP}") - ENDFOREACH() + endforeach() - LIST(APPEND LOC_XML + list(APPEND LOC_XML " <${LIST_TYPE} value=\"${VALUE_STR}\"/>\n" ) - ENDIF() + endif() - IF (LOC_XML) - SET(${XML_VAR} "${LOC_XML}" PARENT_SCOPE) - ENDIF() + if (LOC_XML) + set(${XML_VAR} "${LOC_XML}" PARENT_SCOPE) + endif() -ENDFUNCTION() +endfunction() # @@ -93,117 +93,117 @@ ENDFUNCTION() # an XML file for other tools to use. # -FUNCTION(TRIBITS_DUMP_DEPS_XML_FILE) +function(tribits_dump_deps_xml_file) - SET(DEPS_XM) + set(DEPS_XM) - GET_FILENAME_COMPONENT(PROJECT_BASE_DIR_NAME "${${PROJECT_NAME}_SOURCE_DIR}" NAME) + get_filename_component(PROJECT_BASE_DIR_NAME "${${PROJECT_NAME}_SOURCE_DIR}" NAME) - LIST(APPEND DEPS_XML + list(APPEND DEPS_XML "\n" ) - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) - #MESSAGE("") - #PRINT_VAR(TRIBITS_PACKAGE) + #message("") + #print_var(TRIBITS_PACKAGE) - LIST(APPEND DEPS_XML + list(APPEND DEPS_XML " \n") - TRIBITS_WRITE_DEPS_TO_XML_STRING(${TRIBITS_PACKAGE} LIB_REQUIRED_DEP_PACKAGES DEPS_XML) - TRIBITS_WRITE_DEPS_TO_XML_STRING(${TRIBITS_PACKAGE} LIB_OPTIONAL_DEP_PACKAGES DEPS_XML) - TRIBITS_WRITE_DEPS_TO_XML_STRING(${TRIBITS_PACKAGE} TEST_REQUIRED_DEP_PACKAGES DEPS_XML) - TRIBITS_WRITE_DEPS_TO_XML_STRING(${TRIBITS_PACKAGE} TEST_OPTIONAL_DEP_PACKAGES DEPS_XML) - TRIBITS_WRITE_DEPS_TO_XML_STRING(${TRIBITS_PACKAGE} LIB_REQUIRED_DEP_TPLS DEPS_XML) - TRIBITS_WRITE_DEPS_TO_XML_STRING(${TRIBITS_PACKAGE} LIB_OPTIONAL_DEP_TPLS DEPS_XML) - TRIBITS_WRITE_DEPS_TO_XML_STRING(${TRIBITS_PACKAGE} TEST_REQUIRED_DEP_TPLS DEPS_XML) - TRIBITS_WRITE_DEPS_TO_XML_STRING(${TRIBITS_PACKAGE} TEST_OPTIONAL_DEP_TPLS DEPS_XML) + tribits_write_deps_to_xml_string(${TRIBITS_PACKAGE} LIB_REQUIRED_DEP_PACKAGES DEPS_XML) + tribits_write_deps_to_xml_string(${TRIBITS_PACKAGE} LIB_OPTIONAL_DEP_PACKAGES DEPS_XML) + tribits_write_deps_to_xml_string(${TRIBITS_PACKAGE} TEST_REQUIRED_DEP_PACKAGES DEPS_XML) + tribits_write_deps_to_xml_string(${TRIBITS_PACKAGE} TEST_OPTIONAL_DEP_PACKAGES DEPS_XML) + tribits_write_deps_to_xml_string(${TRIBITS_PACKAGE} LIB_REQUIRED_DEP_TPLS DEPS_XML) + tribits_write_deps_to_xml_string(${TRIBITS_PACKAGE} LIB_OPTIONAL_DEP_TPLS DEPS_XML) + tribits_write_deps_to_xml_string(${TRIBITS_PACKAGE} TEST_REQUIRED_DEP_TPLS DEPS_XML) + tribits_write_deps_to_xml_string(${TRIBITS_PACKAGE} TEST_OPTIONAL_DEP_TPLS DEPS_XML) - LIST(APPEND DEPS_XML + list(APPEND DEPS_XML " \n" " \n" " \n" ) - LIST(APPEND DEPS_XML + list(APPEND DEPS_XML " \n" ) - LIST(APPEND DEPS_XML + list(APPEND DEPS_XML " \n" ) - ENDFOREACH() + endforeach() - LIST(APPEND DEPS_XML + list(APPEND DEPS_XML "\n" ) - #PRINT_VAR(DEPS_XML) - STRING(REPLACE "\n;" "\n" DEPS_XML "${DEPS_XML}") - FILE(WRITE ${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE} "${DEPS_XML}" ) + #print_var(DEPS_XML) + string(REPLACE "\n;" "\n" DEPS_XML "${DEPS_XML}") + file(WRITE ${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE} "${DEPS_XML}" ) -ENDFUNCTION() +endfunction() -# @MACRO: TRIBITS_WRITE_XML_DEPENDENCY_FILES() +# @MACRO: tribits_write_xml_dependency_files() # # Usage:: # -# TRIBITS_WRITE_XML_DEPENDENCY_FILES() +# tribits_write_xml_dependency_files() # # Macro that output XML dependency files if asked based in the global project # package dependency graph previously constructed.. # -MACRO(TRIBITS_WRITE_XML_DEPENDENCY_FILES) +macro(tribits_write_xml_dependency_files) - TRIBITS_CONFIG_CODE_START_TIMER(WRITE_DEPENDENCY_FILES_TIME_START_SECONDS) + tribits_config_code_start_timer(WRITE_DEPENDENCY_FILES_TIME_START_SECONDS) - #PRINT_VAR(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) - IF (${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) - IF (NOT IS_ABSOLUTE ${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE}) - SET(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE + #print_var(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) + if (${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) + if (NOT IS_ABSOLUTE ${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE}) + set(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE}) - ENDIF() - MESSAGE("" ) - MESSAGE("Dumping the XML dependencies file ${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE} ..." ) - TRIBITS_DUMP_DEPS_XML_FILE() - ENDIF() - - #PRINT_VAR(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE) - IF (${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE AND ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) - IF (NOT IS_ABSOLUTE ${${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE}) - SET(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE + endif() + message("" ) + message("Dumping the XML dependencies file ${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE} ..." ) + tribits_dump_deps_xml_file() + endif() + + #print_var(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE) + if (${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE AND ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) + if (NOT IS_ABSOLUTE ${${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE}) + set(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE}) - ENDIF() - MESSAGE("" ) - MESSAGE("Dumping the HTML dependencies webpage file ${${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE} ..." ) - EXECUTE_PROCESS( + endif() + message("" ) + message("Dumping the HTML dependencies webpage file ${${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE} ..." ) + execute_process( COMMAND ${PYTHON_EXECUTABLE} ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CI_SUPPORT_DIR}/dump-package-dep-table.py --input-xml-deps-file=${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE} --output-html-deps-file=${${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE} ) - ENDIF() - - #PRINT_VAR(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE) - IF (${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE AND ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) - IF (NOT IS_ABSOLUTE ${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE}) - SET(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE}) - ENDIF() - MESSAGE("" ) - MESSAGE("Dumping the CDash XML dependencies file ${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE} ..." ) - EXECUTE_PROCESS( + endif() + + #print_var(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE) + if (${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE AND ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE) + if (NOT IS_ABSOLUTE ${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE}) + set(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE}) + endif() + message("" ) + message("Dumping the CDash XML dependencies file ${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE} ..." ) + execute_process( COMMAND ${PYTHON_EXECUTABLE} ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CTEST_DRIVER_DIR}/dump-cdash-deps-xml-file.py --input-xml-deps-file=${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE} --output-cdash-deps-xml-file=${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE} ) - ENDIF() + endif() - IF (${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE + if (${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE OR ${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE OR ${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE ) - TRIBITS_CONFIG_CODE_STOP_TIMER(WRITE_DEPENDENCY_FILES_TIME_START_SECONDS + tribits_config_code_stop_timer(WRITE_DEPENDENCY_FILES_TIME_START_SECONDS "\nTotal time to write dependency files") - ENDIF() + endif() -ENDMACRO() +endmacro() diff --git a/cmake/tribits/ci_support/cdash_analyze_and_report.py b/cmake/tribits/ci_support/cdash_analyze_and_report.py index 1c2e69214588..2e22cfca1fed 100755 --- a/cmake/tribits/ci_support/cdash_analyze_and_report.py +++ b/cmake/tribits/ci_support/cdash_analyze_and_report.py @@ -234,14 +234,14 @@ def injectCmndLineOptionsInParser(clp, gitoliteRootDefault=""): "--write-unexpected-builds-to-file", dest="writeUnexpectedBuildsToFile", type="string", default="", help="Write a CSV file with a list of unexpected builds 'bu'." \ - +" This is to make it easy to add new entires to the file read by" \ + +" This is to make it easy to add new entries to the file read by" \ +" the option --expected-builds-file=. [default = '']" ) clp.add_option( "--write-failing-tests-without-issue-trackers-to-file", dest="writeFailingTestsWithoutIssueTrackersToFile", type="string", default="", help="Write a CSV file with a list of tests with issue trackers failed 'twif'." \ - +" This is to make it easy to add new entires to the file read by" \ + +" This is to make it easy to add new entries to the file read by" \ +" the option --tests-with-issue-trackers-file=. [default = '']" ) clp.add_option( @@ -455,7 +455,7 @@ def getTestHistory(self, testLOD): try: - # Beginning of top full bulid and tests CDash links paragraph + # Beginning of top full build and tests CDash links paragraph cdashReportData.htmlEmailBodyTop += "

\n" # diff --git a/cmake/tribits/ci_support/cdash_build_testing_date.py b/cmake/tribits/ci_support/cdash_build_testing_date.py index c9fc3638b77c..0405de3f7d24 100755 --- a/cmake/tribits/ci_support/cdash_build_testing_date.py +++ b/cmake/tribits/ci_support/cdash_build_testing_date.py @@ -262,11 +262,11 @@ def getTestingDayDateFromBuildStartTimeStr( # To extract just the year, month and day from the returned datetime object as # a datetime object, use the function getDateOnlyFromDateTime(). # -# To extract the "--

" string from teh returned datetime object, +# To extract the "--
" string from the returned datetime object, # use the function getDateStrFromDateTime(). # def getRelativeCDashBuildStartTime( - cdashBuildStartTimeUtc, # CDash build start time in UTC (datetime objet) + cdashBuildStartTimeUtc, # CDash build start time in UTC (datetime object) cdashProjectStartTimeUtc, # CDash start time in UTC (timedelta object) dayIncr, # Day increment in past or future (timedelta object) ): diff --git a/cmake/tribits/ci_support/checkin-test.py b/cmake/tribits/ci_support/checkin-test.py index 87ca72d2966b..5f50525a4ba8 100755 --- a/cmake/tribits/ci_support/checkin-test.py +++ b/cmake/tribits/ci_support/checkin-test.py @@ -743,7 +743,7 @@ def runProjectTestsWithCommandLineArgs(commandLineArgs, configuration = {}): "--project-name", dest="projectName", action="store", help="Set the project's name. This is used to locate various files."+\ " If not set, then it reads the project name from the PROJECT_NAME"+\ - " varaible set in the file SRCDIR/ProjectName.cmake.", + " variable set in the file SRCDIR/ProjectName.cmake.", default=None) clp.add_option( @@ -819,7 +819,7 @@ def runProjectTestsWithCommandLineArgs(commandLineArgs, configuration = {}): "--disable-packages", dest="disablePackages", type="string", default="", help="List of comma separated packages to explicitly disable" \ +" (example, 'Tpetra,NOX'). This list of disables will be appended after" \ - +" all of the listed enables no mater how they are determined (see" \ + +" all of the listed enables no matter how they are determined (see" \ +" --enable-packages option). NOTE: Only use this option to remove packages" \ +" that will not build for some reason. You can disable tests that run" \ +" by using the CTest option -E passed through the --ctest-options argument" \ @@ -900,7 +900,7 @@ def runProjectTestsWithCommandLineArgs(commandLineArgs, configuration = {}): clp.add_option( "--use-ninja", dest="useNinja", action="store_true", help="If set, then -GNinja used for backend build tool." \ - +" Note: The comamnd 'ninja' must be in the default path." , + +" Note: The command 'ninja' must be in the default path." , default=False ) clp.add_option( diff --git a/cmake/tribits/ci_support/clone_extra_repos.py b/cmake/tribits/ci_support/clone_extra_repos.py index ba526746bb9b..baf09359b789 100755 --- a/cmake/tribits/ci_support/clone_extra_repos.py +++ b/cmake/tribits/ci_support/clone_extra_repos.py @@ -324,7 +324,7 @@ def parseRawSshGitoliteRootInfoOutput(rawSshGitoliteRootInfoOutput, verbose=Fals continue # Parse the repos if parsingRepos: - # The permisions and the repo name are split by a tab such as: + # The permissions and the repo name are split by a tab such as: # R W ExtraRepo1 repoSplit = line.split("\t") #print("repoSplit =", repoSplit) diff --git a/cmake/tribits/ci_support/get-tribits-packages-from-files-list.py b/cmake/tribits/ci_support/get-tribits-packages-from-files-list.py index 1fcb7742702e..9ebbd91fb915 100755 --- a/cmake/tribits/ci_support/get-tribits-packages-from-files-list.py +++ b/cmake/tribits/ci_support/get-tribits-packages-from-files-list.py @@ -87,7 +87,7 @@ clp.add_option( "--project-dir", dest="projectDir", type="string", default="", - help="Base proejct directory. Used to acces more specialized logic beyond" \ + help="Base project directory. Used to access more specialized logic beyond" \ +" what is known in the . If empty '', then it will be set" \ +" automatically if TriBITS is is the standard location w.r.t. the project" \ +" in relation to this script run from the TriBITS dir.") diff --git a/cmake/tribits/ci_support/is_checkin_tested_commit.py b/cmake/tribits/ci_support/is_checkin_tested_commit.py index 7cb6fe11b4c8..6d195e277340 100755 --- a/cmake/tribits/ci_support/is_checkin_tested_commit.py +++ b/cmake/tribits/ci_support/is_checkin_tested_commit.py @@ -78,10 +78,10 @@ "Build/Test Cases Summary" in the log message which is written there by the checkin-test.py script when -it ammends the top commit message before it pushes. +it amends the top commit message before it pushes. This script is used with 'git bisect' to help week out commits that might not -build or pass all of the tests and therefore not approriate to bother testing +build or pass all of the tests and therefore not appropriate to bother testing when doing a 'git bisect' on to find an issue for a customer. Basically, this script should be added to the top of a 'test-commit.sh' script diff --git a/cmake/tribits/common_tpls/FindTPLBLAS.cmake b/cmake/tribits/common_tpls/FindTPLBLAS.cmake index 525ec7f8b32a..78ba327150e2 100644 --- a/cmake/tribits/common_tpls/FindTPLBLAS.cmake +++ b/cmake/tribits/common_tpls/FindTPLBLAS.cmake @@ -54,32 +54,32 @@ # @HEADER -SET(REQUIRED_LIBS_NAMES "blas blas_win32") +set(REQUIRED_LIBS_NAMES "blas blas_win32") # # Second, search for BLAS components (if allowed) using the standard -# FIND_PACKAGE(BLAS ...). +# find_package(BLAS ...). # -TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE(BLAS BLAS_ALLOW_PREFIND) -IF (BLAS_ALLOW_PREFIND) +tribits_tpl_allow_pre_find_package(BLAS BLAS_ALLOW_PREFIND) +if (BLAS_ALLOW_PREFIND) - MESSAGE("-- Using FIND_PACKAGE(BLAS ...) ...") + message("-- Using find_package(BLAS ...) ...") - FIND_PACKAGE(BLAS) + find_package(BLAS) - IF (BLAS_FOUND) + if (BLAS_FOUND) # Tell TriBITS that we found BLAS and there no need to look any further! - SET(TPL_BLAS_INCLUDE_DIRS "" CACHE PATH + set(TPL_BLAS_INCLUDE_DIRS "" CACHE PATH "BLAS include dirs") - SET(TPL_BLAS_LIBRARIES ${BLAS_LIBRARIES} CACHE FILEPATH + set(TPL_BLAS_LIBRARIES ${BLAS_LIBRARIES} CACHE FILEPATH "BLAS libraries") - SET(TPL_BLAS_LIBRARY_DIRS "" CACHE PATH + set(TPL_BLAS_LIBRARY_DIRS "" CACHE PATH "BLAS library dirs") - ENDIF() + endif() -ENDIF() +endif() -IF (MSVC AND NOT +if (MSVC AND NOT (BLAS_LIBRARY_DIRS OR (NOT "${BLAS_LIBRARY_NAMES}" STREQUAL "blas blas_win32" AND NOT "${BLAS_LIBRARY_NAMES}" STREQUAL "") OR @@ -94,18 +94,18 @@ IF (MSVC AND NOT # be called every configure or this does not work! # If the user has specified alternate name or location of their blas that # will be used instead. - FIND_PACKAGE(CLAPACK 3.2.1 NO_MODULE) - IF (CLAPACK_FOUND) - ADVANCED_SET(TPL_BLAS_LIBRARIES blas + find_package(CLAPACK 3.2.1 NO_MODULE) + if (CLAPACK_FOUND) + advanced_set(TPL_BLAS_LIBRARIES blas CACHE FILEPATH "Set from MSVC CLAPACK specialization") - ENDIF() -ENDIF() + endif() +endif() # -# Third, call TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() +# Third, call tribits_tpl_find_include_dirs_and_libraries() # -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( BLAS +tribits_tpl_find_include_dirs_and_libraries( BLAS REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} ) -# NOTE: If FIND_PACKAGE(BLAS ...) was called and successfully found BLAS, then -# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() will use the already-set +# NOTE: If find_package(BLAS ...) was called and successfully found BLAS, then +# tribits_tpl_find_include_dirs_and_libraries() will use the already-set # variables TPL_BLAS_INCLUDE_DIRS and TPL_BLAS_LIBRARIES and then print them diff --git a/cmake/tribits/common_tpls/FindTPLBinUtils.cmake b/cmake/tribits/common_tpls/FindTPLBinUtils.cmake index 0d9e47c33123..db087d783c8c 100644 --- a/cmake/tribits/common_tpls/FindTPLBinUtils.cmake +++ b/cmake/tribits/common_tpls/FindTPLBinUtils.cmake @@ -61,7 +61,7 @@ -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( BinUtils +tribits_tpl_find_include_dirs_and_libraries( BinUtils REQUIRED_HEADERS link.h bfd.h MUST_FIND_ALL_HEADERS REQUIRED_LIBS_NAMES bfd iberty @@ -75,14 +75,14 @@ TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( BinUtils # -INCLUDE(CheckCXXSourceCompiles) -INCLUDE(MultilineSet) -INCLUDE(PrintVar) +include(CheckCXXSourceCompiles) +include(MultilineSet) +include(PrintVar) -FUNCTION(CHECK_FOR_BINUTILS_STACKTRACE VARNAME) +function(check_for_binutils_stacktrace VARNAME) - SET(SOURCE + set(SOURCE " #include #include @@ -169,25 +169,25 @@ int main() " ) - SET(CMAKE_REQUIRED_INCLUDES ${TPL_BinUtils_INCLUDE_DIRS}) - SET(CMAKE_REQUIRED_LIBRARIES ${TPL_BinUtils_LIBRARIES}) - CHECK_CXX_SOURCE_COMPILES("${SOURCE}" ${VARNAME}) + set(CMAKE_REQUIRED_INCLUDES ${TPL_BinUtils_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${TPL_BinUtils_LIBRARIES}) + check_cxx_source_compiles("${SOURCE}" ${VARNAME}) -ENDFUNCTION() +endfunction() -IF (TPL_ENABLE_BinUtils) +if (TPL_ENABLE_BinUtils) - CHECK_FOR_BINUTILS_STACKTRACE(HAS_TPL_BINUNTILS_STACKTRACE) + check_for_binutils_stacktrace(HAS_TPL_BINUNTILS_STACKTRACE) - IF (HAS_TPL_BINUNTILS_STACKTRACE) - MESSAGE(STATUS "Extended attempt to enable tentatively enabled TPL 'BinUtils' passed!") - ELSE() - MESSAGE(STATUS "Extended attempt to enable tentatively enabled TPL 'BinUtils' failed! Setting TPL_ENABLE_BinUtils=OFF") - SET(TPL_ENABLE_BinUtils OFF CACHE STRING "autoset" FORCE) - ENDIF() + if (HAS_TPL_BINUNTILS_STACKTRACE) + message(STATUS "Extended attempt to enable tentatively enabled TPL 'BinUtils' passed!") + else() + message(STATUS "Extended attempt to enable tentatively enabled TPL 'BinUtils' failed! Setting TPL_ENABLE_BinUtils=OFF") + set(TPL_ENABLE_BinUtils OFF CACHE STRING "autoset" FORCE) + endif() -ENDIF() +endif() -PRINT_VAR(TPL_ENABLE_BinUtils) +print_var(TPL_ENABLE_BinUtils) diff --git a/cmake/tribits/common_tpls/FindTPLBoost.cmake b/cmake/tribits/common_tpls/FindTPLBoost.cmake index 6daa8153e658..88200a21ccdd 100644 --- a/cmake/tribits/common_tpls/FindTPLBoost.cmake +++ b/cmake/tribits/common_tpls/FindTPLBoost.cmake @@ -54,7 +54,7 @@ # @HEADER -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( Boost +tribits_tpl_find_include_dirs_and_libraries( Boost REQUIRED_HEADERS boost/version.hpp boost/mpl/at.hpp ) diff --git a/cmake/tribits/common_tpls/FindTPLCGNS.cmake b/cmake/tribits/common_tpls/FindTPLCGNS.cmake index ca2980f4de0f..76fc40502e72 100644 --- a/cmake/tribits/common_tpls/FindTPLCGNS.cmake +++ b/cmake/tribits/common_tpls/FindTPLCGNS.cmake @@ -39,24 +39,24 @@ # # First, set up the variables for the (backward-compatible) TriBITS way of -# finding Netcdf. These are used in case FIND_PACKAGE(NetCDF ...) is not +# finding Netcdf. These are used in case find_package(NetCDF ...) is not # called or does not find NetCDF. Also, these variables need to be non-null # in order to trigger the right behavior in the function -# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES(). +# tribits_tpl_find_include_dirs_and_libraries(). # -SET(REQUIRED_HEADERS cgnslib.h) -SET(REQUIRED_LIBS_NAMES cgns) +set(REQUIRED_HEADERS cgnslib.h) +set(REQUIRED_LIBS_NAMES cgns) # # Second, search for Netcdf components (if allowed) using the standard -# FIND_PACKAGE(CGNS ...). +# find_package(CGNS ...). # -TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE(CGNS CGNS_ALLOW_PREFIND) -IF (CGNS_ALLOW_PREFIND) +tribits_tpl_allow_pre_find_package(CGNS CGNS_ALLOW_PREFIND) +if (CGNS_ALLOW_PREFIND) - MESSAGE("-- Using FIND_PACKAGE(CGNS ...) ...") + message("-- Using find_package(CGNS ...) ...") - SET(CMAKE_MODULE_PATH + set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_LIST_DIR}/find_modules" "${CMAKE_CURRENT_LIST_DIR}/utils" @@ -64,18 +64,18 @@ IF (CGNS_ALLOW_PREFIND) find_package(CGNS) - IF (CGNS_FOUND) + if (CGNS_FOUND) set(TPL_CGNS_LIBRARIES ${CGNS_LIBRARIES} CACHE PATH - "List of semi-colon seprated (full) paths to the CGNS libraries") + "List of semi-colon separated (full) paths to the CGNS libraries") set(TPL_CGNS_INCLUDE_DIRS ${CGNS_INCLUDE_DIRS} CACHE PATH - "List of semi-colon seprated list of directories containing CGNS header files") - ENDIF() + "List of semi-colon separated list of directories containing CGNS header files") + endif() -ENDIF() +endif() # -# Third, call TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() +# Third, call tribits_tpl_find_include_dirs_and_libraries() # -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( CGNS +tribits_tpl_find_include_dirs_and_libraries( CGNS REQUIRED_HEADERS ${REQUIRED_HEADERS} REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES}) diff --git a/cmake/tribits/common_tpls/FindTPLHDF5.cmake b/cmake/tribits/common_tpls/FindTPLHDF5.cmake index 33e24d51944e..3d1fa9a26cc5 100644 --- a/cmake/tribits/common_tpls/FindTPLHDF5.cmake +++ b/cmake/tribits/common_tpls/FindTPLHDF5.cmake @@ -4,76 +4,76 @@ # # First, set up the variables for the (backward-compatible) TriBITS way of -# finding HDF5. These are used in case FIND_PACKAGE(HDF5 ...) is not called +# finding HDF5. These are used in case find_package(HDF5 ...) is not called # or does not find HDF5. Also, these variables need to be non-null in order # to trigger the right behavior in the function -# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES(). +# tribits_tpl_find_include_dirs_and_libraries(). # -SET(REQUIRED_HEADERS hdf5.h) -SET(REQUIRED_LIBS_NAMES hdf5) +set(REQUIRED_HEADERS hdf5.h) +set(REQUIRED_LIBS_NAMES hdf5) -IF (HDF5_REQUIRE_FORTRAN) - SET(REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} hdf5_fortran) -ENDIF() +if (HDF5_REQUIRE_FORTRAN) + set(REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} hdf5_fortran) +endif() -IF (TPL_ENABLE_MPI) - SET(REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} z) -ENDIF() +if (TPL_ENABLE_MPI) + set(REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} z) +endif() -IF (TPL_ENABLE_Netcdf) - SET(REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} hdf5_hl) -ENDIF() +if (TPL_ENABLE_Netcdf) + set(REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} hdf5_hl) +endif() # # Second, search for HDF5 components (if allowed) using the standard -# FIND_PACKAGE(HDF5 ...). +# find_package(HDF5 ...). # -TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE(HDF5 HDF5_ALLOW_PREFIND) -IF (HDF5_ALLOW_PREFIND) +tribits_tpl_allow_pre_find_package(HDF5 HDF5_ALLOW_PREFIND) +if (HDF5_ALLOW_PREFIND) - MESSAGE("-- Using FIND_PACKAGE(HDF5 ...) ...") + message("-- Using find_package(HDF5 ...) ...") - SET(HDF5_COMPONENTS C) - IF (HDF5_REQUIRE_FORTRAN) - LIST(APPEND HDF5_COMPONENTS Fortran) - ENDIF() + set(HDF5_COMPONENTS C) + if (HDF5_REQUIRE_FORTRAN) + list(APPEND HDF5_COMPONENTS Fortran) + endif() - IF (TPL_ENABLE_MPI) - SET(HDF5_PREFER_PARALLEL TRUE) - ENDIF() + if (TPL_ENABLE_MPI) + set(HDF5_PREFER_PARALLEL TRUE) + endif() - FIND_PACKAGE(HDF5 COMPONENTS ${HDF5_COMPONENTS}) + find_package(HDF5 COMPONENTS ${HDF5_COMPONENTS}) # Make sure that HDF5 is parallel. - IF (TPL_ENABLE_MPI AND NOT HDF5_IS_PARALLEL) - MESSAGE(FATAL_ERROR "Trilinos is configured for MPI, HDF5 is not. + if (TPL_ENABLE_MPI AND NOT HDF5_IS_PARALLEL) + message(FATAL_ERROR "Trilinos is configured for MPI, HDF5 is not. Did CMake find the correct libraries? Try setting HDF5_INCLUDE_DIRS and/or HDF5_LIBRARY_DIRS explicitly. ") - ENDIF() + endif() - IF (HDF5_FOUND) + if (HDF5_FOUND) # Tell TriBITS that we found HDF5 and there no need to look any further! - SET(TPL_HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} CACHE PATH + set(TPL_HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} CACHE PATH "HDF5 include dirs") - SET(TPL_HDF5_LIBRARIES ${HDF5_LIBRARIES} CACHE FILEPATH + set(TPL_HDF5_LIBRARIES ${HDF5_LIBRARIES} CACHE FILEPATH "HDF5 libraries") - SET(TPL_HDF5_LIBRARY_DIRS ${HDF5_LIBRARY_DIRS} CACHE PATH + set(TPL_HDF5_LIBRARY_DIRS ${HDF5_LIBRARY_DIRS} CACHE PATH "HDF5 library dirs") - ENDIF() + endif() -ENDIF() +endif() # -# Third, call TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() +# Third, call tribits_tpl_find_include_dirs_and_libraries() # -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( HDF5 +tribits_tpl_find_include_dirs_and_libraries( HDF5 REQUIRED_HEADERS ${REQUIRED_HEADERS} REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} ) -# NOTE: If FIND_PACKAGE(HDF5 ...) was called and successfully found HDF5, then -# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() will use the already-set +# NOTE: If find_package(HDF5 ...) was called and successfully found HDF5, then +# tribits_tpl_find_include_dirs_and_libraries() will use the already-set # variables TPL_HDF5_INCLUDE_DIRS and TPL_HDF5_LIBRARIES and then print them # out (and set some other standard variables as well). This is the final # "hook" into the TriBITS TPL system. diff --git a/cmake/tribits/common_tpls/FindTPLLAPACK.cmake b/cmake/tribits/common_tpls/FindTPLLAPACK.cmake index 3e60b2ef19fd..5e8d9724200b 100644 --- a/cmake/tribits/common_tpls/FindTPLLAPACK.cmake +++ b/cmake/tribits/common_tpls/FindTPLLAPACK.cmake @@ -55,37 +55,37 @@ # # First, set up the variables for the (backward-compatible) TriBITS way of -# finding LAPACK. These are used in case FIND_PACKAGE(LAPACK ...) is not called +# finding LAPACK. These are used in case find_package(LAPACK ...) is not called # or does not find LAPACK. Also, these variables need to be non-null in order # to trigger the right behavior in the function -# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES(). +# tribits_tpl_find_include_dirs_and_libraries(). # -SET(REQUIRED_LIBS_NAMES "lapack lapack_win32") +set(REQUIRED_LIBS_NAMES "lapack lapack_win32") # # Second, search for LAPACK components (if allowed) using the standard -# FIND_PACKAGE(LAPACK ...). +# find_package(LAPACK ...). # -TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE(LAPACK LAPACK_ALLOW_PREFIND) -IF (LAPACK_ALLOW_PREFIND) +tribits_tpl_allow_pre_find_package(LAPACK LAPACK_ALLOW_PREFIND) +if (LAPACK_ALLOW_PREFIND) - MESSAGE("-- Using FIND_PACKAGE(LAPACK ...) ...") + message("-- Using find_package(LAPACK ...) ...") - FIND_PACKAGE(LAPACK) + find_package(LAPACK) - IF (LAPACK_FOUND) + if (LAPACK_FOUND) # Tell TriBITS that we found LAPACK and there no need to look any further! - SET(TPL_LAPACK_INCLUDE_DIRS "" CACHE PATH + set(TPL_LAPACK_INCLUDE_DIRS "" CACHE PATH "LAPACK include dirs") - SET(TPL_LAPACK_LIBRARIES ${LAPACK_LIBRARIES} CACHE FILEPATH + set(TPL_LAPACK_LIBRARIES ${LAPACK_LIBRARIES} CACHE FILEPATH "LAPACK libraries") - SET(TPL_LAPACK_LIBRARY_DIRS "" CACHE PATH + set(TPL_LAPACK_LIBRARY_DIRS "" CACHE PATH "LAPACK library dirs") - ENDIF() + endif() -ENDIF() +endif() -IF (MSVC AND NOT +if (MSVC AND NOT (LAPACK_LIBRARY_DIRS OR (NOT "${LAPACK_LIBRARY_NAMES}" STREQUAL "lapack lapack_win32" AND NOT "${LAPACK_LIBRARY_NAMES}" STREQUAL "") OR @@ -95,19 +95,19 @@ IF (MSVC AND NOT NOT "${TPL_LAPACK_LIBRARIES}" STREQUAL "") OR TPL_LAPACK_INCLUDE_DIRS) ) - IF(CLAPACK_FOUND) - ADVANCED_SET(TPL_LAPACK_LIBRARIES lapack + if(CLAPACK_FOUND) + advanced_set(TPL_LAPACK_LIBRARIES lapack CACHE FILEPATH "Set from MSVC CLAPACK specialization") - ENDIF() -ENDIF() + endif() +endif() # -# Third, call TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() +# Third, call tribits_tpl_find_include_dirs_and_libraries() # -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( LAPACK +tribits_tpl_find_include_dirs_and_libraries( LAPACK REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} ) -# NOTE: If FIND_PACKAGE(LAPACK ...) was called and successfully found LAPACK, then -# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() will use the already-set +# NOTE: If find_package(LAPACK ...) was called and successfully found LAPACK, then +# tribits_tpl_find_include_dirs_and_libraries() will use the already-set # variables TPL_LAPACK_INCLUDE_DIRS and TPL_LAPACK_LIBRARIES and then print them # out (and set some other standard variables as well). This is the final diff --git a/cmake/tribits/common_tpls/FindTPLNetcdf.cmake b/cmake/tribits/common_tpls/FindTPLNetcdf.cmake index 128651cd6ffb..a5a98ce2c3fb 100644 --- a/cmake/tribits/common_tpls/FindTPLNetcdf.cmake +++ b/cmake/tribits/common_tpls/FindTPLNetcdf.cmake @@ -39,25 +39,25 @@ # # First, set up the variables for the (backward-compatible) TriBITS way of -# finding Netcdf. These are used in case FIND_PACKAGE(NetCDF ...) is not +# finding Netcdf. These are used in case find_package(NetCDF ...) is not # called or does not find NetCDF. Also, these variables need to be non-null # in order to trigger the right behavior in the function -# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES(). +# tribits_tpl_find_include_dirs_and_libraries(). # -SET(REQUIRED_HEADERS netcdf.h) -SET(REQUIRED_LIBS_NAMES netcdf) +set(REQUIRED_HEADERS netcdf.h) +set(REQUIRED_LIBS_NAMES netcdf) # # Second, search for Netcdf components (if allowed) using the standard -# FIND_PACKAGE(NetCDF ...). +# find_package(NetCDF ...). # -TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE(Netcdf Netcdf_ALLOW_PREFIND) -IF (Netcdf_ALLOW_PREFIND) +tribits_tpl_allow_pre_find_package(Netcdf Netcdf_ALLOW_PREFIND) +if (Netcdf_ALLOW_PREFIND) - MESSAGE("-- Using FIND_PACKAGE(Netcdf ...) ...") + message("-- Using find_package(Netcdf ...) ...") - SET(CMAKE_MODULE_PATH + set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_LIST_DIR}/find_modules" "${CMAKE_CURRENT_LIST_DIR}/utils" @@ -65,8 +65,8 @@ IF (Netcdf_ALLOW_PREFIND) find_package(NetCDF) - IF (NetCDF_FOUND) - SET(DOCSTR "List of semi-colon separated paths to look for the TPL Netcdf") + if (NetCDF_FOUND) + set(DOCSTR "List of semi-colon separated paths to look for the TPL Netcdf") set(TPL_Netcdf_Enables_Netcdf4 ${NetCDF_NEEDS_HDF5} CACHE BOOL "True if netcdf enables netcdf-4") set(TPL_Netcdf_Enables_PNetcdf ${NetCDF_NEEDS_PNetCDF} CACHE BOOL @@ -76,22 +76,22 @@ IF (Netcdf_ALLOW_PREFIND) set(TPL_Netcdf_LIBRARY_DIRS ${_hdf5_LIBRARY_SEARCH_DIRS} CACHE PATH "${DOCSTR} library files") set(TPL_Netcdf_LIBRARIES ${NetCDF_LIBRARIES} CACHE PATH - "List of semi-colon seprated library names (not 'lib' or extension).") + "List of semi-colon separated library names (not 'lib' or extension).") set(TPL_Netcdf_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} CACHE PATH "${DOCSTR} header files.") - ENDIF() + endif() -ENDIF() +endif() # -# Third, call TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() +# Third, call tribits_tpl_find_include_dirs_and_libraries() # -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( Netcdf +tribits_tpl_find_include_dirs_and_libraries( Netcdf REQUIRED_HEADERS ${REQUIRED_HEADERS} REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} ) -# NOTE: If FIND_PACKAGE(Netcdf ...) was called and successfully found Netcdf, -# then TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() will use the already-set +# NOTE: If find_package(Netcdf ...) was called and successfully found Netcdf, +# then tribits_tpl_find_include_dirs_and_libraries() will use the already-set # variables TPL_Netcdf_INCLUDE_DIRS and TPL_Netcdf_LIBRARIES and then print # them out (and set some other standard variables as well). This is the final # "hook" into the TriBITS TPL system. diff --git a/cmake/tribits/common_tpls/FindTPLPETSC.cmake b/cmake/tribits/common_tpls/FindTPLPETSC.cmake index 3ffd9a0e3960..098c6ec3d4b9 100644 --- a/cmake/tribits/common_tpls/FindTPLPETSC.cmake +++ b/cmake/tribits/common_tpls/FindTPLPETSC.cmake @@ -1,4 +1,4 @@ -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( PETSC +tribits_tpl_find_include_dirs_and_libraries( PETSC REQUIRED_HEADERS petsc.h REQUIRED_LIBS_NAMES petsc ) diff --git a/cmake/tribits/common_tpls/FindTPLPnetcdf.cmake b/cmake/tribits/common_tpls/FindTPLPnetcdf.cmake index 71c3120c9789..042548765f33 100644 --- a/cmake/tribits/common_tpls/FindTPLPnetcdf.cmake +++ b/cmake/tribits/common_tpls/FindTPLPnetcdf.cmake @@ -37,7 +37,7 @@ # ************************************************************************ # @HEADER -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( Pnetcdf +tribits_tpl_find_include_dirs_and_libraries( Pnetcdf REQUIRED_HEADERS pnetcdf.h REQUIRED_LIBS_NAMES pnetcdf ) diff --git a/cmake/tribits/common_tpls/find_modules/FindCGNS.cmake b/cmake/tribits/common_tpls/find_modules/FindCGNS.cmake index bdc632f7241f..b6ee0a233ca3 100644 --- a/cmake/tribits/common_tpls/find_modules/FindCGNS.cmake +++ b/cmake/tribits/common_tpls/find_modules/FindCGNS.cmake @@ -290,8 +290,8 @@ if ( NOT CGNS_FIND_QUIETLY ) message(STATUS "\tCGNS_TOOLS_FOUND = ${CGNS_TOOLS_FOUND}") endif() -# For compatability with TriBITS: -SET(DOCSTR "List of semi-colon separated paths to look for the TPL CGNS") +# For compatibility with TriBITS: +set(DOCSTR "List of semi-colon separated paths to look for the TPL CGNS") set(TPL_CGNS_LIBRARIES ${CGNS_LIBRARIES} CACHE PATH ${DOCSTR}) set(TPL_CGNS_INCLUDE_DIRS ${CGNS_INCLUDE_DIRS} CACHE PATH ${DOCSTR}) diff --git a/cmake/tribits/common_tpls/find_modules/FindHDF5.cmake b/cmake/tribits/common_tpls/find_modules/FindHDF5.cmake index 0be888aba834..bed6cb04b1ca 100644 --- a/cmake/tribits/common_tpls/find_modules/FindHDF5.cmake +++ b/cmake/tribits/common_tpls/find_modules/FindHDF5.cmake @@ -3,7 +3,7 @@ # The FindHDF5 module with the CMake distribution will not work if # the HDF5 compilers are not installed or if more the one hdf5 is on the # system. The search logic also depends on an environment variable -# HDF5_ROOT. This module removes both requirements and insteead relies on the +# HDF5_ROOT. This module removes both requirements and instead relies on the # libhdf5.settings file found in the library installation directory # # This module will ONLY work for HDF5 configured through the GNU @@ -66,19 +66,19 @@ include(AddImportedLibrary) # Functions/Macros # # -macro(_HDF5_BOOLEAN_CONVERT _var) +macro(_hdf5_boolean_convert _var) string(TOUPPER ${${_var}} _var_UC) if(_var_UC) set(${_var} TRUE) else() set(${_var} FALSE) endif() -endmacro(_HDF5_BOOLEAN_CONVERT) +endmacro() -function(_HDF5_CHOMP_STRING old_str new_str_var) +function(_hdf5_chomp_string old_str new_str_var) string(REGEX REPLACE "[\t\r\n]" " " _tmp "${old_str}") #string(REGEX REPLACE " " "S" _tmp "${_tmp}") @@ -87,11 +87,11 @@ function(_HDF5_CHOMP_STRING old_str new_str_var) set(${new_str_var} ${_tmp} PARENT_SCOPE) -endfunction(_HDF5_CHOMP_STRING) +endfunction() -function(_HDF5_PARSE_SETTINGS_FILE _file _key _value) +function(_hdf5_parse_settings_file _file _key _value) set(_tmp ${_value}-NOTFOUND) file(STRINGS ${_file} _output @@ -100,12 +100,12 @@ function(_HDF5_PARSE_SETTINGS_FILE _file _key _value) if(_output) # _HDF5_CHOMP_STRING will remove all tabs, newlines and returns # It also removes leading and trailing whitespace - _HDF5_CHOMP_STRING(${_output} _output) + _hdf5_chomp_string(${_output} _output) # Remove the key signature string(REGEX REPLACE "${_key}:" "" _output "${_output}") # CHOMP again to remove leading and trailing whitespace if (_output) - _HDF5_CHOMP_STRING(${_output} _output) + _hdf5_chomp_string(${_output} _output) endif() # Entry is non-empty if ANY non-space character is left if ( "${_output}" MATCHES "[^ ]" ) @@ -115,41 +115,41 @@ function(_HDF5_PARSE_SETTINGS_FILE _file _key _value) set(${_value} ${_tmp} PARENT_SCOPE) -endfunction(_HDF5_PARSE_SETTINGS_FILE) +endfunction() -function(_HDF5_DEFINE_VERSION _file _var) +function(_hdf5_define_version _file _var) set(_search_key "HDF5 Version") - _HDF5_PARSE_SETTINGS_FILE(${_file} ${_search_key} _tmp) + _hdf5_parse_settings_file(${_file} ${_search_key} _tmp) set(${_var} ${_tmp} PARENT_SCOPE) -endfunction(_HDF5_DEFINE_VERSION _var) +endfunction() -function(_HDF5_DEFINE_PARALLEL_BUILD _file _var) +function(_hdf5_define_parallel_build _file _var) set(_search_key "Parallel HDF5") - _HDF5_PARSE_SETTINGS_FILE(${_file} ${_search_key} _tmp) - _HDF5_BOOLEAN_CONVERT(_tmp) + _hdf5_parse_settings_file(${_file} ${_search_key} _tmp) + _hdf5_boolean_convert(_tmp) set(${_var} ${_tmp} PARENT_SCOPE) -endfunction(_HDF5_DEFINE_PARALLEL_BUILD _file _var) +endfunction() -function(_HDF5_EXTRA_LIBRARY_DIRS _file _var) +function(_hdf5_extra_library_dirs _file _var) # Settings file has several locations to list LDFLAGS # We'll pick them all and sort out later. set(_search_ldflags_keys "AM_LDFLAGS;H5_LDFLAGS;LDFLAGS;Extra libraries") set(_ldflags "") foreach ( _key ${_search_ldflags_keys}) - _HDF5_PARSE_SETTINGS_FILE(${_file} ${_key} _tmp) + _hdf5_parse_settings_file(${_file} ${_key} _tmp) if ( _tmp ) set(_ldflags "${_ldflags} ${_tmp}") endif() @@ -171,35 +171,35 @@ function(_HDF5_EXTRA_LIBRARY_DIRS _file _var) endif() set(${_var} ${_directories} PARENT_SCOPE) -endfunction(_HDF5_EXTRA_LIBRARY_DIRS _file _var) +endfunction() -function(_HDF5_LIBRARY_PATH _file _var) +function(_hdf5_library_path _file _var) # Settings file has several locations to list LDFLAGS # We'll pick them all and sort out later. set(_search_key "Installation point") - _HDF5_PARSE_SETTINGS_FILE(${_file} ${_search_key} _tmp) + _hdf5_parse_settings_file(${_file} ${_search_key} _tmp) set(${_var} ${_tmp} PARENT_SCOPE) -endfunction(_HDF5_LIBRARY_PATH _file _var) +endfunction() -function(_HDF5_EXTRA_LIBRARIES _file _var) +function(_hdf5_extra_libraries _file _var) # Find all the extra libraries defined in the file set(_search_key "Extra libraries") set(_libraries) - _HDF5_PARSE_SETTINGS_FILE(${_file} ${_search_key} _library_flags) + _hdf5_parse_settings_file(${_file} ${_search_key} _library_flags) string( REGEX MATCHALL "[, ]-l([^\", ]+)|^-l([^\", ]+)" _library_name_flags ${_library_flags}) foreach ( _lib ${_library_name_flags} ) - _HDF5_CHOMP_STRING(${_lib} _lib_chomp) + _hdf5_chomp_string(${_lib} _lib_chomp) string( REGEX REPLACE "^[,]-l|^-l" "" _lib_chomp ${_lib_chomp}) list(APPEND _libraries ${_lib_chomp}) endforeach() # Grab all the extra library paths to build a search list - _HDF5_EXTRA_LIBRARY_DIRS(${_file} _search_list) + _hdf5_extra_library_dirs(${_file} _search_list) # Loop through each library # (1) find_library with the search list for hints @@ -231,11 +231,11 @@ function(_HDF5_EXTRA_LIBRARIES _file _var) set(${_var} ${_return_list} PARENT_SCOPE) -endfunction(_HDF5_EXTRA_LIBRARIES _file _var) +endfunction() -function(_HDF5_EXTRA_INCLUDE_DIRS _file _var) +function(_hdf5_extra_include_dirs _file _var) # Settings file has several locations to list LDFLAGS # We'll pick them all and sort out later. @@ -251,7 +251,7 @@ function(_HDF5_EXTRA_INCLUDE_DIRS _file _var) set(_cflags "") foreach ( _key ${_search_cflags_keys}) - _HDF5_PARSE_SETTINGS_FILE(${_file} ${_key} _tmp) + _hdf5_parse_settings_file(${_file} ${_key} _tmp) if ( _tmp ) set(_cflags "${_cflags} ${_tmp}") endif() @@ -275,7 +275,7 @@ function(_HDF5_EXTRA_INCLUDE_DIRS _file _var) endif() set(${_var} ${_directories} PARENT_SCOPE) -endfunction(_HDF5_EXTRA_INCLUDE_DIRS _file _var) +endfunction() # # End Functions/Macros @@ -430,7 +430,7 @@ else() # Check the settings file for other include directories if ( HDF5_SETTINGS_FILE ) - _HDF5_EXTRA_INCLUDE_DIRS(${HDF5_SETTINGS_FILE} extra_inc_dirs) + _hdf5_extra_include_dirs(${HDF5_SETTINGS_FILE} extra_inc_dirs) endif() # Build HDF5_INCLUDE_DIRS @@ -442,7 +442,7 @@ else() # Search for the libraries if (HDF5_SETTINGS_FILE) - _HDF5_LIBRARY_PATH(${HDF5_SETTINGS_FILE} _hdf5_path) + _hdf5_library_path(${HDF5_SETTINGS_FILE} _hdf5_path) set(_hdf5_LIBRARY_SEARCH_DIRS ${_hdf5_path}/lib) endif() @@ -463,7 +463,7 @@ else() # Define the target for the C library if (HDF5_SETTINGS_FILE) - _HDF5_EXTRA_LIBRARIES(${HDF5_SETTINGS_FILE} HDF5_LINK_LIBRARIES) + _hdf5_extra_libraries(${HDF5_SETTINGS_FILE} HDF5_LINK_LIBRARIES) endif() add_imported_library(${HDF5_C_TARGET} @@ -472,7 +472,7 @@ else() LINK_INTERFACE_LIBRARIES "${HDF5_LINK_LIBRARIES}") set(HDF5_C_LIBRARY ${HDF5_C_TARGET}) - # --- Search for the other possible compnent libraries + # --- Search for the other possible component libraries # Search for the high-level (HL) library find_library(_HDF5_HL_LIBRARY @@ -527,16 +527,16 @@ set(HDF5_LIBRARIES_EXPORT ${HDF5_LIBRARIES}) # --- Define the version string from the settings file if not already set if ( NOT HDF5_VERSION AND HDF5_SETTINGS_FILE ) - _HDF5_DEFINE_VERSION(${HDF5_SETTINGS_FILE} HDF5_VERSION) + _hdf5_define_version(${HDF5_SETTINGS_FILE} HDF5_VERSION) endif() if ( NOT HDF5_VERSION ) - SET(HDF5_VERSION "Unknown") + set(HDF5_VERSION "Unknown") endif() # --- Define HDF5_IS_PARALLEL from the settings file if not already set if ( NOT HDF5_IS_PARALLEL AND HDF5_SETTINGS_FILE ) - _HDF5_DEFINE_PARALLEL_BUILD(${HDF5_SETTINGS_FILE} HDF5_IS_PARALLEL) + _hdf5_define_parallel_build(${HDF5_SETTINGS_FILE} HDF5_IS_PARALLEL) endif() # --- Search for HDF5 tools @@ -593,7 +593,7 @@ if ( NOT HDF5_FIND_QUIETLY ) message(STATUS "\tHDF5_TOOLS_FOUND: ${HDF5_TOOLS_FOUND}") endif() -# For compatability with TriBITS: +# For compatibility with TriBITS: set(TPL_HDF5_LIBRARY_DIRS ${_hdf5_LIBRARY_SEARCH_DIRS}) set(TPL_HDF5_LIBRARIES ${HDF5_LIBRARIES}) set(TPL_HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS}) diff --git a/cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake b/cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake index c9539cabee9a..960088f3e4cf 100644 --- a/cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake +++ b/cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake @@ -288,7 +288,7 @@ else(NetCDF_LIBRARIES AND NetCDF_INCLUDE_DIRS) # Need to find the NetCDF config script to check for HDF5 if ( NetCDF_ROOT OR NetCDF_BIN_DIR ) - MESSAGE(STATUS "\tNetCDF_ROOT is ${NetCDF_ROOT}") + message(STATUS "\tNetCDF_ROOT is ${NetCDF_ROOT}") find_program(netcdf_config nc-config PATHS ${NetCDF_ROOT}/bin ${NetCDF_BIN_DIR} NO_DEFAULT_PATH diff --git a/cmake/tribits/common_tpls/find_modules/FindPNetCDF.cmake b/cmake/tribits/common_tpls/find_modules/FindPNetCDF.cmake index 9d7c43ad0f3c..6d72637aa424 100644 --- a/cmake/tribits/common_tpls/find_modules/FindPNetCDF.cmake +++ b/cmake/tribits/common_tpls/find_modules/FindPNetCDF.cmake @@ -257,8 +257,8 @@ if ( NOT PNetCDF_FIND_QUIETLY ) message(STATUS "\tPNetCDF_LIBRARIES = ${PNetCDF_LIBRARIES}") endif() -# For compatability with TriBITS: -SET(DOCSTR "List of semi-colon separated paths to look for the TPL PNetCDF") +# For compatibility with TriBITS: +set(DOCSTR "List of semi-colon separated paths to look for the TPL PNetCDF") set(TPL_PNetCDF_LIBRARIES ${PNetCDF_LIBRARIES} CACHE PATH ${DOCSTR}) set(TPL_PNetCDF_INCLUDE_DIRS ${PNetCDF_INCLUDE_DIRS} CACHE PATH ${DOCSTR}) diff --git a/cmake/tribits/common_tpls/utils/AddImportedLibrary.cmake b/cmake/tribits/common_tpls/utils/AddImportedLibrary.cmake index 26f567c61f5a..2c6ce6694772 100644 --- a/cmake/tribits/common_tpls/utils/AddImportedLibrary.cmake +++ b/cmake/tribits/common_tpls/utils/AddImportedLibrary.cmake @@ -49,7 +49,7 @@ # Print variable # # -# ADD_IMPORTED_LIBRARY(name [SHARED | STATIC] +# add_imported_library(name [SHARED | STATIC] # LOCATION # [ LINK_LANGUAGES ... ] # [ LINK_INTERFACE_LIBRARIES ... ] @@ -58,7 +58,7 @@ # include(CMakeParseArguments) -function(ADD_IMPORTED_LIBRARY target_name) +function(add_imported_library target_name) set(_options SHARED STATIC) set(_oneValueArgs LOCATION) @@ -111,5 +111,5 @@ function(ADD_IMPORTED_LIBRARY target_name) endif() endif() -endfunction(ADD_IMPORTED_LIBRARY) +endfunction() diff --git a/cmake/tribits/common_tpls/utils/AddPackageDependency.cmake b/cmake/tribits/common_tpls/utils/AddPackageDependency.cmake index bf1c824442a2..2a9e4e64cfc8 100644 --- a/cmake/tribits/common_tpls/utils/AddPackageDependency.cmake +++ b/cmake/tribits/common_tpls/utils/AddPackageDependency.cmake @@ -41,7 +41,7 @@ # Based on version from MSTK which is from Amanzi open source code - # https://software.lanl.gov/ascem/trac) # -# ADD_PACKAGE_DEPENDENCY( DEPENDS_ON ) +# add_package_dependency( DEPENDS_ON ) # # CMake module @@ -50,13 +50,13 @@ include(CMakeParseArguments) # MSTK modules include(ParseLibraryList) -function(ADD_PACKAGE_DEPENDENCY) +function(add_package_dependency) # Macro: _print_usage macro(_print_usage) - message("\nADD_PACKAGE_DEPENDENCY( DEPENDS_ON )\n" + message("\nadd_package_dependency( DEPENDS_ON )\n" " Add req_package to target_package dependencies.\n") - endmacro(_print_usage) + endmacro() # Parse the arguments set(_options "") @@ -113,7 +113,7 @@ function(ADD_PACKAGE_DEPENDENCY) set(_save_lib_list "") if ( ${target_libs_split} OR ${req_libs_split} ) - # Define the parsed lists if the orginal list did not contain keywords + # Define the parsed lists if the original list did not contain keywords if ( NOT ${target_libs_split} ) set(target_debug_libs ${${target_package}_LIBRARIES}) set(target_opt_libs ${${target_package}_LIBRARIES}) @@ -172,4 +172,4 @@ function(ADD_PACKAGE_DEPENDENCY) endif() -endfunction(ADD_PACKAGE_DEPENDENCY) +endfunction() diff --git a/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake b/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake index 0e115ea981a2..3f1423b3126c 100644 --- a/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake +++ b/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake @@ -40,7 +40,7 @@ # # Modified version from MSTK which was originally based on Amanzi open # source code https://software.lanl.gov/ascem/trac) -# PARSE_LIBRARY_LIST( +# parse_library_list( # DEBUG # OPT # GENERAL ) @@ -48,7 +48,7 @@ # CMake module include(CMakeParseArguments) -function(PARSE_LIBRARY_LIST) +function(parse_library_list) # Macro: _print_usage macro(_print_usage) @@ -112,5 +112,5 @@ function(PARSE_LIBRARY_LIST) set(${PARSE_ARGS_FOUND} FALSE PARENT_SCOPE) endif() -endfunction(PARSE_LIBRARY_LIST) +endfunction() diff --git a/cmake/tribits/core/config_tests/BLASMangling.cmake b/cmake/tribits/core/config_tests/BLASMangling.cmake index 5ee31387b5e8..a14c043a76cf 100644 --- a/cmake/tribits/core/config_tests/BLASMangling.cmake +++ b/cmake/tribits/core/config_tests/BLASMangling.cmake @@ -58,82 +58,82 @@ # The Fortran 2003 name binding facilities and ISO_C_BINDING module # should be preferred over cpp macro trickery whenever possible. # -FUNCTION(BLAS_MANGLING) +function(blas_mangling) - IF(NOT DEFINED BLAS_FN_CASE) + if(NOT DEFINED BLAS_FN_CASE) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("BLAS_MANGLING: Testing name Mangling Schemes!\n") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("BLAS_MANGLING: Testing name Mangling Schemes!\n") + endif() - FIND_FILE(_blascmakelists blasmangle/ ${CMAKE_MODULE_PATH}) - IF (NOT _blascmakelists) - MESSAGE(STATUS "Error, the file blasmangle could not be found so we can not determine Fortran name mangling!") - RETURN() - ENDIF() + find_file(_blascmakelists blasmangle/ ${CMAKE_MODULE_PATH}) + if (NOT _blascmakelists) + message(STATUS "Error, the file blasmangle could not be found so we can not determine Fortran name mangling!") + return() + endif() - SET(_fcmangledir ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/blasmangle) - FILE(MAKE_DIRECTORY ${_fcmangledir}) + set(_fcmangledir ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/blasmangle) + file(MAKE_DIRECTORY ${_fcmangledir}) - FOREACH(cdef LOWER UPPER) + foreach(cdef LOWER UPPER) - FOREACH(udef UNDER NO_UNDER) + foreach(udef UNDER NO_UNDER) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("BLAS_MANGLING: Testing ${cdef} ${udef}\n\n") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("BLAS_MANGLING: Testing ${cdef} ${udef}\n\n") + endif() - SET(_fcmangledir_case "${_fcmangledir}/${cdef}/${udef}") - FILE(MAKE_DIRECTORY "${_fcmangledir}/${cdef}") - FILE(MAKE_DIRECTORY ${_fcmangledir_case}) + set(_fcmangledir_case "${_fcmangledir}/${cdef}/${udef}") + file(MAKE_DIRECTORY "${_fcmangledir}/${cdef}") + file(MAKE_DIRECTORY ${_fcmangledir_case}) - TRY_COMPILE(_blasmngl ${_fcmangledir_case} ${_blascmakelists} blasmangle + try_compile(_blasmngl ${_fcmangledir_case} ${_blascmakelists} blasmangle CMAKE_FLAGS "-DMANGLE_FLAGS:STRING=-DFC_FN_${cdef};-DFC_FN_${udef}" OUTPUT_VARIABLE _blasmngl_output ) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("${_blasmngl_output}\n\n") - ENDIF() - - IF(_blasmngl) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("BLAS_MANGLING: Bingo! ${cdef} ${udef} is the correct BLAS name mangling!\n") - ENDIF() - SET(BLAS_FN_CASE ${cdef} CACHE INTERNAL + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("${_blasmngl_output}\n\n") + endif() + + if(_blasmngl) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("BLAS_MANGLING: Bingo! ${cdef} ${udef} is the correct BLAS name mangling!\n") + endif() + set(BLAS_FN_CASE ${cdef} CACHE INTERNAL "Case used by Fortran functions" FORCE) - SET(BLAS_FN_UNDERSCORE ${udef} CACHE INTERNAL + set(BLAS_FN_UNDERSCORE ${udef} CACHE INTERNAL "Underscore convention used by Fortran functions" FORCE) - BREAK() - ENDIF() + break() + endif() - ENDFOREACH() + endforeach() - IF(_blasmngl) - BREAK() - ENDIF() + if(_blasmngl) + break() + endif() - ENDFOREACH() + endforeach() - IF(_blasmngl) - MESSAGE(STATUS "BLAS name mangling: ${BLAS_FN_CASE} ${BLAS_FN_UNDERSCORE}") - ELSE() - MESSAGE(STATUS "Warning, cannot automatically determine BLAS mangling.") - ENDIF() + if(_blasmngl) + message(STATUS "BLAS name mangling: ${BLAS_FN_CASE} ${BLAS_FN_UNDERSCORE}") + else() + message(STATUS "Warning, cannot automatically determine BLAS mangling.") + endif() - ENDIF() + endif() - IF (BLAS_FN_CASE STREQUAL LOWER) - SET(BLAS_NAME_NAME name) - ELSEIF (BLAS_FN_CASE STREQUAL UPPER) - SET(BLAS_NAME_NAME NAME) - ENDIF() + if (BLAS_FN_CASE STREQUAL LOWER) + set(BLAS_NAME_NAME name) + elseif (BLAS_FN_CASE STREQUAL UPPER) + set(BLAS_NAME_NAME NAME) + endif() - IF (BLAS_FN_UNDERSCORE) - IF(BLAS_FN_UNDERSCORE STREQUAL "UNDER") - SET(BLAS_FUNC_DEFAULT "(name,NAME) ${BLAS_NAME_NAME} ## _" CACHE INTERNAL "") - ELSE() - SET(BLAS_FUNC_DEFAULT "(name,NAME) ${BLAS_NAME_NAME}" CACHE INTERNAL "") - ENDIF() - ENDIF() + if (BLAS_FN_UNDERSCORE) + if(BLAS_FN_UNDERSCORE STREQUAL "UNDER") + set(BLAS_FUNC_DEFAULT "(name,NAME) ${BLAS_NAME_NAME} ## _" CACHE INTERNAL "") + else() + set(BLAS_FUNC_DEFAULT "(name,NAME) ${BLAS_NAME_NAME}" CACHE INTERNAL "") + endif() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/config_tests/FiniteValue.cmake b/cmake/tribits/core/config_tests/FiniteValue.cmake index b50b82eb0174..42d761e7028e 100644 --- a/cmake/tribits/core/config_tests/FiniteValue.cmake +++ b/cmake/tribits/core/config_tests/FiniteValue.cmake @@ -46,8 +46,8 @@ # fall back on checks that may or may not work depending on the # platforms's compliance with IEEE standards. -INCLUDE(CheckCXXSourceRuns) -INCLUDE(CheckCXXSourceCompiles) +include(CheckCXXSourceRuns) +include(CheckCXXSourceCompiles) ############################################################# # isnan @@ -56,7 +56,7 @@ INCLUDE(CheckCXXSourceCompiles) # Some machines have isnan() in the global namespace and some put it # in the std:: namespace. We will check for both. -SET(SOURCE_GLOBAL_ISNAN +set(SOURCE_GLOBAL_ISNAN " #include int main() @@ -68,10 +68,10 @@ int main() " ) -CHECK_CXX_SOURCE_COMPILES("${SOURCE_GLOBAL_ISNAN}" +check_cxx_source_compiles("${SOURCE_GLOBAL_ISNAN}" FINITE_VALUE_HAVE_GLOBAL_ISNAN) -SET(SOURCE_STD_ISNAN +set(SOURCE_STD_ISNAN " #include int main() @@ -83,11 +83,11 @@ int main() " ) -CHECK_CXX_SOURCE_COMPILES("${SOURCE_STD_ISNAN}" +check_cxx_source_compiles("${SOURCE_STD_ISNAN}" FINITE_VALUE_HAVE_STD_ISNAN) -IF (CMAKE_VERBOSE_MAKEFILE) - IF (NOT FINITE_VALUE_HAVE_GLOBAL_ISNAN AND +if (CMAKE_VERBOSE_MAKEFILE) + if (NOT FINITE_VALUE_HAVE_GLOBAL_ISNAN AND NOT FINITE_VALUE_HAVE_STD_ISNAN ) message("****************************************************") message("** NOTE: Your compiler doesn't support isnan() or") @@ -96,14 +96,14 @@ IF (CMAKE_VERBOSE_MAKEFILE) message("** *NOT* guaranteed to work on your platform") message("** unless your machine is IEEE 748/754 compliant.") message("****************************************************") - ENDIF() -ENDIF() + endif() +endif() ############################################################# # isinf ############################################################# -SET(SOURCE_GLOBAL_ISINF +set(SOURCE_GLOBAL_ISINF " #include int main() @@ -115,10 +115,10 @@ int main() " ) -CHECK_CXX_SOURCE_COMPILES("${SOURCE_GLOBAL_ISINF}" +check_cxx_source_compiles("${SOURCE_GLOBAL_ISINF}" FINITE_VALUE_HAVE_GLOBAL_ISINF) -SET(SOURCE_STD_ISINF +set(SOURCE_STD_ISINF " #include int main() @@ -130,11 +130,11 @@ int main() " ) -CHECK_CXX_SOURCE_COMPILES("${SOURCE_STD_ISINF}" +check_cxx_source_compiles("${SOURCE_STD_ISINF}" FINITE_VALUE_HAVE_STD_ISINF) -IF (CMAKE_VERBOSE_MAKEFILE) - IF (NOT FINITE_VALUE_HAVE_GLOBAL_ISINF AND +if (CMAKE_VERBOSE_MAKEFILE) + if (NOT FINITE_VALUE_HAVE_GLOBAL_ISINF AND NOT FINITE_VALUE_HAVE_STD_ISINF ) message("****************************************************") message("** NOTE: Your compiler doesn't support isinf() or") @@ -143,8 +143,8 @@ IF (CMAKE_VERBOSE_MAKEFILE) message("** *NOT* guaranteed to work on your platform") message("** unless your machine is IEEE 748/754 compliant.") message("****************************************************") - ENDIF() -ENDIF() + endif() +endif() ############################################################# ############################################################# diff --git a/cmake/tribits/core/config_tests/FortranMangling.cmake b/cmake/tribits/core/config_tests/FortranMangling.cmake index fbf1d0a63e7e..6b0d92aabeaa 100644 --- a/cmake/tribits/core/config_tests/FortranMangling.cmake +++ b/cmake/tribits/core/config_tests/FortranMangling.cmake @@ -37,7 +37,7 @@ # ************************************************************************ # @HEADER -INCLUDE(GlobalSet) +include(GlobalSet) # Function that defines variables describing the Fortran name mangling # convention @@ -65,39 +65,39 @@ INCLUDE(GlobalSet) # The Fortran 2003 name binding facilities and ISO_C_BINDING module # should be preferred over cpp macro trickery whenever possible. # -FUNCTION(FORTRAN_MANGLING) +function(fortran_mangling) - IF(NOT DEFINED FC_FN_CASE) + if(NOT DEFINED FC_FN_CASE) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("FORTRAN_MANGLING: Testing name Mangling Schemes!\n") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("FORTRAN_MANGLING: Testing name Mangling Schemes!\n") + endif() - FIND_FILE(_fcmakelists fmangle/ ${CMAKE_MODULE_PATH}) - IF (NOT _fcmakelists) - MESSAGE(STATUS "Error, the directory fmangle could not be found so we can not determine Fortran name mangling!") - RETURN() - ENDIF() + find_file(_fcmakelists fmangle/ ${CMAKE_MODULE_PATH}) + if (NOT _fcmakelists) + message(STATUS "Error, the directory fmangle could not be found so we can not determine Fortran name mangling!") + return() + endif() - SET(_fcmangledir ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/fmangle) - FILE(MAKE_DIRECTORY ${_fcmangledir}) + set(_fcmangledir ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/fmangle) + file(MAKE_DIRECTORY ${_fcmangledir}) - FOREACH(cdef LOWER UPPER) + foreach(cdef LOWER UPPER) - FOREACH(udef UNDER NO_UNDER SECOND_UNDER) + foreach(udef UNDER NO_UNDER SECOND_UNDER) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("FORTRAN_MANGLING: Testing ${cdef} ${udef}\n\n") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("FORTRAN_MANGLING: Testing ${cdef} ${udef}\n\n") + endif() - SET(_fcmangledir_case "${_fcmangledir}/${cdef}/${udef}") - FILE(MAKE_DIRECTORY "${_fcmangledir}/${cdef}") - FILE(MAKE_DIRECTORY ${_fcmangledir_case}) + set(_fcmangledir_case "${_fcmangledir}/${cdef}/${udef}") + file(MAKE_DIRECTORY "${_fcmangledir}/${cdef}") + file(MAKE_DIRECTORY ${_fcmangledir_case}) - SET(COMMON_DEFS -DFC_FN_${cdef} -DFC_FN_${udef}) - SET(C_FLAGS "${CMAKE_C_FLAGS} ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}") - SET(F_FLAGS "${CMAKE_Fortran_FLAGS} ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}") - TRY_COMPILE(_fcmngl ${_fcmangledir_case} ${_fcmakelists} fmangle + set(COMMON_DEFS -DFC_FN_${cdef} -DFC_FN_${udef}) + set(C_FLAGS "${CMAKE_C_FLAGS} ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}") + set(F_FLAGS "${CMAKE_Fortran_FLAGS} ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}") + try_compile(_fcmngl ${_fcmangledir_case} ${_fcmakelists} fmangle CMAKE_FLAGS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}" "-DCMAKE_C_FLAGS:STRING=${C_FLAGS}" @@ -107,55 +107,55 @@ FUNCTION(FORTRAN_MANGLING) "-DCOMMON_DEFS=${COMMON_DEFS}" OUTPUT_VARIABLE _fcmngl_output ) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("${_fcmngl_output}\n\n") - ENDIF() - - IF(_fcmngl) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("FORTRAN_MANGLING: Bingo! ${cdef} ${udef} is the correct fortran name mangling!\n") - ENDIF() - GLOBAL_SET(FC_FN_CASE ${cdef}) - GLOBAL_SET(FC_FN_UNDERSCORE ${udef}) - BREAK() - ENDIF() - - ENDFOREACH() - - IF(_fcmngl) - BREAK() - ENDIF() - - ENDFOREACH() - - IF(_fcmngl) - MESSAGE(STATUS "Fortran name mangling: ${FC_FN_CASE} ${FC_FN_UNDERSCORE}") - ELSE() - MESSAGE(STATUS "Warning, cannot automatically determine Fortran mangling.") - ENDIF() - - ENDIF() - - IF (FC_FN_CASE STREQUAL LOWER) - SET(FC_NAME_NAME name) - ELSEIF (FC_FN_CASE STREQUAL UPPER) - SET(FC_NAME_NAME NAME) - ENDIF() - - IF (FC_FN_UNDERSCORE) - IF(FC_FN_UNDERSCORE STREQUAL "UNDER") - SET(FC_FUNC_DEFAULT "(name,NAME) ${FC_NAME_NAME} ## _" CACHE INTERNAL "") - SET(FC_FUNC__DEFAULT "(name,NAME) ${FC_NAME_NAME} ## _" CACHE INTERNAL "") - ELSEIF(FC_FN_UNDERSCORE STREQUAL "SECOND_UNDER") - SET(FC_FUNC_DEFAULT "(name,NAME) ${FC_NAME_NAME} ## _" CACHE INTERNAL "") - SET(FC_FUNC__DEFAULT "(name,NAME) ${FC_NAME_NAME} ## __" CACHE INTERNAL "") - ELSE() - SET(FC_FUNC_DEFAULT "(name,NAME) ${FC_NAME_NAME}" CACHE INTERNAL "") - SET(FC_FUNC__DEFAULT "(name,NAME) ${FC_NAME_NAME}" CACHE INTERNAL "") - ENDIF() - ENDIF() - -ENDFUNCTION() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("${_fcmngl_output}\n\n") + endif() + + if(_fcmngl) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("FORTRAN_MANGLING: Bingo! ${cdef} ${udef} is the correct fortran name mangling!\n") + endif() + global_set(FC_FN_CASE ${cdef}) + global_set(FC_FN_UNDERSCORE ${udef}) + break() + endif() + + endforeach() + + if(_fcmngl) + break() + endif() + + endforeach() + + if(_fcmngl) + message(STATUS "Fortran name mangling: ${FC_FN_CASE} ${FC_FN_UNDERSCORE}") + else() + message(STATUS "Warning, cannot automatically determine Fortran mangling.") + endif() + + endif() + + if (FC_FN_CASE STREQUAL LOWER) + set(FC_NAME_NAME name) + elseif (FC_FN_CASE STREQUAL UPPER) + set(FC_NAME_NAME NAME) + endif() + + if (FC_FN_UNDERSCORE) + if(FC_FN_UNDERSCORE STREQUAL "UNDER") + set(FC_FUNC_DEFAULT "(name,NAME) ${FC_NAME_NAME} ## _" CACHE INTERNAL "") + set(FC_FUNC__DEFAULT "(name,NAME) ${FC_NAME_NAME} ## _" CACHE INTERNAL "") + elseif(FC_FN_UNDERSCORE STREQUAL "SECOND_UNDER") + set(FC_FUNC_DEFAULT "(name,NAME) ${FC_NAME_NAME} ## _" CACHE INTERNAL "") + set(FC_FUNC__DEFAULT "(name,NAME) ${FC_NAME_NAME} ## __" CACHE INTERNAL "") + else() + set(FC_FUNC_DEFAULT "(name,NAME) ${FC_NAME_NAME}" CACHE INTERNAL "") + set(FC_FUNC__DEFAULT "(name,NAME) ${FC_NAME_NAME}" CACHE INTERNAL "") + endif() + endif() + +endfunction() # 2008/10/26: rabartl: Below, these were macros that were also present in the @@ -163,7 +163,7 @@ ENDFUNCTION() # (for now) ## - Guess if the Fortran compiler returns REAL in C doubles. -## FORTRAN_FLOATRET() +## fortran_floatret() ## ## If the Fortran compiler follows the f2c convention of ## returning REALs in C doubles, routines like SLAMCH can @@ -176,36 +176,36 @@ ENDFUNCTION() ## The REAL kinds in Fortran 2003's ISO_C_BINDING module should ## be used instead of this test whenever possible. ## -#MACRO(FORTRAN_FLOATRET) -# IF(NOT DEFINED FC_FN_FLOATRET) +#macro(fortran_floatret) +# if(NOT DEFINED FC_FN_FLOATRET) # # Find inputs -# FIND_FILE(_fcindir floatret/ ${CMAKE_MODULE_PATH}) -# SET(_fcdir ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/floatret) -# FILE(MAKE_DIRECTORY ${_fcdir}) -# TRY_COMPILE(_fccrv ${_fcdir} ${_fcindir} floatret +# find_file(_fcindir floatret/ ${CMAKE_MODULE_PATH}) +# set(_fcdir ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/floatret) +# file(MAKE_DIRECTORY ${_fcdir}) +# try_compile(_fccrv ${_fcdir} ${_fcindir} floatret # CMAKE_FLAGS "-DFC_FN_DEFS:STRING=${FC_FN_DEFS}") -# IF(_fccrv) -# EXECUTE_PROCESS(COMMAND ${_fcdir}/ctst +# if(_fccrv) +# execute_process(COMMAND ${_fcdir}/ctst # WORKING_DIRECTORY ${_fcdir} # RESULT_VARIABLE _fcrrv) -# ENDIF(_fccrv) -# IF(_fcrrv EQUAL 0) -# SET(_fc_fn_floatret 0) -# ELSE(_fcrrv EQUAL 0) -# SET(_fc_fn_floatret 1) -# ENDIF(_fcrrv EQUAL 0) -# SET(FC_FN_FLOATRET ${_fc_fn_floatret} CACHE BOOL +# endif(_fccrv) +# if(_fcrrv EQUAL 0) +# set(_fc_fn_floatret 0) +# else(_fcrrv EQUAL 0) +# set(_fc_fn_floatret 1) +# endif(_fcrrv EQUAL 0) +# set(FC_FN_FLOATRET ${_fc_fn_floatret} CACHE BOOL # "Fortran returns REAL in double.") -# MESSAGE(STATUS "Fortran returns REAL in double: ${FC_FN_FLOATRET}") -# ENDIF(NOT DEFINED FC_FN_FLOATRET) -#ENDMACRO() +# message(STATUS "Fortran returns REAL in double: ${FC_FN_FLOATRET}") +# endif(NOT DEFINED FC_FN_FLOATRET) +#endmacro() # # ## - Guess the convention for passing strings from C to Fortran. -## FORTRAN_STRINGARG() +## fortran_stringarg() ## ## If string lengths are directly appended to each variable, e.g. -## CALL FOO('bar', 1.0) becomes foo({'b','a','r'}, 3, 1.0), then +## CALL foo('bar', 1.0) becomes foo({'b','a','r'}, 3, 1.0), then ## FC_FN_STRINGARG is set to PAIRED. If the lengths are appended ## to the call, e.g. foo({'b','a','r'}, 1.0, 3), FC_FN_STRINGARG ## is set to TRAILING. @@ -217,33 +217,33 @@ ENDFUNCTION() ## The string kinds in Fortran 2003's ISO_C_BINDING module should ## be used instead of these conventions whenever possible. ## -#SET(FC_FN_STRINGARG_TYPES "PAIRED" "TRAILING") -#MACRO(FORTRAN_STRINGARG) -# IF(NOT DEFINED FC_FN_STRINGARG) +#set(FC_FN_STRINGARG_TYPES "PAIRED" "TRAILING") +#macro(fortran_stringarg) +# if(NOT DEFINED FC_FN_STRINGARG) # # Find inputs -# FIND_FILE(_fcstrindir fstrings/ ${CMAKE_MODULE_PATH}) -# SET(_fcstrdir ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/fstrings) -# FOREACH(argtype ${FC_FN_STRINGARG_TYPES}) -# FILE(MAKE_DIRECTORY ${_fcstrdir}) -# TRY_COMPILE(_fcstrcrv ${_fcstrdir} ${_fcstrindir} fstrings +# find_file(_fcstrindir fstrings/ ${CMAKE_MODULE_PATH}) +# set(_fcstrdir ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/fstrings) +# foreach(argtype ${FC_FN_STRINGARG_TYPES}) +# file(MAKE_DIRECTORY ${_fcstrdir}) +# try_compile(_fcstrcrv ${_fcstrdir} ${_fcstrindir} fstrings # CMAKE_FLAGS "-DFC_FN_DEFS:STRING=${FC_FN_DEFS}" "-Dargtype:STRING=${argtype}") -# IF(_fcstrcrv) -# EXECUTE_PROCESS(COMMAND ${_fcstrdir}/ccheck +# if(_fcstrcrv) +# execute_process(COMMAND ${_fcstrdir}/ccheck # WORKING_DIRECTORY ${_fcstrdir} # RESULT_VARIABLE _fcstrrrv) -# IF(_fcstrrrv EQUAL 0) -# SET(_fcstr ${argtype}) -# BREAK() -# ENDIF(_fcstrrrv EQUAL 0) -# ENDIF(_fcstrcrv) -# FILE(REMOVE_RECURSE ${_fcstrdir}) -# ENDFOREACH(argtype) -# IF(DEFINED _fcstr) -# SET(FC_FN_STRINGARG ${_fcstr} CACHE STRING +# if(_fcstrrrv EQUAL 0) +# set(_fcstr ${argtype}) +# break() +# endif(_fcstrrrv EQUAL 0) +# endif(_fcstrcrv) +# file(REMOVE_RECURSE ${_fcstrdir}) +# endforeach(argtype) +# if(DEFINED _fcstr) +# set(FC_FN_STRINGARG ${_fcstr} CACHE STRING # "How Fortran accepts string arguments.") -# MESSAGE(STATUS "Fortran string passing: ${FC_FN_STRINGARG}") -# ELSE(DEFINED _fcstr) -# MESSAGE(STATUS "Cannot determine Fortran string passing.") -# ENDIF(DEFINED _fcstr) -# ENDIF(NOT DEFINED FC_FN_STRINGARG) -#ENDMACRO() +# message(STATUS "Fortran string passing: ${FC_FN_STRINGARG}") +# else(DEFINED _fcstr) +# message(STATUS "Cannot determine Fortran string passing.") +# endif(DEFINED _fcstr) +# endif(NOT DEFINED FC_FN_STRINGARG) +#endmacro() diff --git a/cmake/tribits/core/config_tests/MathLibraryNeeded.cmake b/cmake/tribits/core/config_tests/MathLibraryNeeded.cmake index fb716328485c..685dc9a627df 100644 --- a/cmake/tribits/core/config_tests/MathLibraryNeeded.cmake +++ b/cmake/tribits/core/config_tests/MathLibraryNeeded.cmake @@ -38,13 +38,13 @@ # @HEADER -INCLUDE(CheckCSourceCompiles) +include(CheckCSourceCompiles) -IF (NOT MATH_LIBRARY_IS_SUPPLIED AND NOT MATH_LIBRARY_IS_SET) +if (NOT MATH_LIBRARY_IS_SUPPLIED AND NOT MATH_LIBRARY_IS_SET) - SET(CMAKE_REQUIRED_LIBRARIES ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}) + set(CMAKE_REQUIRED_LIBRARIES ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}) - CHECK_C_SOURCE_COMPILES( + check_c_source_compiles( " #include int main() @@ -58,36 +58,36 @@ int main() MATH_LIBRARY_IS_SUPPLIED ) - SET(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_LIBRARIES) - IF (NOT MATH_LIBRARY_IS_SUPPLIED) + if (NOT MATH_LIBRARY_IS_SUPPLIED) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Searching for -lm ...") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Searching for -lm ...") + endif() - SET(MATH_LIBRARY NOTFOUND) - FIND_LIBRARY(MATH_LIBRARY m) + set(MATH_LIBRARY NOTFOUND) + find_library(MATH_LIBRARY m) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "MATH_LIBRARY = ${MATH_LIBRARY}") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "MATH_LIBRARY = ${MATH_LIBRARY}") + endif() - IF (MATH_LIBRARY) - IF (NOT MATH_LIBRARY_IS_SET) - MESSAGE(STATUS "Appending math library ${MATH_LIBRARY} to link line ...") - SET(${PROJECT_NAME}_EXTRA_LINK_FLAGS ${${PROJECT_NAME}_EXTRA_LINK_FLAGS} ${MATH_LIBRARY} + if (MATH_LIBRARY) + if (NOT MATH_LIBRARY_IS_SET) + message(STATUS "Appending math library ${MATH_LIBRARY} to link line ...") + set(${PROJECT_NAME}_EXTRA_LINK_FLAGS ${${PROJECT_NAME}_EXTRA_LINK_FLAGS} ${MATH_LIBRARY} CACHE STRING "" FORCE) - GLOBAL_SET(MATH_LIBRARY_IS_SET ON) + global_set(MATH_LIBRARY_IS_SET ON) # NOTE: Only do this once and not over and over or you will relink # everything after each configure! - ENDIF() - ELSE() - MESSAGE(SEND_ERROR + endif() + else() + message(SEND_ERROR "Error, the math library for C programs could not be found!" ) - ENDIF() + endif() - ENDIF() + endif() -ENDIF() +endif() diff --git a/cmake/tribits/core/config_tests/blasmangle/CMakeLists.txt b/cmake/tribits/core/config_tests/blasmangle/CMakeLists.txt index 8d8553637198..44d3db5d56d5 100644 --- a/cmake/tribits/core/config_tests/blasmangle/CMakeLists.txt +++ b/cmake/tribits/core/config_tests/blasmangle/CMakeLists.txt @@ -37,8 +37,8 @@ # ************************************************************************ # @HEADER -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(blasmangle C) -SET(CMAKE_VERBOSE_MAKEFILE ON) -ADD_EXECUTABLE(blasmangle blasmangle.c) -ADD_DEFINITIONS(${MANGLE_FLAGS}) +cmake_minimum_required(VERSION 2.6) +project(blasmangle C) +set(CMAKE_VERBOSE_MAKEFILE ON) +add_executable(blasmangle blasmangle.c) +add_definitions(${MANGLE_FLAGS}) diff --git a/cmake/tribits/core/config_tests/fmangle/CMakeLists.txt b/cmake/tribits/core/config_tests/fmangle/CMakeLists.txt index 156e5052563c..0e24dacff5d5 100644 --- a/cmake/tribits/core/config_tests/fmangle/CMakeLists.txt +++ b/cmake/tribits/core/config_tests/fmangle/CMakeLists.txt @@ -37,10 +37,10 @@ # ************************************************************************ # @HEADER -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(fmangle C Fortran) -ADD_DEFINITIONS(${COMMON_DEFS}) -SET(CMAKE_VERBOSE_MAKEFILE ON) -ADD_LIBRARY(fmangle fmangle.f) -ADD_EXECUTABLE(cmangle cmangle.c) -TARGET_LINK_LIBRARIES(cmangle fmangle) +cmake_minimum_required(VERSION 3.17) +project(fmangle C Fortran) +add_definitions(${COMMON_DEFS}) +set(CMAKE_VERBOSE_MAKEFILE ON) +add_library(fmangle fmangle.f) +add_executable(cmangle cmangle.c) +target_link_libraries(cmangle fmangle) diff --git a/cmake/tribits/core/installation/TribitsConfigInclude.cmake.in b/cmake/tribits/core/installation/TribitsConfigInclude.cmake.in index 77d66db543e0..37c829025866 100644 --- a/cmake/tribits/core/installation/TribitsConfigInclude.cmake.in +++ b/cmake/tribits/core/installation/TribitsConfigInclude.cmake.in @@ -38,10 +38,10 @@ # ************************************************************************ # @HEADER -GET_FILENAME_COMPONENT(_@PROJECT_NAME@_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -GET_FILENAME_COMPONENT(_@PROJECT_NAME@_PREFIX "${_@PROJECT_NAME@_DIR}" PATH) -SET(@PROJECT_NAME@_DIR "${_@PROJECT_NAME@_PREFIX}/lib/cmake/@PROJECT_NAME@") -MESSAGE(WARNING "@PROJECT_NAME@Config.cmake has moved. " +get_filename_component(_@PROJECT_NAME@_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_@PROJECT_NAME@_PREFIX "${_@PROJECT_NAME@_DIR}" PATH) +set(@PROJECT_NAME@_DIR "${_@PROJECT_NAME@_PREFIX}/lib/cmake/@PROJECT_NAME@") +message(WARNING "@PROJECT_NAME@Config.cmake has moved. " "It now exists at a location under the installation prefix where the " "find_package command looks by default (/lib/cmake/@PROJECT_NAME@). " "This compatibility file exists at the old location (/include) " @@ -63,4 +63,4 @@ MESSAGE(WARNING "@PROJECT_NAME@Config.cmake has moved. " "to find @PROJECT_NAME@Config.cmake in its new location in future builds " "while still honoring the @PROJECT_NAME@_PATH option for this application." ) -INCLUDE(${@PROJECT_NAME@_DIR}/@PROJECT_NAME@Config.cmake) +include(${@PROJECT_NAME@_DIR}/@PROJECT_NAME@Config.cmake) diff --git a/cmake/tribits/core/installation/TribitsInstallationTestingMacros.cmake b/cmake/tribits/core/installation/TribitsInstallationTestingMacros.cmake index 2d0951db16d0..edd10e8878e6 100644 --- a/cmake/tribits/core/installation/TribitsInstallationTestingMacros.cmake +++ b/cmake/tribits/core/installation/TribitsInstallationTestingMacros.cmake @@ -43,37 +43,37 @@ # (the check that we are in installation mode is inside the macro) # -FUNCTION(TRIBITS_FIND_PROJECT_INSTALL) +function(tribits_find_project_install) - IF(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Searching for ${PROJECT_NAME} installation at ${${PROJECT_NAME}_INSTALLATION_DIR}/include") - ENDIF() - FIND_PACKAGE(${PROJECT_NAME} REQUIRED HINTS ${${PROJECT_NAME}_INSTALLATION_DIR}) + if(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Searching for ${PROJECT_NAME} installation at ${${PROJECT_NAME}_INSTALLATION_DIR}/include") + endif() + find_package(${PROJECT_NAME} REQUIRED HINTS ${${PROJECT_NAME}_INSTALLATION_DIR}) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Found ${PROJECT_NAME} installation version ${${PROJECT_NAME}_VERSION} at ${${PROJECT_NAME}_DIR}") - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Found ${PROJECT_NAME} installation version ${${PROJECT_NAME}_VERSION} at ${${PROJECT_NAME}_DIR}") + endif() #renaming some of the variables so that they do not clash with the variables of the same name. - SET(${PROJECT_NAME}_INSTALLATION_VERSION ${${PROJECT_NAME}_VERSION} PARENT_SCOPE) - SET(${PROJECT_NAME}_INSTALLATION_INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS} PARENT_SCOPE) - SET(${PROJECT_NAME}_INSTALLATION_LIBRARY_DIRS ${${PROJECT_NAME}_LIBRARY_DIRS} PARENT_SCOPE) - SET(${PROJECT_NAME}_INSTALLATION_LIBRARIES ${${PROJECT_NAME}_LIBRARIES} PARENT_SCOPE) - SET(${PROJECT_NAME}_INSTALLATION_PACKAGE_LIST ${${PROJECT_NAME}_PACKAGE_LIST} PARENT_SCOPE) - SET(${PROJECT_NAME}_INSTALLATION_BUILD_SHARED_LIBS ${${PROJECT_NAME}_BUILD_SHARED_LIBS} PARENT_SCOPE) - SET(${PROJECT_NAME}_INSTALLATION_TPL_INCLUDE_DIRS ${${PROJECT_NAME}_TPL_INCLUDE_DIRS} PARENT_SCOPE) - SET(${PROJECT_NAME}_INSTALLATION_TPL_LIBRARY_DIRS ${${PROJECT_NAME}_TPL_LIBRARY_DIRS} PARENT_SCOPE) - SET(${PROJECT_NAME}_INSTALLATION_TPL_LIBRARIES ${${PROJECT_NAME}_TPL_LIBRARIES} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_VERSION ${${PROJECT_NAME}_VERSION} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_LIBRARY_DIRS ${${PROJECT_NAME}_LIBRARY_DIRS} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_LIBRARIES ${${PROJECT_NAME}_LIBRARIES} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_PACKAGE_LIST ${${PROJECT_NAME}_PACKAGE_LIST} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_BUILD_SHARED_LIBS ${${PROJECT_NAME}_BUILD_SHARED_LIBS} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_TPL_INCLUDE_DIRS ${${PROJECT_NAME}_TPL_INCLUDE_DIRS} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_TPL_LIBRARY_DIRS ${${PROJECT_NAME}_TPL_LIBRARY_DIRS} PARENT_SCOPE) + set(${PROJECT_NAME}_INSTALLATION_TPL_LIBRARIES ${${PROJECT_NAME}_TPL_LIBRARIES} PARENT_SCOPE) - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGE_LIST}) - SET(${TRIBITS_PACKAGE}_INSTALLATION_INCLUDE_DIRS ${${TRIBITS_PACKAGE}_INCLUDE_DIRS} PARENT_SCOPE) - SET(${TRIBITS_PACKAGE}_INSTALLATION_LIBRARY_DIRS ${${TRIBITS_PACKAGE}_LIBRARY_DIRS} PARENT_SCOPE) - SET(${TRIBITS_PACKAGE}_INSTALLATION_LIBRARIES ${${TRIBITS_PACKAGE}_LIBRARIES} PARENT_SCOPE) - SET(${TRIBITS_PACKAGE}_INSTALLATION_TPL_INCLUDE_DIRS ${${TRIBITS_PACKAGE}_TPL_INCLUDE_DIRS} PARENT_SCOPE) - SET(${TRIBITS_PACKAGE}_INSTALLATION_TPL_LIBRARY_DIRS ${${TRIBITS_PACKAGE}_TPL_LIBRARY_DIRS} PARENT_SCOPE) - SET(${TRIBITS_PACKAGE}_INSTALLATION_TPL_LIBRARIES ${${TRIBITS_PACKAGE}_TPL_LIBRARIES} PARENT_SCOPE) - ENDFOREACH() + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGE_LIST}) + set(${TRIBITS_PACKAGE}_INSTALLATION_INCLUDE_DIRS ${${TRIBITS_PACKAGE}_INCLUDE_DIRS} PARENT_SCOPE) + set(${TRIBITS_PACKAGE}_INSTALLATION_LIBRARY_DIRS ${${TRIBITS_PACKAGE}_LIBRARY_DIRS} PARENT_SCOPE) + set(${TRIBITS_PACKAGE}_INSTALLATION_LIBRARIES ${${TRIBITS_PACKAGE}_LIBRARIES} PARENT_SCOPE) + set(${TRIBITS_PACKAGE}_INSTALLATION_TPL_INCLUDE_DIRS ${${TRIBITS_PACKAGE}_TPL_INCLUDE_DIRS} PARENT_SCOPE) + set(${TRIBITS_PACKAGE}_INSTALLATION_TPL_LIBRARY_DIRS ${${TRIBITS_PACKAGE}_TPL_LIBRARY_DIRS} PARENT_SCOPE) + set(${TRIBITS_PACKAGE}_INSTALLATION_TPL_LIBRARIES ${${TRIBITS_PACKAGE}_TPL_LIBRARIES} PARENT_SCOPE) + endforeach() - ENDIF() -ENDFUNCTION() + endif() +endfunction() diff --git a/cmake/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in b/cmake/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in index 26a1d0ea4a43..0ebe06a1651b 100644 --- a/cmake/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in +++ b/cmake/tribits/core/installation/TribitsPackageConfigTemplate.cmake.in @@ -52,13 +52,13 @@ ${DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET} ## Compilers used by ${PROJECT_NAME}/${PACKAGE_NAME} build ## --------------------------------------------------------------------------- -SET(${EXPORT_FILE_VAR_PREFIX}_CXX_COMPILER "${CMAKE_CXX_COMPILER_FOR_CONFIG_FILE}") +set(${EXPORT_FILE_VAR_PREFIX}_CXX_COMPILER "${CMAKE_CXX_COMPILER_FOR_CONFIG_FILE}") -SET(${EXPORT_FILE_VAR_PREFIX}_C_COMPILER "${CMAKE_C_COMPILER_FOR_CONFIG_FILE}") +set(${EXPORT_FILE_VAR_PREFIX}_C_COMPILER "${CMAKE_C_COMPILER_FOR_CONFIG_FILE}") -SET(${EXPORT_FILE_VAR_PREFIX}_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CONFIG_FILE}") +set(${EXPORT_FILE_VAR_PREFIX}_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CONFIG_FILE}") # Deprecated! -SET(${EXPORT_FILE_VAR_PREFIX}_FORTRAN_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CONFIG_FILE}") +set(${EXPORT_FILE_VAR_PREFIX}_FORTRAN_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CONFIG_FILE}") ## --------------------------------------------------------------------------- @@ -66,52 +66,52 @@ SET(${EXPORT_FILE_VAR_PREFIX}_FORTRAN_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CON ## --------------------------------------------------------------------------- ## Give the build type -SET(${EXPORT_FILE_VAR_PREFIX}_CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}") +set(${EXPORT_FILE_VAR_PREFIX}_CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}") ## Set compiler flags, including those determined by build type -SET(${EXPORT_FILE_VAR_PREFIX}_CXX_FLAGS "${CMAKE_CXX_FLAGS_ESCAPED} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}") +set(${EXPORT_FILE_VAR_PREFIX}_CXX_FLAGS [[${CMAKE_CXX_FLAGS_ESCAPED} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}]]) -SET(${EXPORT_FILE_VAR_PREFIX}_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}") +set(${EXPORT_FILE_VAR_PREFIX}_C_FLAGS [[${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}]]) -SET(${EXPORT_FILE_VAR_PREFIX}_Fortran_FLAGS "${CMAKE_FORTRAN_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}") +set(${EXPORT_FILE_VAR_PREFIX}_Fortran_FLAGS [[${CMAKE_FORTRAN_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}]]) # Deprecated -SET(${EXPORT_FILE_VAR_PREFIX}_FORTRAN_FLAGS "${CMAKE_FORTRAN_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}") +set(${EXPORT_FILE_VAR_PREFIX}_FORTRAN_FLAGS [[${CMAKE_FORTRAN_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}]]) ## Extra link flags (e.g., specification of fortran libraries) -SET(${EXPORT_FILE_VAR_PREFIX}_EXTRA_LD_FLAGS "${${PROJECT_NAME}_EXTRA_LINK_FLAGS}") +set(${EXPORT_FILE_VAR_PREFIX}_EXTRA_LD_FLAGS [[${${PROJECT_NAME}_EXTRA_LINK_FLAGS}]]) ## This is the command-line entry used for setting rpaths. In a build ## with static libraries it will be empty. -SET(${EXPORT_FILE_VAR_PREFIX}_SHARED_LIB_RPATH_COMMAND "${SHARED_LIB_RPATH_COMMAND}") -SET(${EXPORT_FILE_VAR_PREFIX}_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}") +set(${EXPORT_FILE_VAR_PREFIX}_SHARED_LIB_RPATH_COMMAND "${SHARED_LIB_RPATH_COMMAND}") +set(${EXPORT_FILE_VAR_PREFIX}_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}") -SET(${EXPORT_FILE_VAR_PREFIX}_LINKER ${CMAKE_LINKER}) -SET(${EXPORT_FILE_VAR_PREFIX}_AR ${CMAKE_AR}) +set(${EXPORT_FILE_VAR_PREFIX}_LINKER ${CMAKE_LINKER}) +set(${EXPORT_FILE_VAR_PREFIX}_AR ${CMAKE_AR}) ## --------------------------------------------------------------------------- ## Set library specifications and paths ## --------------------------------------------------------------------------- ## Base install location (if not in the build tree) -SET(${EXPORT_FILE_VAR_PREFIX}_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@") +set(${EXPORT_FILE_VAR_PREFIX}_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@") ## List of package include dirs -SET(${EXPORT_FILE_VAR_PREFIX}_INCLUDE_DIRS "${FULL_INCLUDE_DIRS_SET}") +set(${EXPORT_FILE_VAR_PREFIX}_INCLUDE_DIRS "${FULL_INCLUDE_DIRS_SET}") ## List of package library paths -SET(${EXPORT_FILE_VAR_PREFIX}_LIBRARY_DIRS "${FULL_LIBRARY_DIRS_SET}") +set(${EXPORT_FILE_VAR_PREFIX}_LIBRARY_DIRS "${FULL_LIBRARY_DIRS_SET}") ## List of package libraries -SET(${EXPORT_FILE_VAR_PREFIX}_LIBRARIES "${FULL_LIBRARY_SET}") +set(${EXPORT_FILE_VAR_PREFIX}_LIBRARIES "${FULL_LIBRARY_SET}") ## Specification of directories for TPL headers -SET(${EXPORT_FILE_VAR_PREFIX}_TPL_INCLUDE_DIRS "${${PACKAGE_NAME}_TPL_INCLUDE_DIRS}") +set(${EXPORT_FILE_VAR_PREFIX}_TPL_INCLUDE_DIRS "${${PACKAGE_NAME}_TPL_INCLUDE_DIRS}") ## Specification of directories for TPL libraries -SET(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARY_DIRS "${${PACKAGE_NAME}_TPL_LIBRARY_DIRS}") +set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARY_DIRS "${${PACKAGE_NAME}_TPL_LIBRARY_DIRS}") ## List of required TPLs -SET(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARIES "${${PACKAGE_NAME}_TPL_LIBRARIES}") +set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARIES "${${PACKAGE_NAME}_TPL_LIBRARIES}") ## --------------------------------------------------------------------------- ## MPI specific variables @@ -119,21 +119,21 @@ SET(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARIES "${${PACKAGE_NAME}_TPL_LIBRARIES}") ## and includes on systems that do not use the mpi wrappers for compiling ## --------------------------------------------------------------------------- -SET(${EXPORT_FILE_VAR_PREFIX}_MPI_LIBRARIES "${TPL_MPI_LIBRARIES}") -SET(${EXPORT_FILE_VAR_PREFIX}_MPI_LIBRARY_DIRS "${TPL_MPI_LIBRARY_DIRS}") -SET(${EXPORT_FILE_VAR_PREFIX}_MPI_INCLUDE_DIRS "${TPL_MPI_INCLUDE_DIRS}") -SET(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC "${MPI_EXEC}") -SET(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC_MAX_NUMPROCS "${MPI_EXEC_MAX_NUMPROCS}") -SET(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC_NUMPROCS_FLAG "${MPI_EXEC_NUMPROCS_FLAG}") +set(${EXPORT_FILE_VAR_PREFIX}_MPI_LIBRARIES "${TPL_MPI_LIBRARIES}") +set(${EXPORT_FILE_VAR_PREFIX}_MPI_LIBRARY_DIRS "${TPL_MPI_LIBRARY_DIRS}") +set(${EXPORT_FILE_VAR_PREFIX}_MPI_INCLUDE_DIRS "${TPL_MPI_INCLUDE_DIRS}") +set(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC "${MPI_EXEC}") +set(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC_MAX_NUMPROCS "${MPI_EXEC_MAX_NUMPROCS}") +set(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC_NUMPROCS_FLAG "${MPI_EXEC_NUMPROCS_FLAG}") ## --------------------------------------------------------------------------- ## Set useful general variables ## --------------------------------------------------------------------------- ## The packages enabled for this project -SET(${EXPORT_FILE_VAR_PREFIX}_PACKAGE_LIST "${FULL_PACKAGE_SET}") +set(${EXPORT_FILE_VAR_PREFIX}_PACKAGE_LIST "${FULL_PACKAGE_SET}") ## The TPLs enabled for this project -SET(${EXPORT_FILE_VAR_PREFIX}_TPL_LIST "${ORDERED_FULL_TPL_SET}") +set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIST "${ORDERED_FULL_TPL_SET}") ${PACKAGE_CONFIG_CODE} diff --git a/cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in b/cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in index 0d71cd0b206f..55e5b6e6ca3a 100644 --- a/cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in +++ b/cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in @@ -55,34 +55,34 @@ ${DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET} ## Compilers used by ${PROJECT_NAME} build ## --------------------------------------------------------------------------- -SET(${PROJECT_NAME}_CXX_COMPILER "${CMAKE_CXX_COMPILER_FOR_CONFIG_FILE}") +set(${PROJECT_NAME}_CXX_COMPILER "${CMAKE_CXX_COMPILER_FOR_CONFIG_FILE}") -SET(${PROJECT_NAME}_C_COMPILER "${CMAKE_C_COMPILER_FOR_CONFIG_FILE}") +set(${PROJECT_NAME}_C_COMPILER "${CMAKE_C_COMPILER_FOR_CONFIG_FILE}") -SET(${PROJECT_NAME}_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CONFIG_FILE}") +set(${PROJECT_NAME}_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CONFIG_FILE}") ## --------------------------------------------------------------------------- ## Compiler flags used by ${PROJECT_NAME} build ## --------------------------------------------------------------------------- -SET(${PROJECT_NAME}_CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}") +set(${PROJECT_NAME}_CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}") -SET(${PROJECT_NAME}_CXX_COMPILER_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}") +set(${PROJECT_NAME}_CXX_COMPILER_FLAGS [[${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}]]) -SET(${PROJECT_NAME}_C_COMPILER_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}") +set(${PROJECT_NAME}_C_COMPILER_FLAGS [[${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}]]) -SET(${PROJECT_NAME}_Fortran_COMPILER_FLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}") +set(${PROJECT_NAME}_Fortran_COMPILER_FLAGS [[${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}]]) ## Extra link flags (e.g., specification of fortran libraries) -SET(${PROJECT_NAME}_EXTRA_LD_FLAGS "${${PROJECT_NAME}_EXTRA_LINK_FLAGS}") +set(${PROJECT_NAME}_EXTRA_LD_FLAGS [[${${PROJECT_NAME}_EXTRA_LINK_FLAGS}]]) ## This is the command-line entry used for setting rpaths. In a build ## with static libraries it will be empty. -SET(${PROJECT_NAME}_SHARED_LIB_RPATH_COMMAND "${SHARED_LIB_RPATH_COMMAND}") -SET(${PROJECT_NAME}_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}") +set(${PROJECT_NAME}_SHARED_LIB_RPATH_COMMAND "${SHARED_LIB_RPATH_COMMAND}") +set(${PROJECT_NAME}_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}") -SET(${PROJECT_NAME}_LINKER ${CMAKE_LINKER}) -SET(${PROJECT_NAME}_AR ${CMAKE_AR}) +set(${PROJECT_NAME}_LINKER ${CMAKE_LINKER}) +set(${PROJECT_NAME}_AR ${CMAKE_AR}) ## --------------------------------------------------------------------------- @@ -90,81 +90,81 @@ SET(${PROJECT_NAME}_AR ${CMAKE_AR}) ## --------------------------------------------------------------------------- ## The project version number -SET(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}") +set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}") # For best practices in handling of components, see # . # # If components were requested, include only those. If not, include all of # Trilinos. -IF (${PROJECT_NAME}_FIND_COMPONENTS) - SET(COMPONENTS_LIST ${PDOLLAR}{${PROJECT_NAME}_FIND_COMPONENTS}) -ELSE() - SET(COMPONENTS_LIST ${FULL_PACKAGE_SET}) -ENDIF() +if (${PROJECT_NAME}_FIND_COMPONENTS) + set(COMPONENTS_LIST ${PDOLLAR}{${PROJECT_NAME}_FIND_COMPONENTS}) +else() + set(COMPONENTS_LIST ${FULL_PACKAGE_SET}) +endif() # Initialize ${PROJECT_NAME}_FOUND with true, and set it to FALSE if any of # the required components wasn't found. -SET(${PROJECT_NAME}_FOUND TRUE) -FOREACH(comp ${PDOLLAR}{COMPONENTS_LIST}) - SET( +set(${PROJECT_NAME}_FOUND TRUE) +foreach(comp ${PDOLLAR}{COMPONENTS_LIST}) + set( INCLUDE_FILE ${PDOLLAR}{CMAKE_CURRENT_LIST_DIR}/../${PDOLLAR}{comp}/${PDOLLAR}{comp}Config.cmake ) - IF (EXISTS ${PDOLLAR}{INCLUDE_FILE}) + if (EXISTS ${PDOLLAR}{INCLUDE_FILE}) # Set ${PROJECT_NAME}__FOUND. - SET(${PROJECT_NAME}_${PDOLLAR}{comp}_FOUND TRUE) + set(${PROJECT_NAME}_${PDOLLAR}{comp}_FOUND TRUE) # Include the package file. - INCLUDE(${PDOLLAR}{INCLUDE_FILE}) + include(${PDOLLAR}{INCLUDE_FILE}) # Add variables to lists. - LIST(APPEND ${PROJECT_NAME}_INCLUDE_DIRS ${PDOLLAR}{${PDOLLAR}{comp}_INCLUDE_DIRS}) - LIST(APPEND ${PROJECT_NAME}_LIBRARY_DIRS ${PDOLLAR}{${PDOLLAR}{comp}_LIBRARY_DIRS}) - LIST(APPEND ${PROJECT_NAME}_LIBRARIES ${PDOLLAR}{${PDOLLAR}{comp}_LIBRARIES}) - LIST(APPEND ${PROJECT_NAME}_TPL_INCLUDE_DIRS ${PDOLLAR}{${PDOLLAR}{comp}_TPL_INCLUDE_DIRS}) - LIST(APPEND ${PROJECT_NAME}_TPL_LIBRARY_DIRS ${PDOLLAR}{${PDOLLAR}{comp}_TPL_LIBRARY_DIRS}) - LIST(APPEND ${PROJECT_NAME}_TPL_LIBRARIES ${PDOLLAR}{${PDOLLAR}{comp}_TPL_LIBRARIES}) - ELSE() + list(APPEND ${PROJECT_NAME}_INCLUDE_DIRS ${PDOLLAR}{${PDOLLAR}{comp}_INCLUDE_DIRS}) + list(APPEND ${PROJECT_NAME}_LIBRARY_DIRS ${PDOLLAR}{${PDOLLAR}{comp}_LIBRARY_DIRS}) + list(APPEND ${PROJECT_NAME}_LIBRARIES ${PDOLLAR}{${PDOLLAR}{comp}_LIBRARIES}) + list(APPEND ${PROJECT_NAME}_TPL_INCLUDE_DIRS ${PDOLLAR}{${PDOLLAR}{comp}_TPL_INCLUDE_DIRS}) + list(APPEND ${PROJECT_NAME}_TPL_LIBRARY_DIRS ${PDOLLAR}{${PDOLLAR}{comp}_TPL_LIBRARY_DIRS}) + list(APPEND ${PROJECT_NAME}_TPL_LIBRARIES ${PDOLLAR}{${PDOLLAR}{comp}_TPL_LIBRARIES}) + else() # Set ${PROJECT_NAME}__FOUND to FALSE. - SET(${PROJECT_NAME}_${PDOLLAR}{comp}_FOUND FALSE) + set(${PROJECT_NAME}_${PDOLLAR}{comp}_FOUND FALSE) # Set ${PROJECT_NAME}_FOUND to FALSE if component is not optional. - IF(${PROJECT_NAME}_FIND_REQUIRED_${PDOLLAR}{comp}) - SET(${PROJECT_NAME}_FOUND FALSE) - ENDIF() - ENDIF() -ENDFOREACH() + if(${PROJECT_NAME}_FIND_REQUIRED_${PDOLLAR}{comp}) + set(${PROJECT_NAME}_FOUND FALSE) + endif() + endif() +endforeach() # Resolve absolute paths and remove duplicate paths # for LIBRARY_DIRS and INCLUDE_DIRS # This reduces stress on regular expressions later -SET(short_dirs) -FOREACH(dir ${PDOLLAR}{${PROJECT_NAME}_INCLUDE_DIRS}) - GET_FILENAME_COMPONENT(dir_abs ${PDOLLAR}{dir} ABSOLUTE) - LIST(APPEND short_dirs ${PDOLLAR}{dir_abs}) -ENDFOREACH() -LIST(REMOVE_DUPLICATES short_dirs) -SET(${PROJECT_NAME}_INCLUDE_DIRS ${PDOLLAR}{short_dirs}) - -SET(short_dirs) -FOREACH(dir ${PDOLLAR}{${PROJECT_NAME}_LIBRARY_DIRS}) - GET_FILENAME_COMPONENT(dir_abs ${PDOLLAR}{dir} ABSOLUTE) - LIST(APPEND short_dirs ${PDOLLAR}{dir_abs}) -ENDFOREACH() -LIST(REMOVE_DUPLICATES short_dirs) -SET(${PROJECT_NAME}_LIBRARY_DIRS ${PDOLLAR}{short_dirs}) +set(short_dirs) +foreach(dir ${PDOLLAR}{${PROJECT_NAME}_INCLUDE_DIRS}) + get_filename_component(dir_abs ${PDOLLAR}{dir} ABSOLUTE) + list(APPEND short_dirs ${PDOLLAR}{dir_abs}) +endforeach() +list(REMOVE_DUPLICATES short_dirs) +set(${PROJECT_NAME}_INCLUDE_DIRS ${PDOLLAR}{short_dirs}) + +set(short_dirs) +foreach(dir ${PDOLLAR}{${PROJECT_NAME}_LIBRARY_DIRS}) + get_filename_component(dir_abs ${PDOLLAR}{dir} ABSOLUTE) + list(APPEND short_dirs ${PDOLLAR}{dir_abs}) +endforeach() +list(REMOVE_DUPLICATES short_dirs) +set(${PROJECT_NAME}_LIBRARY_DIRS ${PDOLLAR}{short_dirs}) # Remove duplicates in ${PROJECT_NAME}_LIBRARIES -LIST(REVERSE ${PROJECT_NAME}_LIBRARIES) -LIST(REMOVE_DUPLICATES ${PROJECT_NAME}_LIBRARIES) -LIST(REVERSE ${PROJECT_NAME}_LIBRARIES) +list(REVERSE ${PROJECT_NAME}_LIBRARIES) +list(REMOVE_DUPLICATES ${PROJECT_NAME}_LIBRARIES) +list(REVERSE ${PROJECT_NAME}_LIBRARIES) # Remove duplicates in ${PROJECT_NAME}_TPL_INCLUDE_DIRS -IF (${PROJECT_NAME}_TPL_INCLUDE_DIRS) - LIST(REMOVE_DUPLICATES ${PROJECT_NAME}_TPL_INCLUDE_DIRS) -ENDIF() +if (${PROJECT_NAME}_TPL_INCLUDE_DIRS) + list(REMOVE_DUPLICATES ${PROJECT_NAME}_TPL_INCLUDE_DIRS) +endif() # NOTE: It is *NOT* safe to try to remove duplicate in # ${PROJECT_NAME}_TPL_LIBRARIES because these can be specified as -L, -l, etc. -# Actaully, we should think about that. +# Actually, we should think about that. ## --------------------------------------------------------------------------- ## MPI specific variables @@ -172,31 +172,31 @@ ENDIF() ## and includes on systems that do not use the mpi wrappers for compiling ## --------------------------------------------------------------------------- -SET(${PROJECT_NAME}_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}") -SET(${PROJECT_NAME}_MPI_LIBRARIES "${TPL_MPI_LIBRARIES}") -SET(${PROJECT_NAME}_MPI_LIBRARY_DIRS "${TPL_MPI_LIBRARY_DIRS}") -SET(${PROJECT_NAME}_MPI_INCLUDE_DIRS "${TPL_MPI_INCLUDE_DIRS}") -SET(${PROJECT_NAME}_MPI_EXEC "${MPI_EXEC}") -SET(${PROJECT_NAME}_MPI_EXEC_PRE_NUMPROCS_FLAGS "${MPI_EXEC_PRE_NUMPROCS_FLAGS}") -SET(${PROJECT_NAME}_MPI_EXEC_MAX_NUMPROCS "${MPI_EXEC_MAX_NUMPROCS}") -SET(${PROJECT_NAME}_MPI_EXEC_POST_NUMPROCS_FLAGS "${MPI_EXEC_POST_NUMPROCS_FLAGS}") -SET(${PROJECT_NAME}_MPI_EXEC_NUMPROCS_FLAG "${MPI_EXEC_NUMPROCS_FLAG}") +set(${PROJECT_NAME}_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}") +set(${PROJECT_NAME}_MPI_LIBRARIES "${TPL_MPI_LIBRARIES}") +set(${PROJECT_NAME}_MPI_LIBRARY_DIRS "${TPL_MPI_LIBRARY_DIRS}") +set(${PROJECT_NAME}_MPI_INCLUDE_DIRS "${TPL_MPI_INCLUDE_DIRS}") +set(${PROJECT_NAME}_MPI_EXEC "${MPI_EXEC}") +set(${PROJECT_NAME}_MPI_EXEC_PRE_NUMPROCS_FLAGS "${MPI_EXEC_PRE_NUMPROCS_FLAGS}") +set(${PROJECT_NAME}_MPI_EXEC_MAX_NUMPROCS "${MPI_EXEC_MAX_NUMPROCS}") +set(${PROJECT_NAME}_MPI_EXEC_POST_NUMPROCS_FLAGS "${MPI_EXEC_POST_NUMPROCS_FLAGS}") +set(${PROJECT_NAME}_MPI_EXEC_NUMPROCS_FLAG "${MPI_EXEC_NUMPROCS_FLAG}") ## --------------------------------------------------------------------------- ## Compiler vendor identifications ## --------------------------------------------------------------------------- -SET(${PROJECT_NAME}_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") -SET(${PROJECT_NAME}_CXX_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") -SET(${PROJECT_NAME}_C_COMPILER_ID "${CMAKE_C_COMPILER_ID}") -SET(${PROJECT_NAME}_Fortran_COMPILER_ID "${CMAKE_Fortran_COMPILER_ID}") -SET(${PROJECT_NAME}_Fortran_IMPLICIT_LINK_LIBRARIES "${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}") +set(${PROJECT_NAME}_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") +set(${PROJECT_NAME}_CXX_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") +set(${PROJECT_NAME}_C_COMPILER_ID "${CMAKE_C_COMPILER_ID}") +set(${PROJECT_NAME}_Fortran_COMPILER_ID "${CMAKE_Fortran_COMPILER_ID}") +set(${PROJECT_NAME}_Fortran_IMPLICIT_LINK_LIBRARIES "${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}") ## --------------------------------------------------------------------------- ## Set useful general variables ## --------------------------------------------------------------------------- ## The packages enabled for this project -SET(${PROJECT_NAME}_PACKAGE_LIST "${FULL_PACKAGE_SET}") +set(${PROJECT_NAME}_PACKAGE_LIST "${FULL_PACKAGE_SET}") ## The TPLs enabled for this project -SET(${PROJECT_NAME}_TPL_LIST "${FULL_TPL_SET}") +set(${PROJECT_NAME}_TPL_LIST "${FULL_TPL_SET}") diff --git a/cmake/tribits/core/installation/add_install_group_and_perms_fixups/CMakeLists.txt b/cmake/tribits/core/installation/add_install_group_and_perms_fixups/CMakeLists.txt index aca219885f92..6686d3a42832 100644 --- a/cmake/tribits/core/installation/add_install_group_and_perms_fixups/CMakeLists.txt +++ b/cmake/tribits/core/installation/add_install_group_and_perms_fixups/CMakeLists.txt @@ -1,13 +1,13 @@ -INCLUDE(TribitsAddInstallGroupAndPermsFixups) +include(TribitsAddInstallGroupAndPermsFixups) -TRIBITS_ADD_INSTALL_GROUP_AND_PERMS_FIXUPS() +tribits_add_install_group_and_perms_fixups() # NOTE: This is a workaround for a problem with an issue with CMake where you # must call install(SCRIPT ...) in a subdirectory added with # add_subdirectory() in order for CMake to run that install script after all # of the other subdirectories (which are TriBITS packages). As of CMake 3.14, # you can set the policy set_policy(CMP0082 NEW) which would have allowed us -# to put this in the base TRIBITS_PROJECT_IMPL() macro. But since TriBITS is +# to put this in the base tribits_project_impl() macro. But since TriBITS is # not allowed to require CMake 3.14 yet, we must use this workaround. To make # super sure that this install(SCRIPTS ...) script will get called last, the # policy CMP0082 is set to NEW in the TribitsCMakePolicies.cmake file. In diff --git a/cmake/tribits/core/installation/add_project_install_commands/CMakeLists.txt b/cmake/tribits/core/installation/add_project_install_commands/CMakeLists.txt index 77de47de021a..3977fb6c1d5d 100644 --- a/cmake/tribits/core/installation/add_project_install_commands/CMakeLists.txt +++ b/cmake/tribits/core/installation/add_project_install_commands/CMakeLists.txt @@ -1,31 +1,31 @@ -SET(tribits_install_src +set(tribits_install_src "${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}") -IF((${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES +if((${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES OR ${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) AND NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING ) - INCLUDE(TribitsWriteClientExportFiles) + include(TribitsWriteClientExportFiles) - TRIBITS_WRITE_PROJECT_CLIENT_EXPORT_FILES() + tribits_write_project_client_export_files() - IF (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) + if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) # TEMPORARY: Install a compatibility copy of ${PROJECT_NAME}Config.cmake # where was previously installed to warn and load the new file. - SET(COMPATIBILITY_CONFIG_INCLUDE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake) - CONFIGURE_FILE( + set(COMPATIBILITY_CONFIG_INCLUDE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake) + configure_file( "${tribits_install_src}/TribitsConfigInclude.cmake.in" ${COMPATIBILITY_CONFIG_INCLUDE} @ONLY ) - INSTALL( + install( FILES ${COMPATIBILITY_CONFIG_INCLUDE} DESTINATION "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}" ) - ENDIF() + endif() -ENDIF() +endif() # NOTE: This install logic is done in this subdir CMakeList.txt file so that # the install_package_by_package install target can invoke it for this subdir diff --git a/cmake/tribits/core/installation/cmake_pbp_install.cmake.in b/cmake/tribits/core/installation/cmake_pbp_install.cmake.in index a07dc67ada01..d8f4f6d01d4f 100644 --- a/cmake/tribits/core/installation/cmake_pbp_install.cmake.in +++ b/cmake/tribits/core/installation/cmake_pbp_install.cmake.in @@ -24,13 +24,13 @@ if (NOT global_install_rtn EQUAL 0) ) foreach (pkg_binary_dir ${TRIBITS_ENABLED_PACKAGES_BINARY_DIRS}) - message("\nRunning install comamnds for '${pkg_binary_dir}/':") + message("\nRunning install commands for '${pkg_binary_dir}/':") execute_process(COMMAND @CMAKE_COMMAND@ -P cmake_install.cmake WORKING_DIRECTORY ${pkg_binary_dir} RESULT_VARIABLE pkg_install_rtn) endforeach() - message("\nRunning install comamnds for 'add_project_install_commands/':") + message("\nRunning install commands for 'add_project_install_commands/':") execute_process(COMMAND @CMAKE_COMMAND@ -P cmake_install.cmake WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/add_project_install_commands" RESULT_VARIABLE project_install_rtn) diff --git a/cmake/tribits/core/installation/set_installed_group_and_permissions.cmake.in b/cmake/tribits/core/installation/set_installed_group_and_permissions.cmake.in index 68c5f74135cf..d446c883da9f 100644 --- a/cmake/tribits/core/installation/set_installed_group_and_permissions.cmake.in +++ b/cmake/tribits/core/installation/set_installed_group_and_permissions.cmake.in @@ -5,69 +5,69 @@ # # Base install dir and subdirs where last element in array gives CMAKE_INSTALL_PREFIX -SET(projectInstallBaseDir "@PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR@") -SET(projectSubdirPathsArray "@PROJECT_SUBDIR_PATHS_ARRAY@") +set(projectInstallBaseDir "@PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR@") +set(projectSubdirPathsArray "@PROJECT_SUBDIR_PATHS_ARRAY@") # Group and permissions -SET(PROJECT_MAKE_INSTALL_GROUP "@PROJECT_MAKE_INSTALL_GROUP@") -SET(PROJECT_MAKE_INSTALL_PERMS_CHANGE "@PROJECT_MAKE_INSTALL_PERMS_CHANGE@") +set(PROJECT_MAKE_INSTALL_GROUP "@PROJECT_MAKE_INSTALL_GROUP@") +set(PROJECT_MAKE_INSTALL_PERMS_CHANGE "@PROJECT_MAKE_INSTALL_PERMS_CHANGE@") # # Helper functions # -SET(CHMOD_CHGRP_IDX 0) +set(CHMOD_CHGRP_IDX 0) -FUNCTION(ECHO_AND_RUN_CMND) - STRING(REPLACE ";" " " CMND_STR "${ARGN}") - MESSAGE(STATUS "${CHMOD_CHGRP_IDX}: Running: ${CMND_STR}") - EXECUTE_PROCESS(COMMAND ${ARGN} RESULT_VARIABLE RTN_CODE) - IF (NOT RTN_CODE EQUAL 0) - MESSAGE(SEND_ERROR "ERROR: Above command failed!") - ENDIF() -ENDFUNCTION() +function(echo_and_run_cmnd) + string(REPLACE ";" " " CMND_STR "${ARGN}") + message(STATUS "${CHMOD_CHGRP_IDX}: Running: ${CMND_STR}") + execute_process(COMMAND ${ARGN} RESULT_VARIABLE RTN_CODE) + if (NOT RTN_CODE EQUAL 0) + message(SEND_ERROR "ERROR: Above command failed!") + endif() +endfunction() -FUNCTION(SET_DIR_OWNER_AND_PERMS dirPath recurseFlag) +function(set_dir_owner_and_perms dirPath recurseFlag) - IF (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") - SET(STAT_ARGS "-f%Su") # MacOSX stat - ELSE() - SET(STAT_ARGS "-c%U") # BinUtils stat - ENDIF() + if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(STAT_ARGS "-f%Su") # MacOSX stat + else() + set(STAT_ARGS "-c%U") # BinUtils stat + endif() # NOTE: Above, we can't have a space between the '-f' and '%Su' strings or # the '-c' and '%U' strings. If you do, then you get a single space at the # beginning of the returned owner name as ' ' instead of # ''. The automated tests on Linux and MacOSX don't pass if you # don't have it this way. - EXECUTE_PROCESS(COMMAND stat ${STAT_ARGS} "${dirPath}" + execute_process(COMMAND stat ${STAT_ARGS} "${dirPath}" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE dirOwner) - IF (NOT "${dirOwner}" STREQUAL "${CURRENT_USER_RUNNING_INSTALL}") + if (NOT "${dirOwner}" STREQUAL "${CURRENT_USER_RUNNING_INSTALL}") - MESSAGE(STATUS "${CHMOD_CHGRP_IDX}: NOTE: Not calling chgrp and chmod on ${dirPath} since owner '${dirOwner}' != current owner '${CURRENT_USER_RUNNING_INSTALL}'!") + message(STATUS "${CHMOD_CHGRP_IDX}: NOTE: Not calling chgrp and chmod on ${dirPath} since owner '${dirOwner}' != current owner '${CURRENT_USER_RUNNING_INSTALL}'!") - ELSE() + else() - IF (NOT "${PROJECT_MAKE_INSTALL_GROUP}" STREQUAL "") - ECHO_AND_RUN_CMND( + if (NOT "${PROJECT_MAKE_INSTALL_GROUP}" STREQUAL "") + echo_and_run_cmnd( chgrp ${recurseFlag} ${PROJECT_MAKE_INSTALL_GROUP} "${dirPath}") - ENDIF() + endif() - IF (NOT "${PROJECT_MAKE_INSTALL_PERMS_CHANGE}" STREQUAL "") - ECHO_AND_RUN_CMND( + if (NOT "${PROJECT_MAKE_INSTALL_PERMS_CHANGE}" STREQUAL "") + echo_and_run_cmnd( chmod ${recurseFlag} ${PROJECT_MAKE_INSTALL_PERMS_CHANGE} "${dirPath}") - ENDIF() + endif() - ENDIF() + endif() - MATH(EXPR CHMOD_CHGRP_IDX "${CHMOD_CHGRP_IDX}+1") - SET(CHMOD_CHGRP_IDX ${CHMOD_CHGRP_IDX} PARENT_SCOPE) + math(EXPR CHMOD_CHGRP_IDX "${CHMOD_CHGRP_IDX}+1") + set(CHMOD_CHGRP_IDX ${CHMOD_CHGRP_IDX} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # @@ -75,43 +75,43 @@ ENDFUNCTION() # -IF (EXISTS "${projectInstallBaseDir}") +if (EXISTS "${projectInstallBaseDir}") - EXECUTE_PROCESS(COMMAND whoami + execute_process(COMMAND whoami OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE CURRENT_USER_RUNNING_INSTALL) - LIST(LENGTH projectSubdirPathsArray numSubDirs) + list(LENGTH projectSubdirPathsArray numSubDirs) # Get projectSubdirPathsArrayLessOne and cmakeInstallPrefix - SET(projectSubdirPathsArrayLessOne "${projectSubdirPathsArray}") - IF (numSubDirs GREATER 0) - LIST(REMOVE_AT projectSubdirPathsArrayLessOne -1) - ENDIF() + set(projectSubdirPathsArrayLessOne "${projectSubdirPathsArray}") + if (numSubDirs GREATER 0) + list(REMOVE_AT projectSubdirPathsArrayLessOne -1) + endif() # Loop over base dirs and set group and permissions and set cmakeInstallPrefix - SET(dirPath "${projectInstallBaseDir}") - IF (numSubDirs EQUAL 0) + set(dirPath "${projectInstallBaseDir}") + if (numSubDirs EQUAL 0) # The base dir is cmakeInstallPrefix - SET(cmakeInstallPrefix "${dirPath}") - ELSE() + set(cmakeInstallPrefix "${dirPath}") + else() # Non-recursive set of the group and permissions - SET_DIR_OWNER_AND_PERMS("${dirPath}" "") - FOREACH(subDirEle ${projectSubdirPathsArrayLessOne}) - SET(dirPath "${dirPath}/${subDirEle}") - SET_DIR_OWNER_AND_PERMS("${dirPath}" "") - ENDFOREACH() + set_dir_owner_and_perms("${dirPath}" "") + foreach(subDirEle ${projectSubdirPathsArrayLessOne}) + set(dirPath "${dirPath}/${subDirEle}") + set_dir_owner_and_perms("${dirPath}" "") + endforeach() # Append last subdir which gives cmakeInstallPrefix - LIST(GET projectSubdirPathsArray -1 lastSubdir) - SET(cmakeInstallPrefix "${dirPath}/${lastSubdir}") - ENDIF() + list(GET projectSubdirPathsArray -1 lastSubdir) + set(cmakeInstallPrefix "${dirPath}/${lastSubdir}") + endif() # Recursive set of group and permsisions on cmakeInstallPrefix - SET_DIR_OWNER_AND_PERMS("${cmakeInstallPrefix}" "-R") + set_dir_owner_and_perms("${cmakeInstallPrefix}" "-R") -ELSE() +else() - MESSAGE(FATAL_ERROR + message(FATAL_ERROR "" "*** ERROR: The directory:" "***" @@ -122,7 +122,7 @@ ELSE() "" ) -ENDIF() +endif() # NOTE: Above, we had to change from using the var name 'CMAKE_INSTALL_PREFIX' # as the local variable name to 'cmakeinstallPrefix' because it turns out that diff --git a/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake b/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake index be7661a4dccd..dd035e8de8be 100644 --- a/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake @@ -38,15 +38,15 @@ # @HEADER -INCLUDE(TribitsAddAdvancedTestHelpers) -INCLUDE(TribitsConstants) +include(TribitsAddAdvancedTestHelpers) +include(TribitsConstants) -INCLUDE(AppendStringVar) -INCLUDE(PrintVar) +include(AppendStringVar) +include(PrintVar) # -# @FUNCTION: TRIBITS_ADD_ADVANCED_TEST() +# @FUNCTION: tribits_add_advanced_test() # # Function that creates an advanced test defined by stringing together one or # more executable and/or command invocations that is run as a ``cmake -P`` @@ -54,7 +54,7 @@ INCLUDE(PrintVar) # # Usage:: # -# TRIBITS_ADD_ADVANCED_TEST( +# tribits_add_advanced_test( # # TEST_0 (EXEC | CMND ) ... # [TEST_1 (EXEC | CMND ) ...] @@ -85,13 +85,13 @@ INCLUDE(PrintVar) # This function allows one to add a single CTest test that is actually a # sequence of one or more separate commands strung together in some way to # define the final pass/fail. One will want to use this function to add a test -# instead of `TRIBITS_ADD_TEST()`_ when one needs to run more than one +# instead of `tribits_add_test()`_ when one needs to run more than one # command, or one needs more sophisticated checking of the test result other # than just grepping STDOUT (e.g. by running separate post-processing programs # to examine output files). # # For more details on these arguments, see `TEST_ EXEC/CMND Test Blocks -# and Arguments (TRIBITS_ADD_ADVANCED_TEST())`_. +# and Arguments (tribits_add_advanced_test())`_. # # The most common type of an atomic test block ``TEST_`` runs a command # as either a package-built executable or just any command. An atomic test @@ -119,7 +119,7 @@ INCLUDE(PrintVar) # [WILL_FAIL] # # For more information on these arguments, see `TEST_ EXEC/CMND Test -# Blocks and Arguments (TRIBITS_ADD_ADVANCED_TEST())`_. +# Blocks and Arguments (tribits_add_advanced_test())`_. # # The other type of ``TEST_`` block supported is for copying files and # takes the form:: @@ -137,8 +137,8 @@ INCLUDE(PrintVar) # # * One can modify the input files and then just run the test with ``ctest`` # in an iterative manner (and not have to configure again when using -# ``CONFIGURE_FILE( ... COPYONLY)`` or build again when using -# ``TRIBITS_COPY_FILES_TO_BINARY_DIR()`` in order to copy files). +# ``configure_file( ... COPYONLY)`` or build again when using +# ``tribits_copy_files_to_binary_dir()`` in order to copy files). # # * When using ``OVERALL_WORKING_DIR TEST_NAME``, the test directory gets blow # away every time before it runs and therefore any old files are deleted @@ -148,56 +148,56 @@ INCLUDE(PrintVar) # # For more information on these arguments, see `TEST_ # COPY_FILES_TO_TEST_DIR Test Blocks and Arguments -# (TRIBITS_ADD_ADVANCED_TEST())`_. +# (tribits_add_advanced_test())`_. # # By default, each and every atomic ``TEST_`` block needs to pass (as -# defined in `Test case Pass/Fail (TRIBITS_ADD_ADVANCED_TEST())`_) in order +# defined in `Test case Pass/Fail (tribits_add_advanced_test())`_) in order # for the overall test to pass. # # Finally, the test is only added if tests are enabled for the SE package # (i.e. `${PACKAGE_NAME}_ENABLE_TESTS`_ ``= ON``) or the parent package (if # this is a subpackage) (i.e. ``${PARENT_PACKAGE_NAME}_ENABLE_TESTS=ON``) or # if other criteria are met (see some of the arguments in `Overall Arguments -# (TRIBITS_ADD_ADVANCED_TEST())`_ that can trigger a test to not be added). +# (tribits_add_advanced_test())`_ that can trigger a test to not be added). # (NOTE: A more efficient way to optionally enable tests is to put them in a # ``test/`` subdir and then include that subdir with -# `TRIBITS_ADD_TEST_DIRECTORIES()`_.) +# `tribits_add_test_directories()`_.) # # *Sections:* # -# * `Overall Arguments (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `TEST_ EXEC/CMND Test Blocks and Arguments (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `TEST_ COPY_FILES_TO_TEST_DIR Test Blocks and Arguments (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Test case Pass/Fail (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Overall Pass/Fail (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Argument Parsing and Ordering (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Implementation Details (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Setting Additional Test Properties (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Running multiple tests at the same time (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Disabling Tests Externally (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Debugging and Examining Test Generation (TRIBITS_ADD_ADVANCED_TEST())`_ -# * `Using TRIBITS_ADD_ADVANCED_TEST() in non-TriBITS CMake projects`_ +# * `Overall Arguments (tribits_add_advanced_test())`_ +# * `TEST_ EXEC/CMND Test Blocks and Arguments (tribits_add_advanced_test())`_ +# * `TEST_ COPY_FILES_TO_TEST_DIR Test Blocks and Arguments (tribits_add_advanced_test())`_ +# * `Test case Pass/Fail (tribits_add_advanced_test())`_ +# * `Overall Pass/Fail (tribits_add_advanced_test())`_ +# * `Argument Parsing and Ordering (tribits_add_advanced_test())`_ +# * `Implementation Details (tribits_add_advanced_test())`_ +# * `Setting Additional Test Properties (tribits_add_advanced_test())`_ +# * `Running multiple tests at the same time (tribits_add_advanced_test())`_ +# * `Disabling Tests Externally (tribits_add_advanced_test())`_ +# * `Debugging and Examining Test Generation (tribits_add_advanced_test())`_ +# * `Using tribits_add_advanced_test() in non-TriBITS CMake projects`_ # -# .. _Overall Arguments (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Overall Arguments (tribits_add_advanced_test()): # -# **Overall Arguments (TRIBITS_ADD_ADVANCED_TEST())** +# **Overall Arguments (tribits_add_advanced_test())** # # Below, some of the overall arguments are described. The rest of the overall # arguments that control overall pass/fail are described in `Overall Pass/Fail -# (TRIBITS_ADD_ADVANCED_TEST())`_. (NOTE: All of these arguments must be +# (tribits_add_advanced_test())`_. (NOTE: All of these arguments must be # listed outside of the ``TEST_`` blocks, see `Argument Parsing and -# Ordering (TRIBITS_ADD_ADVANCED_TEST())`_). +# Ordering (tribits_add_advanced_test())`_). # # ```` # # The base name of the test (which will have ``${PACKAGE_NAME}_`` # prepended to the name, see below) that will be used to name # the output CMake script file as well as the CTest test name passed into -# ``ADD_TEST()``. This must be the first argument to this function. The +# ``add_test()``. This must be the first argument to this function. The # name is allowed to contain '/' chars but these will be replaced with # '__' in the overall working directory name and the ctest -P script # (`Debugging and Examining Test Generation -# (TRIBITS_ADD_ADVANCED_TEST())`_). +# (tribits_add_advanced_test())`_). # # ``OVERALL_WORKING_DIRECTORY `` # @@ -229,13 +229,13 @@ INCLUDE(PrintVar) # ``RUN_SERIAL`` # # If specified, then no other tests will be allowed to run while this test -# is running. See the ``RUN_SERIAL`` argument in the fucntion -# `TRIBITS_ADD_TEST()`_ for more details. +# is running. See the ``RUN_SERIAL`` argument in the function +# `tribits_add_test()`_ for more details. # # ``COMM [serial] [mpi]`` # # If specified, selects if the test will be added in serial and/or MPI -# mode. See the ``COMM`` argument in the function `TRIBITS_ADD_TEST()`_ +# mode. See the ``COMM`` argument in the function `tribits_add_test()`_ # for more details. # # ``OVERALL_NUM_MPI_PROCS `` @@ -248,7 +248,7 @@ INCLUDE(PrintVar) # ignored. For MPI builds with all ``TEST_ CMND`` blocks, # ```` is used to set the property ``PROCESSORS``. (see # `Running multiple tests at the same time -# (TRIBITS_ADD_ADVANCED_TEST())`_). **WARNING!** If just running a serial +# (tribits_add_advanced_test())`_). **WARNING!** If just running a serial # script or other command, then the property ``PROCESSORS`` will still get # set to ``${OVERALL_NUM_MPI_PROCS}`` so in order to avoid CTest # unnecessarily reserving ``${OVERALL_NUM_MPI_PROCS}`` processes for a @@ -262,38 +262,38 @@ INCLUDE(PrintVar) # ``CATEGORIES ...`` # # Gives the `Test Test Categories`_ for which this test will be added. -# See `TRIBITS_ADD_TEST()`_ for more details. +# See `tribits_add_test()`_ for more details. # # ``HOST ...`` # # The list of hosts for which to enable the test (see -# `TRIBITS_ADD_TEST()`_). +# `tribits_add_test()`_). # # ``XHOST ...`` # # The list of hosts for which **not** to enable the test (see -# `TRIBITS_ADD_TEST()`_). +# `tribits_add_test()`_). # # ``HOSTTYPE ...`` # # The list of host types for which to enable the test (see -# `TRIBITS_ADD_TEST()`_). +# `tribits_add_test()`_). # # ``XHOSTTYPE ...`` # # The list of host types for which **not** to enable the test (see -# `TRIBITS_ADD_TEST()`_). +# `tribits_add_test()`_). # # ``EXCLUDE_IF_NOT_TRUE ...`` # # If specified, gives the names of CMake variables that must evaluate to -# true, or the test will not be added (see `TRIBITS_ADD_TEST()`_). +# true, or the test will not be added (see `tribits_add_test()`_). # # ``DISABLED `` # # If ```` is non-empty and does not evaluate to FALSE # by CMake, then the test will be added by ctest but the ``DISABLED`` test -# property will be set (see `TRIBITS_ADD_TEST()`_). +# property will be set (see `tribits_add_test()`_). # # ``ENVIRONMENT = = ..``. # @@ -305,21 +305,21 @@ INCLUDE(PrintVar) # # If passed in, gives maximum number of seconds the test will be allowed # to run before being timed-out and killed (see `Setting timeouts for -# tests (TRIBITS_ADD_TEST())`_). This is for the full CTest test, not +# tests (tribits_add_test())`_). This is for the full CTest test, not # individual ``TEST_`` commands! # # ``ADDED_TEST_NAME_OUT `` # # If specified, then on output the variable ```` will be set -# with the name of the test passed to ``ADD_TEST()``. Having this name +# with the name of the test passed to ``add_test()``. Having this name # allows the calling ``CMakeLists.txt`` file access and set additional # test properties (see `Setting additional test properties -# (TRIBITS_ADD_ADVANCED_TEST())`_). +# (tribits_add_advanced_test())`_). # -# .. _TEST_ EXEC/CMND Test Blocks and Arguments (TRIBITS_ADD_ADVANCED_TEST()): +# .. _TEST_ EXEC/CMND Test Blocks and Arguments (tribits_add_advanced_test()): # # -# **TEST_ EXEC/CMND Test Blocks and Arguments (TRIBITS_ADD_ADVANCED_TEST())** +# **TEST_ EXEC/CMND Test Blocks and Arguments (tribits_add_advanced_test())** # # Each test general command block ``TEST_`` runs either a package-built # test executable or some general command executable and is defined as either @@ -332,8 +332,8 @@ INCLUDE(PrintVar) # If ``EXEC`` is specified, then ```` gives the root name of # an executable target that will be run as the command. The full # executable name and path is determined in exactly the same way it is in -# the `TRIBITS_ADD_TEST()`_ function (see `Determining the Executable or -# Command to Run (TRIBITS_ADD_TEST())`_). If this is an MPI build, then +# the `tribits_add_test()`_ function (see `Determining the Executable or +# Command to Run (tribits_add_test())`_). If this is an MPI build, then # the executable will be run with MPI using ``NUM_MPI_PROCS `` # (or ``OVERALL_NUM_MPI_PROCS `` if ``NUM_MPI_PROCS`` is # not set for this test case). If the maximum number of MPI processes @@ -375,7 +375,7 @@ INCLUDE(PrintVar) # ``DIRECTORY `` # # If specified, then the executable is assumed to be in the directory -# given by relative ````. See `TRIBITS_ADD_TEST()`_. +# given by relative ````. See `tribits_add_test()`_. # # ``MESSAGE ""`` # @@ -435,7 +435,7 @@ INCLUDE(PrintVar) # ````. By default, the contents of this file will **also** # be printed to STDOUT unless ``NO_ECHO_OUT`` is passed as well. # -# NOTE: Contrary to CMake documentation for EXECUTE_PROCESS(), STDOUT and +# NOTE: Contrary to CMake documentation for execute_process(), STDOUT and # STDERR may not get output in the correct order interleaved correctly, # even in serial without MPI. Therefore, you can't write any tests that # depend on the order of STDOUT and STDERR output in relation to each @@ -454,7 +454,7 @@ INCLUDE(PrintVar) # By default, an individual test case ``TEST_`` is assumed to pass if the # executable or commands returns a non-zero value to the shell. However, a # test case can also be defined to pass or fail based on the arguments/options -# (see `Test case Pass/Fail (TRIBITS_ADD_ADVANCED_TEST())`_): +# (see `Test case Pass/Fail (tribits_add_advanced_test())`_): # # ``PASS_ANY`` # @@ -467,7 +467,7 @@ INCLUDE(PrintVar) # # If specified, the test command will be assumed to pass if it matches the # given regular expression. Otherwise, it is assumed to fail. TIPS: -# Replace ';' with '[;]' or CMake will interpret this as an array elemnt +# Replace ';' with '[;]' or CMake will interpret this as an array element # boundary. To match '.', use '[.]'. # # ``PASS_REGULAR_EXPRESSION_ALL "" "" ... ""`` @@ -476,7 +476,7 @@ INCLUDE(PrintVar) # matches all of the provided regular expressions. Note that this is not # a capability of raw ctest and represents an extension provided by # TriBITS. NOTE: It is critical that you replace ';' with '[;]' or CMake -# will interpret this as an array elemnt boundary. +# will interpret this as an array element boundary. # # ``STANDARD_PASS_OUTPUT`` # @@ -523,7 +523,7 @@ INCLUDE(PrintVar) # # All of the arguments for a test block ``TEST_`` must appear directly # below their ``TEST_`` argument and before the next test block (see -# `Argument Parsing and Ordering (TRIBITS_ADD_ADVANCED_TEST())`_). +# `Argument Parsing and Ordering (tribits_add_advanced_test())`_). # # **NOTE:** The current implementation limits the number of ``TEST_`` # blocks to just 20 (i.e. for ``=0...19``). If more test blocks are @@ -534,11 +534,11 @@ INCLUDE(PrintVar) # # where `` > 20``. This can be set in any scope in any # ``CMakeLists.txt`` file or inside of a function and it will impact all of -# the future calls to ``TRIBITS_ADD_ADVANCED_TEST()`` in that scope. +# the future calls to ``tribits_add_advanced_test()`` in that scope. # -# .. _TEST_ COPY_FILES_TO_TEST_DIR Test Blocks and Arguments (TRIBITS_ADD_ADVANCED_TEST()): +# .. _TEST_ COPY_FILES_TO_TEST_DIR Test Blocks and Arguments (tribits_add_advanced_test()): # -# **TEST_ COPY_FILES_TO_TEST_DIR Test Blocks and Arguments (TRIBITS_ADD_ADVANCED_TEST())** +# **TEST_ COPY_FILES_TO_TEST_DIR Test Blocks and Arguments (tribits_add_advanced_test())** # # The arguments for the ``TEST_`` ``COPY_FILES_TO_TEST_DIR`` block are: # @@ -568,9 +568,9 @@ INCLUDE(PrintVar) # without modification. If ```` does not exist, then it will be # created (including several directory levels deep if needed). # -# .. _Test case Pass/Fail (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Test case Pass/Fail (tribits_add_advanced_test()): # -# **Test case Pass/Fail (TRIBITS_ADD_ADVANCED_TEST())** +# **Test case Pass/Fail (tribits_add_advanced_test())** # # The logic for how pass/fail for a ``TEST_`` ``EXEC`` or ``CMND`` case # is applied is given by:: @@ -613,9 +613,9 @@ INCLUDE(PrintVar) # Endif # Endif # -# .. _Overall Pass/Fail (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Overall Pass/Fail (tribits_add_advanced_test()): # -# **Overall Pass/Fail (TRIBITS_ADD_ADVANCED_TEST())** +# **Overall Pass/Fail (tribits_add_advanced_test())** # # By default, the overall test will be assumed to pass if it prints:: # @@ -633,19 +633,19 @@ INCLUDE(PrintVar) # If specified, the test will be assumed to fail if the output matches # ````. Otherwise, it will be assumed to fail. # -# .. _Argument Parsing and Ordering (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Argument Parsing and Ordering (tribits_add_advanced_test()): # -# **Argument Parsing and Ordering (TRIBITS_ADD_ADVANCED_TEST())** +# **Argument Parsing and Ordering (tribits_add_advanced_test())** # # The basic tool used for parsing the arguments to this function is the macro -# ``CMAKE_PARSE_ARGUMENTS()`` which has a certain set of behaviors. The -# parsing using ``CMAKE_PARSE_ARGUMENTS()`` is actually done in two phases. +# ``cmake_parse_arguments()`` which has a certain set of behaviors. The +# parsing using ``cmake_parse_arguments()`` is actually done in two phases. # There is a top-level parsing of the "overall" arguments listed in `Overall -# Arguments (TRIBITS_ADD_ADVANCED_TEST())`_ that also pulls out the test +# Arguments (tribits_add_advanced_test())`_ that also pulls out the test # blocks. Then there is a second level of parsing using -# ``CMAKE_PARSE_ARGUMENTS()`` for each of the ``TEST_`` blocks. Because +# ``cmake_parse_arguments()`` for each of the ``TEST_`` blocks. Because # of this usage, there are a few restrictions that one needs to be aware of -# when using ``TRIBITS_ADD_ADVANCED_TEST()``. This short sections tries to +# when using ``tribits_add_advanced_test()``. This short sections tries to # explain the behaviors and what is allowed and what is not allowed. # # For the most part, the "overall" arguments and the arguments inside of any @@ -675,41 +675,41 @@ INCLUDE(PrintVar) # # .. ToDo: Add some examples of bad argument ordering and what will happen. # -# .. _Implementation Details (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Implementation Details (tribits_add_advanced_test()): # -# **Implementation Details (TRIBITS_ADD_ADVANCED_TEST())** +# **Implementation Details (tribits_add_advanced_test())** # # Since raw CTest does not support the features provided by this function, the # way an advanced test is implemented is that a ``cmake -P`` script with the # name ``.cmake`` (with any '/' replaced with '__') gets created in # the current binary directory that then gets added to CTest using:: # -# ADD_TEST( cmake [other options] -P .cmake) +# add_test( cmake [other options] -P .cmake) # # This ``cmake -P`` script then runs the various test cases and checks the # pass/fail for each case to determine overall pass/fail and implement other # functionality described above. # -# .. _Setting Additional Test Properties (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Setting Additional Test Properties (tribits_add_advanced_test()): # -# **Setting Additional Test Properties (TRIBITS_ADD_ADVANCED_TEST())** +# **Setting Additional Test Properties (tribits_add_advanced_test())** # -# After this function returns, if the test gets added using ``ADD_TEST()``, +# After this function returns, if the test gets added using ``add_test()``, # then additional properties can be set and changed using -# ``SET_TESTS_PROPERTIES( ...)``, where ```` is returned +# ``set_tests_properties( ...)``, where ```` is returned # using the ``ADDED_TEST_NAME_OUT `` argument. Therefore, any tests # properties that are not directly supported by this function and passed # through the argument list to this wrapper function can be set in the outer -# ``CMakeLists.txt`` file after the call to ``TRIBITS_ADD_ADVANCED_TEST()``. +# ``CMakeLists.txt`` file after the call to ``tribits_add_advanced_test()``. # For example:: # -# TRIBITS_ADD_ADVANCED_TEST_TEST( someTest ... +# tribits_add_advanced_test_test( someTest ... # ADDED_TEST_NAME_OUT someTest_TEST_NAME ) # -# IF (someTest_TEST_NAME) -# SET_TESTS_PROPERTIES( ${someTest_TEST_NAME} +# if (someTest_TEST_NAME) +# set_tests_properties( ${someTest_TEST_NAME} # PROPERTIES ATTACHED_FILES someTest.log ) -# ENDIF() +# endif() # # where the test writes a log file ``someTest.log`` that we want to submit to # CDash also. @@ -719,58 +719,58 @@ INCLUDE(PrintVar) # ``COMM``, ``XHOST``, etc.). # # The following built-in CTest test properties are set through `Overall -# Arguments (TRIBITS_ADD_ADVANCED_TEST())`_ or are otherwise automatically set +# Arguments (tribits_add_advanced_test())`_ or are otherwise automatically set # by this function and should **NOT** be overridden by direct calls to -# ``SET_TESTS_PROPERTIES()``: ``ENVIRONMENT``, ``FAIL_REGULAR_EXPRESSION``, +# ``set_tests_properties()``: ``ENVIRONMENT``, ``FAIL_REGULAR_EXPRESSION``, # ``LABELS``, ``PASS_REGULAR_EXPRESSION``, ``RUN_SERIAL``, ``TIMEOUT``, # ``WILL_FAIL``, and ``WORKING_DIRECTORY``. # # However, generally, other built-in CTest test properties can be set after # the test is added like show above. Examples of test properties that can be -# set using direct calls to ``SET_TESTS_PROPERTIES()`` include +# set using direct calls to ``set_tests_properties()`` include # ``ATTACHED_FILES``, ``ATTACHED_FILES_ON_FAIL``, ``COST``, ``DEPENDS``, # ``MEASUREMENT``, and ``RESOURCE_LOCK``. # # For example, one can set a dependency between two tests using:: # -# TRIBITS_ADD_ADVANCED_TEST_TEST( test_a [...] +# tribits_add_advanced_test_test( test_a [...] # ADDED_TEST_NAME_OUT test_a_TEST_NAME ) # -# TRIBITS_ADD_ADVANCED_TEST_TEST( test_b [...] +# tribits_add_advanced_test_test( test_b [...] # ADDED_TEST_NAME_OUT test_z_TEST_NAME ) # -# IF (test_a_TEST_NAME AND test_b_TEST_NAME) -# SET_TESTS_PROPERTIES(${test_b_TEST_NAME} +# if (test_a_TEST_NAME AND test_b_TEST_NAME) +# set_tests_properties(${test_b_TEST_NAME} # PROPERTIES DEPENDS ${test_a_TEST_NAME}) -# ENDIF() +# endif() # # This ensures that test ``test_b`` will always be run after ``test_a`` if # both tests are run by CTest. # -# .. _Running multiple tests at the same time (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Running multiple tests at the same time (tribits_add_advanced_test()): # -# **Running multiple tests at the same time (TRIBITS_ADD_ADVANCED_TEST())** +# **Running multiple tests at the same time (tribits_add_advanced_test())** # -# Just as with `TRIBITS_ADD_TEST()`_, setting ``NUM_MPI_PROCS `` or +# Just as with `tribits_add_test()`_, setting ``NUM_MPI_PROCS `` or # ``OVERALL_NUM_MPI_PROCS `` or ``NUM_TOTAL_CORES_USED # `` or ``OVERALL_NUM_TOTAL_CORES_USED # `` will set the ``PROCESSORS`` CTest property to # allow CTest to schedule and run multiple tests at the same time when ``'ctest # -j'`` is used (see `Running multiple tests at the same time -# (TRIBITS_ADD_TEST())`_). +# (tribits_add_test())`_). # -# .. _Disabling Tests Externally (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Disabling Tests Externally (tribits_add_advanced_test()): # -# **Disabling Tests Externally (TRIBITS_ADD_ADVANCED_TEST())** +# **Disabling Tests Externally (tribits_add_advanced_test())** # # The test can be disabled externally by setting the CMake cache variable # ``_DISABLE=TRUE``. This allows tests to be disabled on a # case-by-case basis. The name ```` must be the *exact* name # that shows up in ``ctest -N`` when running the test. # -# .. _Debugging and Examining Test Generation (TRIBITS_ADD_ADVANCED_TEST()): +# .. _Debugging and Examining Test Generation (tribits_add_advanced_test()): # -# **Debugging and Examining Test Generation (TRIBITS_ADD_ADVANCED_TEST())** +# **Debugging and Examining Test Generation (tribits_add_advanced_test())** # # In order to see what tests get added and if not then why, configure with # ``${PROJECT_NAME}_TRACE_ADD_TEST=ON``. That will print one line per test @@ -781,60 +781,60 @@ INCLUDE(PrintVar) # # Likely the best way to debug test generation using this function is to # examine the generated file ``.cmake`` in the current binary -# directory (see `Implementation Details (TRIBITS_ADD_ADVANCED_TEST())`_) and +# directory (see `Implementation Details (tribits_add_advanced_test())`_) and # the generated ``CTestTestfile.cmake`` file that should list this test case. # -# .. _Using TRIBITS_ADD_ADVANCED_TEST() in non-TriBITS CMake projects: +# .. _Using tribits_add_advanced_test() in non-TriBITS CMake projects: # -# **Using TRIBITS_ADD_ADVANCED_TEST() in non-TriBITS CMake projects** +# **Using tribits_add_advanced_test() in non-TriBITS CMake projects** # -# The function ``TRIBITS_ADD_ADVANCED_TEST()`` can be used to add tests in +# The function ``tribits_add_advanced_test()`` can be used to add tests in # non-TriBITS projects. To do so, one just needs to set the variables # ``PROJECT_NAME``, ``PACKAGE_NAME`` (which could be the same as # ``PROJECT_NAME``), ``${PACKAGE_NAME}_ENABLE_TESTS=TRUE``, and # ``${PROJECT_NAME}_TRIBITS_DIR`` (pointing to the TriBITS location). For example, # a valid project can be a simple as:: # -# CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) -# SET(PROJECT_NAME TAATDriver) -# PROJECT(${PROJECT_NAME} NONE) -# SET(${PROJECT_NAME}_TRACE_ADD_TEST TRUE) -# SET(${PROJECT_NAME}_TRIBITS_DIR "" CACHE FILEPATH +# cmake_minimum_required(VERSION 3.17.0) +# set(PROJECT_NAME TAATDriver) +# project(${PROJECT_NAME} NONE) +# set(${PROJECT_NAME}_TRACE_ADD_TEST TRUE) +# set(${PROJECT_NAME}_TRIBITS_DIR "" CACHE FILEPATH # "Location of TriBITS to use." ) -# SET(PACKAGE_NAME ${PROJECT_NAME}) -# SET(${PACKAGE_NAME}_ENABLE_TESTS TRUE) -# SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} +# set(PACKAGE_NAME ${PROJECT_NAME}) +# set(${PACKAGE_NAME}_ENABLE_TESTS TRUE) +# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} # ${TRIBITS_DIR}/core/utils # ${TRIBITS_DIR}/core/package_arch ) -# INCLUDE(TribitsAddAdvancedTest) -# INCLUDE(CTest) -# ENABLE_TESTING() +# include(TribitsAddAdvancedTest) +# include(CTest) +# enable_testing() # -# TRIBITS_ADD_ADVANCED_TEST( +# tribits_add_advanced_test( # TAAT_COPY_FILES_TO_TEST_DIR_bad_file_name # OVERALL_WORKING_DIRECTORY TEST_NAME # TEST_0 CMND echo ARGS "Hello World!" # PASS_REGULAR_EXPRESIOIN "Hello World" # ) # -FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) +function(tribits_add_advanced_test TEST_NAME_IN) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nPACKAGE_ADD_ADVANCED_TEST: ${TEST_NAME_IN}\n") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nPACKAGE_ADD_ADVANCED_TEST: ${TEST_NAME_IN}\n") + endif() - GLOBAL_SET(TRIBITS_SET_TEST_PROPERTIES_INPUT) - GLOBAL_SET(MESSAGE_WRAPPER_INPUT) + global_set(TRIBITS_SET_TEST_PROPERTIES_INPUT) + global_set(MESSAGE_WRAPPER_INPUT) # Set the full TEST_NAME - IF (PACKAGE_NAME) - SET(TEST_NAME ${PACKAGE_NAME}_${TEST_NAME_IN}) - ELSE() - SET(TEST_NAME ${TEST_NAME_IN}) - ENDIF() + if (PACKAGE_NAME) + set(TEST_NAME ${PACKAGE_NAME}_${TEST_NAME_IN}) + else() + set(TEST_NAME ${TEST_NAME_IN}) + endif() # Avoid quoted strings lookup variables - CMAKE_POLICY(SET CMP0054 NEW) + cmake_policy(SET CMP0054 NEW) # NOTE: For some reason, setting this policy at the top level with TriBITS # in TribitsCMakePolices.cmake does not affect this function. Therefore, I # have to set it again here. @@ -845,16 +845,16 @@ FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) # # Set maximum number of TEST_ blocks - TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX_COMPUTE() - SET(MAX_NUM_TEST_CMND_IDX ${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX}) + tribits_add_advanced_test_max_num_test_cmnd_idx_compute() + set(MAX_NUM_TEST_CMND_IDX ${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX}) - SET(TEST_IDX_LIST "") - FOREACH( TEST_CMND_IDX RANGE ${MAX_NUM_TEST_CMND_IDX}) - LIST( APPEND TEST_IDX_LIST TEST_${TEST_CMND_IDX} ) - ENDFOREACH() - #PRINT_VAR(TEST_IDX_LIST) + set(TEST_IDX_LIST "") + foreach( TEST_CMND_IDX RANGE ${MAX_NUM_TEST_CMND_IDX}) + list( APPEND TEST_IDX_LIST TEST_${TEST_CMND_IDX} ) + endforeach() + #print_var(TEST_IDX_LIST) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -866,65 +866,65 @@ FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) ${ARGN} ) - TRIBITS_ADD_ADVANCED_TEST_CHECK_EXCEED_MAX_NUM_TEST_BLOCKS() + tribits_add_advanced_test_check_exceed_max_num_test_blocks() - IF(PARSE_ADDED_TEST_NAME_OUT) - SET(${PARSE_ADDED_TEST_NAME_OUT} "" PARENT_SCOPE ) - ENDIF() + if(PARSE_ADDED_TEST_NAME_OUT) + set(${PARSE_ADDED_TEST_NAME_OUT} "" PARENT_SCOPE ) + endif() # Set the name of the cmake -P script. - STRING(REPLACE "/" "__" NORMALIZED_TEST_NAME "${TEST_NAME}") - SET(TEST_SCRIPT_FILE_NAME "${NORMALIZED_TEST_NAME}.cmake") + string(REPLACE "/" "__" NORMALIZED_TEST_NAME "${TEST_NAME}") + set(TEST_SCRIPT_FILE_NAME "${NORMALIZED_TEST_NAME}.cmake") # Set the relative overall working directory and abs working directory - IF (PARSE_OVERALL_WORKING_DIRECTORY) - IF ("${PARSE_OVERALL_WORKING_DIRECTORY}" STREQUAL "TEST_NAME") - SET(PARSE_OVERALL_WORKING_DIRECTORY ${NORMALIZED_TEST_NAME}) - ENDIF() + if (PARSE_OVERALL_WORKING_DIRECTORY) + if ("${PARSE_OVERALL_WORKING_DIRECTORY}" STREQUAL "TEST_NAME") + set(PARSE_OVERALL_WORKING_DIRECTORY ${NORMALIZED_TEST_NAME}) + endif() # Test will run in created working subdir - SET(ABS_OVERALL_WORKING_DIRECTORY + set(ABS_OVERALL_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PARSE_OVERALL_WORKING_DIRECTORY}) - ELSE() + else() # Test runs in current binary directory (not a good idea!) - SET(ABS_OVERALL_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - ENDIF() + set(ABS_OVERALL_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() # # B) Add or don't add tests based on a number of criteria # - SET(ADD_THE_TEST FALSE) - TRIBITS_ADD_TEST_PROCESS_ENABLE_TESTS(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() - - TRIBITS_ADD_TEST_PROCESS_SKIP_CTEST_ADD_TEST(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() - - SET(ADD_THE_TEST FALSE) - TRIBITS_ADD_TEST_PROCESS_CATEGORIES(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() - - SET(ADD_THE_TEST FALSE) - TRIBITS_ADD_TEST_PROCESS_HOST_HOSTTYPE(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() - - TRIBITS_ADD_TEST_QUERY_DISABLE(DISABLE_THIS_TEST ${TEST_NAME}) - IF (DISABLE_THIS_TEST) - RETURN() - ENDIF() - - TRIBITS_SET_RUN_SERIAL(${TEST_NAME} "${PARSE_RUN_SERIAL}" + set(ADD_THE_TEST FALSE) + tribits_add_test_process_enable_tests(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() + + tribits_add_test_process_skip_ctest_add_test(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() + + set(ADD_THE_TEST FALSE) + tribits_add_test_process_categories(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() + + set(ADD_THE_TEST FALSE) + tribits_add_test_process_host_hosttype(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() + + tribits_add_test_query_disable(DISABLE_THIS_TEST ${TEST_NAME}) + if (DISABLE_THIS_TEST) + return() + endif() + + tribits_set_run_serial(${TEST_NAME} "${PARSE_RUN_SERIAL}" SET_RUN_SERIAL) - TRIBITS_SET_DISABLED_AND_MSG(${TEST_NAME} "${PARSE_DISABLED}" + tribits_set_disabled_and_msg(${TEST_NAME} "${PARSE_DISABLED}" SET_DISABLED_AND_MSG) # Adds the test but sets DISABLED test prop! # @@ -932,20 +932,20 @@ FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) # and TPL_ENABLE_MPI # - TRIBITS_PROCESS_COMM_ARGS(ADD_SERIAL_TEST ADD_MPI_TEST ${PARSE_COMM}) - IF (NOT ADD_SERIAL_TEST AND NOT ADD_MPI_TEST) - RETURN() - ENDIF() + tribits_process_comm_args(ADD_SERIAL_TEST ADD_MPI_TEST ${PARSE_COMM}) + if (NOT ADD_SERIAL_TEST AND NOT ADD_MPI_TEST) + return() + endif() # # D) Build the test script # - SET(ADD_THE_TEST TRUE) + set(ADD_THE_TEST TRUE) - SET(TEST_SCRIPT_STR "") + set(TEST_SCRIPT_STR "") - APPEND_STRING_VAR( TEST_SCRIPT_STR + append_string_var( TEST_SCRIPT_STR "\n" "#\n" "# This is a CMake script and must be run as \"cmake -P \"\n" @@ -959,66 +959,66 @@ FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) "# Variables\n" "#\n" "\n" - "SET( TEST_NAME ${TEST_NAME} )\n" + "set( TEST_NAME ${TEST_NAME} )\n" ) # Loop through each test case - SET(NUM_CMNDS 0) - SET(TEST_EXE_LIST "") + set(NUM_CMNDS 0) + set(TEST_EXE_LIST "") - IF (PARSE_OVERALL_NUM_MPI_PROCS AND PARSE_OVERALL_NUM_TOTAL_CORES_USED) - IF (PARSE_OVERALL_NUM_MPI_PROCS GREATER PARSE_OVERALL_NUM_TOTAL_CORES_USED) - MESSAGE_WRAPPER(FATAL_ERROR + if (PARSE_OVERALL_NUM_MPI_PROCS AND PARSE_OVERALL_NUM_TOTAL_CORES_USED) + if (PARSE_OVERALL_NUM_MPI_PROCS GREATER PARSE_OVERALL_NUM_TOTAL_CORES_USED) + message_wrapper(FATAL_ERROR "ERROR: ${TEST_NAME}: OVERALL_NUM_MPI_PROCS='${PARSE_OVERALL_NUM_MPI_PROCS}' > OVERALL_NUM_TOTAL_CORES_USED='${PARSE_OVERALL_NUM_TOTAL_CORES_USED}' not allowed!") - RETURN() - ENDIF() - ENDIF() + return() + endif() + endif() # ToDo: Assert that OVERALL_NUM_TOTAL_CORES_USED >= OVERALL_NUM_MPI_PROCS - IF (PARSE_OVERALL_NUM_MPI_PROCS) - SET(MAX_NUM_MPI_PROCS_USED ${PARSE_OVERALL_NUM_MPI_PROCS}) - SET(MAX_NUM_PROCESSORS_USED ${PARSE_OVERALL_NUM_MPI_PROCS}) - ELSE() - SET(MAX_NUM_MPI_PROCS_USED ${PARSE_OVERALL_NUM_MPI_PROCS}) - SET(MAX_NUM_PROCESSORS_USED 1) - ENDIF() + if (PARSE_OVERALL_NUM_MPI_PROCS) + set(MAX_NUM_MPI_PROCS_USED ${PARSE_OVERALL_NUM_MPI_PROCS}) + set(MAX_NUM_PROCESSORS_USED ${PARSE_OVERALL_NUM_MPI_PROCS}) + else() + set(MAX_NUM_MPI_PROCS_USED ${PARSE_OVERALL_NUM_MPI_PROCS}) + set(MAX_NUM_PROCESSORS_USED 1) + endif() - SET(HAS_AT_LEAST_ONE_EXEC FALSE) + set(HAS_AT_LEAST_ONE_EXEC FALSE) - FOREACH( TEST_CMND_IDX RANGE ${MAX_NUM_TEST_CMND_IDX} ) + foreach( TEST_CMND_IDX RANGE ${MAX_NUM_TEST_CMND_IDX} ) - IF (NOT PARSE_TEST_${TEST_CMND_IDX} ) - BREAK() - ENDIF() + if (NOT PARSE_TEST_${TEST_CMND_IDX} ) + break() + endif() - IF (NOT ADD_THE_TEST) - BREAK() - ENDIF() + if (NOT ADD_THE_TEST) + break() + endif() - MATH( EXPR NUM_CMNDS ${NUM_CMNDS}+1 ) + math( EXPR NUM_CMNDS ${NUM_CMNDS}+1 ) # Parse the test command case - #PRINT_VAR(PARSE_TEST_${TEST_CMND_IDX}) + #print_var(PARSE_TEST_${TEST_CMND_IDX}) # Search to see if we are copying files or not for this TEST_ block ... - SET(PARSE_COPY_FILES_TO_TEST_DIR) - SET(COPY_FILES_TO_TEST_DIR_IDX FALSE) - FOREACH(PARSE_TEST_IDX_ARGS ${PARSE_TEST_${TEST_CMND_IDX}}) - IF (PARSE_TEST_IDX_ARGS STREQUAL "COPY_FILES_TO_TEST_DIR") - SET(COPY_FILES_TO_TEST_DIR_IDX TRUE) - ENDIF() - ENDFOREACH() + set(PARSE_COPY_FILES_TO_TEST_DIR) + set(COPY_FILES_TO_TEST_DIR_IDX FALSE) + foreach(PARSE_TEST_IDX_ARGS ${PARSE_TEST_${TEST_CMND_IDX}}) + if (PARSE_TEST_IDX_ARGS STREQUAL "COPY_FILES_TO_TEST_DIR") + set(COPY_FILES_TO_TEST_DIR_IDX TRUE) + endif() + endforeach() - IF (COPY_FILES_TO_TEST_DIR_IDX) + if (COPY_FILES_TO_TEST_DIR_IDX) # Do a special parse just for TEST_ blocks of type # COPY_FILES_TO_TEST_DIR - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -1030,19 +1030,19 @@ FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) # Arguments to parse ${PARSE_TEST_${TEST_CMND_IDX}} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() - TRIBITS_ASSERT_PARSE_ARG_ONE_OR_MORE_VALUES(PARSE COPY_FILES_TO_TEST_DIR) - TRIBITS_ASSERT_PARSE_ARG_ZERO_OR_ONE_VALUE(PARSE SOURCE_DIR) - TRIBITS_ASSERT_PARSE_ARG_ZERO_OR_ONE_VALUE(PARSE DEST_DIR) + tribits_check_for_unparsed_arguments() + tribits_assert_parse_arg_one_or_more_values(PARSE COPY_FILES_TO_TEST_DIR) + tribits_assert_parse_arg_zero_or_one_value(PARSE SOURCE_DIR) + tribits_assert_parse_arg_zero_or_one_value(PARSE DEST_DIR) - SET(PARSE_EXEC) - SET(PARSE_CMND) + set(PARSE_EXEC) + set(PARSE_CMND) - ELSE() + else() # Parse TEST_ block args for types EXEC and CMND - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -1054,322 +1054,322 @@ FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) ${PARSE_TEST_${TEST_CMND_IDX}} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - ENDIF() + endif() # # Set up the command that will be written into the cmake -P *.cmake file # - SET(ARGS_STR ${PARSE_ARGS}) - #PRINT_VAR(ARGS_STR) - #IF (PARSE_ARGS) - # TRIBITS_JOIN_EXEC_PROCESS_SET_ARGS( ARGS_STR ${PARSE_ARGS} ) - #ENDIF() + set(ARGS_STR ${PARSE_ARGS}) + #print_var(ARGS_STR) + #if (PARSE_ARGS) + # tribits_join_exec_process_set_args( ARGS_STR ${PARSE_ARGS} ) + #endif() - IF (PARSE_EXEC) + if (PARSE_EXEC) # # This is an EXEC test block # - SET(HAS_AT_LEAST_ONE_EXEC TRUE) + set(HAS_AT_LEAST_ONE_EXEC TRUE) - LIST( LENGTH PARSE_EXEC PARSE_EXEC_LEN ) - IF (NOT PARSE_EXEC_LEN EQUAL 1) - MESSAGE(SEND_ERROR "Error, TEST_${TEST_CMND_IDX} EXEC = '${PARSE_EXEC}'" + list( LENGTH PARSE_EXEC PARSE_EXEC_LEN ) + if (NOT PARSE_EXEC_LEN EQUAL 1) + message(SEND_ERROR "Error, TEST_${TEST_CMND_IDX} EXEC = '${PARSE_EXEC}'" " must be a single name. To add arguments use ARGS ...." ) - ENDIF() + endif() - TRIBITS_ADD_TEST_GET_EXE_BINARY_NAME( "${PARSE_EXEC}" + tribits_add_test_get_exe_binary_name( "${PARSE_EXEC}" ${PARSE_NOEXEPREFIX} ${PARSE_NOEXESUFFIX} ${PARSE_ADD_DIR_TO_NAME} EXE_BINARY_NAME ) - TRIBITS_ADD_TEST_ADJUST_DIRECTORY( ${EXE_BINARY_NAME} "${PARSE_DIRECTORY}" + tribits_add_test_adjust_directory( ${EXE_BINARY_NAME} "${PARSE_DIRECTORY}" EXECUTABLE_PATH) - IF (PARSE_NUM_MPI_PROCS) - SET(NUM_MPI_PROC_VAR_NAME "NUM_MPI_PROCS") - ELSE() - SET(PARSE_NUM_MPI_PROCS ${PARSE_OVERALL_NUM_MPI_PROCS}) - SET(NUM_MPI_PROC_VAR_NAME "OVERALL_NUM_MPI_PROCS") - ENDIF() + if (PARSE_NUM_MPI_PROCS) + set(NUM_MPI_PROC_VAR_NAME "NUM_MPI_PROCS") + else() + set(PARSE_NUM_MPI_PROCS ${PARSE_OVERALL_NUM_MPI_PROCS}) + set(NUM_MPI_PROC_VAR_NAME "OVERALL_NUM_MPI_PROCS") + endif() - TRIBITS_ADD_TEST_GET_NUM_PROCS_USED("${PARSE_NUM_MPI_PROCS}" + tribits_add_test_get_num_procs_used("${PARSE_NUM_MPI_PROCS}" "${NUM_MPI_PROC_VAR_NAME}" NUM_PROCS_USED NUM_PROCS_USED_NAME) - IF (NUM_PROCS_USED LESS 0) - SET(ADD_THE_TEST FALSE) - ELSEIF (NUM_PROCS_USED GREATER MAX_NUM_MPI_PROCS_USED) - SET(MAX_NUM_MPI_PROCS_USED ${NUM_PROCS_USED}) - ENDIF() - - IF (PARSE_NUM_TOTAL_CORES_USED) - SET(NUM_TOTAL_CORES_USED ${PARSE_NUM_TOTAL_CORES_USED}) - SET(NUM_TOTAL_CORES_USED_NAME "NUM_TOTAL_CORES_USED") - ELSE() - SET(NUM_TOTAL_CORES_USED ${PARSE_OVERALL_NUM_TOTAL_CORES_USED}) - SET(NUM_TOTAL_CORES_USED_NAME "OVERALL_NUM_TOTAL_CORES_USED") - ENDIF() - - TRIBITS_ADD_TEST_GET_NUM_TOTAL_CORES_USED("${TEST_NAME}${MPI_NAME_POSTFIX}" + if (NUM_PROCS_USED LESS 0) + set(ADD_THE_TEST FALSE) + elseif (NUM_PROCS_USED GREATER MAX_NUM_MPI_PROCS_USED) + set(MAX_NUM_MPI_PROCS_USED ${NUM_PROCS_USED}) + endif() + + if (PARSE_NUM_TOTAL_CORES_USED) + set(NUM_TOTAL_CORES_USED ${PARSE_NUM_TOTAL_CORES_USED}) + set(NUM_TOTAL_CORES_USED_NAME "NUM_TOTAL_CORES_USED") + else() + set(NUM_TOTAL_CORES_USED ${PARSE_OVERALL_NUM_TOTAL_CORES_USED}) + set(NUM_TOTAL_CORES_USED_NAME "OVERALL_NUM_TOTAL_CORES_USED") + endif() + + tribits_add_test_get_num_total_cores_used("${TEST_NAME}${MPI_NAME_POSTFIX}" "${NUM_TOTAL_CORES_USED}" "${NUM_TOTAL_CORES_USED_NAME}" "${NUM_PROCS_USED}" "${NUM_PROCS_USED_NAME}" NUM_TOTAL_CORES_USED SKIP_TEST) - IF (SKIP_TEST) - SET(ADD_THE_TEST FALSE) - ENDIF() + if (SKIP_TEST) + set(ADD_THE_TEST FALSE) + endif() - IF (NUM_TOTAL_CORES_USED GREATER MAX_NUM_PROCESSORS_USED) - SET(MAX_NUM_PROCESSORS_USED ${NUM_TOTAL_CORES_USED}) - ENDIF() + if (NUM_TOTAL_CORES_USED GREATER MAX_NUM_PROCESSORS_USED) + set(MAX_NUM_PROCESSORS_USED ${NUM_TOTAL_CORES_USED}) + endif() - IF(ADD_THE_TEST) - LIST(APPEND TEST_EXE_LIST ${EXECUTABLE_PATH}) - ENDIF() + if(ADD_THE_TEST) + list(APPEND TEST_EXE_LIST ${EXECUTABLE_PATH}) + endif() - TRIBITS_ADD_TEST_GET_TEST_CMND_ARRAY( TEST_CMND_ARRAY + tribits_add_test_get_test_cmnd_array( TEST_CMND_ARRAY "${EXECUTABLE_PATH}" "${NUM_PROCS_USED}" ${ARGS_STR} ) - #PRINT_VAR(TEST_CMND_ARRAY) + #print_var(TEST_CMND_ARRAY) - ELSEIF (PARSE_CMND) + elseif (PARSE_CMND) # # This is a COMMAND test block # - LIST( LENGTH PARSE_CMND PARSE_CMND_LEN ) - IF (NOT PARSE_CMND_LEN EQUAL 1) - MESSAGE_WRAPPER(SEND_ERROR "Error, TEST_${TEST_CMND_IDX} CMND = '${PARSE_CMND}'" + list( LENGTH PARSE_CMND PARSE_CMND_LEN ) + if (NOT PARSE_CMND_LEN EQUAL 1) + message_wrapper(SEND_ERROR "Error, TEST_${TEST_CMND_IDX} CMND = '${PARSE_CMND}'" " must be a single command. To add arguments use ARGS ...." ) - ENDIF() + endif() - IF (PARSE_NUM_TOTAL_CORES_USED) - SET(NUM_TOTAL_CORES_USED ${PARSE_NUM_TOTAL_CORES_USED}) - SET(NUM_TOTAL_CORES_USED_NAME "NUM_TOTAL_CORES_USED") - ELSE() - SET(NUM_TOTAL_CORES_USED ${PARSE_OVERALL_NUM_TOTAL_CORES_USED}) - SET(NUM_TOTAL_CORES_USED_NAME "OVERALL_NUM_TOTAL_CORES_USED") - ENDIF() + if (PARSE_NUM_TOTAL_CORES_USED) + set(NUM_TOTAL_CORES_USED ${PARSE_NUM_TOTAL_CORES_USED}) + set(NUM_TOTAL_CORES_USED_NAME "NUM_TOTAL_CORES_USED") + else() + set(NUM_TOTAL_CORES_USED ${PARSE_OVERALL_NUM_TOTAL_CORES_USED}) + set(NUM_TOTAL_CORES_USED_NAME "OVERALL_NUM_TOTAL_CORES_USED") + endif() - TRIBITS_ADD_TEST_GET_NUM_TOTAL_CORES_USED("${TEST_NAME}${MPI_NAME_POSTFIX}" + tribits_add_test_get_num_total_cores_used("${TEST_NAME}${MPI_NAME_POSTFIX}" "${NUM_TOTAL_CORES_USED}" "${NUM_TOTAL_CORES_USED_NAME}" "1" "DUMMY_NUM_MPI_PROCS" # Never be printed NUM_TOTAL_CORES_USED SKIP_TEST) - IF (SKIP_TEST) - SET(ADD_THE_TEST FALSE) - ENDIF() + if (SKIP_TEST) + set(ADD_THE_TEST FALSE) + endif() - IF (NUM_TOTAL_CORES_USED GREATER MAX_NUM_PROCESSORS_USED) - SET(MAX_NUM_PROCESSORS_USED ${NUM_TOTAL_CORES_USED}) - ENDIF() + if (NUM_TOTAL_CORES_USED GREATER MAX_NUM_PROCESSORS_USED) + set(MAX_NUM_PROCESSORS_USED ${NUM_TOTAL_CORES_USED}) + endif() - IF(ADD_THE_TEST) - IF (NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) - FIND_PROGRAM(CMND_PATH ${PARSE_CMND}) - ELSE() - SET(CMND_PATH ${PARSE_CMND}) - ENDIF() - LIST(APPEND TEST_EXE_LIST ${CMND_PATH}) - ENDIF() + if(ADD_THE_TEST) + if (NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) + find_program(CMND_PATH ${PARSE_CMND}) + else() + set(CMND_PATH ${PARSE_CMND}) + endif() + list(APPEND TEST_EXE_LIST ${CMND_PATH}) + endif() - SET( TEST_CMND_ARRAY ${PARSE_CMND} ${ARGS_STR} ) + set( TEST_CMND_ARRAY ${PARSE_CMND} ${ARGS_STR} ) - ELSEIF (PARSE_COPY_FILES_TO_TEST_DIR) + elseif (PARSE_COPY_FILES_TO_TEST_DIR) # # This is a COPY_FLES_TO_TEST_DIR block # # FILES_TO_COPY_COMMA_SEP - SET(FILES_TO_COPY_COMMA_SEP "${PARSE_COPY_FILES_TO_TEST_DIR}") + set(FILES_TO_COPY_COMMA_SEP "${PARSE_COPY_FILES_TO_TEST_DIR}") string(REPLACE ";" "," FILES_TO_COPY_COMMA_SEP "${FILES_TO_COPY_COMMA_SEP}" ) # NOTE: Above, we have to replace ';' with ',' or the lower commands - # APPEND_STRING_VAR() will replace ';' with ''. This is *not* what we + # append_string_var() will replace ';' with ''. This is *not* what we # want. In DriveAdvancedTest.cmake, we will replace the ',' with ';' # again :-) # SOURCE_DIR - IF (PARSE_SOURCE_DIR) - IF (IS_ABSOLUTE "${PARSE_SOURCE_DIR}") - SET(COPY_FILES_TO_TEST_DIR_SOURCE_DIR + if (PARSE_SOURCE_DIR) + if (IS_ABSOLUTE "${PARSE_SOURCE_DIR}") + set(COPY_FILES_TO_TEST_DIR_SOURCE_DIR "${PARSE_SOURCE_DIR}") - ELSE() - SET(COPY_FILES_TO_TEST_DIR_SOURCE_DIR + else() + set(COPY_FILES_TO_TEST_DIR_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${PARSE_SOURCE_DIR}") - ENDIF() - ELSE() - SET(COPY_FILES_TO_TEST_DIR_SOURCE_DIR + endif() + else() + set(COPY_FILES_TO_TEST_DIR_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - ENDIF() + endif() # DEST_DIR - IF (PARSE_DEST_DIR) - IF (IS_ABSOLUTE "${PARSE_DEST_DIR}") - SET(COPY_FILES_TO_TEST_DIR_DEST_DIR + if (PARSE_DEST_DIR) + if (IS_ABSOLUTE "${PARSE_DEST_DIR}") + set(COPY_FILES_TO_TEST_DIR_DEST_DIR "${PARSE_DEST_DIR}") - ELSE() - SET(COPY_FILES_TO_TEST_DIR_DEST_DIR + else() + set(COPY_FILES_TO_TEST_DIR_DEST_DIR "${ABS_OVERALL_WORKING_DIRECTORY}/${PARSE_DEST_DIR}") - ENDIF() - ELSE() - SET(COPY_FILES_TO_TEST_DIR_DEST_DIR + endif() + else() + set(COPY_FILES_TO_TEST_DIR_DEST_DIR "${ABS_OVERALL_WORKING_DIRECTORY}") - ENDIF() + endif() - ELSE() + else() - MESSAGE( FATAL_ERROR + message( FATAL_ERROR "Must have EXEC, CMND, or COPY_FILES_TO_TEST_DIR for TEST_${TEST_CMND_IDX}" ) - ENDIF() + endif() # # Write parts for this TEST_ block to TEST_SCRIPT_STR # - IF (PARSE_COPY_FILES_TO_TEST_DIR) + if (PARSE_COPY_FILES_TO_TEST_DIR) # Write the vars for COPY_FILES_TO_TEST_DIR - APPEND_STRING_VAR( TEST_SCRIPT_STR + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_COPY_FILES_TO_TEST_DIR" + "set( TEST_${TEST_CMND_IDX}_COPY_FILES_TO_TEST_DIR" " \"${FILES_TO_COPY_COMMA_SEP}\")\n" ) - IF (TRIBITS_ADD_ADVANCED_TEST_UNITTEST) - GLOBAL_SET(TRIBITS_ADD_ADVANCED_TEST_CMND_ARRAY_${TEST_CMND_IDX} + if (TRIBITS_ADD_ADVANCED_TEST_UNITTEST) + global_set(TRIBITS_ADD_ADVANCED_TEST_CMND_ARRAY_${TEST_CMND_IDX} "${TEST_CMND_STR}" ) - ENDIF() + endif() - APPEND_STRING_VAR( TEST_SCRIPT_STR + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_SOURCE_DIR" + "set( TEST_${TEST_CMND_IDX}_SOURCE_DIR" " \"${COPY_FILES_TO_TEST_DIR_SOURCE_DIR}\")\n" ) - APPEND_STRING_VAR( TEST_SCRIPT_STR + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_DEST_DIR" + "set( TEST_${TEST_CMND_IDX}_DEST_DIR" " \"${COPY_FILES_TO_TEST_DIR_DEST_DIR}\")\n" ) - ELSE() + else() # Write the command to be run for EXEC and CMND blocks ... - TRIBITS_JOIN_EXEC_PROCESS_SET_ARGS( TEST_CMND_STR "${TEST_CMND_ARRAY}" ) - #PRINT_VAR(TEST_CMND_STR) + tribits_join_exec_process_set_args( TEST_CMND_STR "${TEST_CMND_ARRAY}" ) + #print_var(TEST_CMND_STR) - APPEND_STRING_VAR( TEST_SCRIPT_STR + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_CMND ${TEST_CMND_STR} )\n" + "set( TEST_${TEST_CMND_IDX}_CMND ${TEST_CMND_STR} )\n" ) - IF (TRIBITS_ADD_ADVANCED_TEST_UNITTEST) - GLOBAL_SET(TRIBITS_ADD_ADVANCED_TEST_CMND_ARRAY_${TEST_CMND_IDX} + if (TRIBITS_ADD_ADVANCED_TEST_UNITTEST) + global_set(TRIBITS_ADD_ADVANCED_TEST_CMND_ARRAY_${TEST_CMND_IDX} "${TEST_CMND_STR}" ) - ENDIF() + endif() - ENDIF() + endif() - IF (PARSE_MESSAGE) - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_MESSAGE) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_MESSAGE \"${PARSE_MESSAGE}\" )\n" + "set( TEST_${TEST_CMND_IDX}_MESSAGE \"${PARSE_MESSAGE}\" )\n" ) - ENDIF() + endif() - IF (PARSE_WORKING_DIRECTORY) - IF ("${PARSE_WORKING_DIRECTORY}" STREQUAL "TEST_NAME") - SET(PARSE_WORKING_DIRECTORY ${TEST_NAME}) - ENDIF() - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_WORKING_DIRECTORY) + if ("${PARSE_WORKING_DIRECTORY}" STREQUAL "TEST_NAME") + set(PARSE_WORKING_DIRECTORY ${TEST_NAME}) + endif() + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_WORKING_DIRECTORY \"${PARSE_WORKING_DIRECTORY}\" )\n" + "set( TEST_${TEST_CMND_IDX}_WORKING_DIRECTORY \"${PARSE_WORKING_DIRECTORY}\" )\n" ) - APPEND_STRING_VAR( TEST_SCRIPT_STR + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_SKIP_CLEAN_WORKING_DIRECTORY ${PARSE_SKIP_CLEAN_WORKING_DIRECTORY} )\n" + "set( TEST_${TEST_CMND_IDX}_SKIP_CLEAN_WORKING_DIRECTORY ${PARSE_SKIP_CLEAN_WORKING_DIRECTORY} )\n" ) - ENDIF() + endif() - IF (PARSE_OUTPUT_FILE) - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_OUTPUT_FILE) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_OUTPUT_FILE \"${PARSE_OUTPUT_FILE}\" )\n" + "set( TEST_${TEST_CMND_IDX}_OUTPUT_FILE \"${PARSE_OUTPUT_FILE}\" )\n" ) - ENDIF() + endif() - IF (PARSE_NO_ECHO_OUTPUT) - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_NO_ECHO_OUTPUT) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_NO_ECHO_OUTPUT \"${PARSE_NO_ECHO_OUTPUT}\" )\n" + "set( TEST_${TEST_CMND_IDX}_NO_ECHO_OUTPUT \"${PARSE_NO_ECHO_OUTPUT}\" )\n" ) - ENDIF() + endif() # Set up pass/fail - IF (PARSE_PASS_ANY) - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_PASS_ANY) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_PASS_ANY TRUE )\n" + "set( TEST_${TEST_CMND_IDX}_PASS_ANY TRUE )\n" ) - ELSEIF (PARSE_STANDARD_PASS_OUTPUT) - APPEND_STRING_VAR( TEST_SCRIPT_STR + elseif (PARSE_STANDARD_PASS_OUTPUT) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_PASS_REGULAR_EXPRESSION \"End Result: TEST PASSED\" )\n" + "set( TEST_${TEST_CMND_IDX}_PASS_REGULAR_EXPRESSION \"End Result: TEST PASSED\" )\n" ) - ELSEIF (PARSE_PASS_REGULAR_EXPRESSION) - APPEND_STRING_VAR( TEST_SCRIPT_STR + elseif (PARSE_PASS_REGULAR_EXPRESSION) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_PASS_REGULAR_EXPRESSION \"${PARSE_PASS_REGULAR_EXPRESSION}\" )\n" + "set( TEST_${TEST_CMND_IDX}_PASS_REGULAR_EXPRESSION \"${PARSE_PASS_REGULAR_EXPRESSION}\" )\n" ) - ELSEIF (PARSE_PASS_REGULAR_EXPRESSION_ALL) - APPEND_STRING_VAR( TEST_SCRIPT_STR + elseif (PARSE_PASS_REGULAR_EXPRESSION_ALL) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_PASS_REGULAR_EXPRESSION_ALL " + "set( TEST_${TEST_CMND_IDX}_PASS_REGULAR_EXPRESSION_ALL " ) - FOREACH(REGEX_STR ${PARSE_PASS_REGULAR_EXPRESSION_ALL}) - APPEND_STRING_VAR( TEST_SCRIPT_STR + foreach(REGEX_STR ${PARSE_PASS_REGULAR_EXPRESSION_ALL}) + append_string_var( TEST_SCRIPT_STR "\"${REGEX_STR}\" " ) - ENDFOREACH() - APPEND_STRING_VAR( TEST_SCRIPT_STR + endforeach() + append_string_var( TEST_SCRIPT_STR ")\n" ) - ENDIF() + endif() - IF (PARSE_FAIL_REGULAR_EXPRESSION) - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_FAIL_REGULAR_EXPRESSION) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_FAIL_REGULAR_EXPRESSION \"${PARSE_FAIL_REGULAR_EXPRESSION}\" )\n" + "set( TEST_${TEST_CMND_IDX}_FAIL_REGULAR_EXPRESSION \"${PARSE_FAIL_REGULAR_EXPRESSION}\" )\n" ) - ENDIF() + endif() - IF (PARSE_ALWAYS_FAIL_ON_NONZERO_RETURN) - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_ALWAYS_FAIL_ON_NONZERO_RETURN) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_ALWAYS_FAIL_ON_NONZERO_RETURN TRUE )\n" + "set( TEST_${TEST_CMND_IDX}_ALWAYS_FAIL_ON_NONZERO_RETURN TRUE )\n" ) - ENDIF() + endif() - IF (PARSE_ALWAYS_FAIL_ON_ZERO_RETURN) - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_ALWAYS_FAIL_ON_ZERO_RETURN) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_ALWAYS_FAIL_ON_ZERO_RETURN TRUE )\n" + "set( TEST_${TEST_CMND_IDX}_ALWAYS_FAIL_ON_ZERO_RETURN TRUE )\n" ) - ENDIF() + endif() - IF (PARSE_WILL_FAIL) - APPEND_STRING_VAR( TEST_SCRIPT_STR + if (PARSE_WILL_FAIL) + append_string_var( TEST_SCRIPT_STR "\n" - "SET( TEST_${TEST_CMND_IDX}_WILL_FAIL TRUE )\n" + "set( TEST_${TEST_CMND_IDX}_WILL_FAIL TRUE )\n" ) - ENDIF() + endif() - ENDFOREACH() + endforeach() # ToDo: Verify that TEST_${MAX_NUM_TEST_CMND_IDX}+1 does *not* exist! @@ -1377,72 +1377,72 @@ FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) # F) Set the CTest test to run the new script # - IF (ADD_THE_TEST) + if (ADD_THE_TEST) # - # F.1) Call ADD_TEST() and set the test properties + # F.1) Call add_test() and set the test properties # - SET(TEST_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TEST_SCRIPT_FILE_NAME}") + set(TEST_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TEST_SCRIPT_FILE_NAME}") - IF(NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) + if(NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) # Tell CTest to run our script for this test. Pass the test-type # configuration name to the script in the TEST_CONFIG variable. - ADD_TEST( NAME ${TEST_NAME} + add_test( NAME ${TEST_NAME} COMMAND ${CMAKE_COMMAND} "-DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE}" -P "${TEST_SCRIPT_FILE}") - ENDIF() + endif() - IF(PARSE_ADDED_TEST_NAME_OUT) - SET(${PARSE_ADDED_TEST_NAME_OUT} ${TEST_NAME} PARENT_SCOPE ) - ENDIF() + if(PARSE_ADDED_TEST_NAME_OUT) + set(${PARSE_ADDED_TEST_NAME_OUT} ${TEST_NAME} PARENT_SCOPE ) + endif() - LIST(REMOVE_DUPLICATES TEST_EXE_LIST) - TRIBITS_SET_TEST_PROPERTY(${TEST_NAME} PROPERTY REQUIRED_FILES ${TEST_EXE_LIST}) + list(REMOVE_DUPLICATES TEST_EXE_LIST) + tribits_set_test_property(${TEST_NAME} PROPERTY REQUIRED_FILES ${TEST_EXE_LIST}) - IF(SET_RUN_SERIAL) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES RUN_SERIAL ON) - ENDIF() + if(SET_RUN_SERIAL) + tribits_set_tests_properties(${TEST_NAME} PROPERTIES RUN_SERIAL ON) + endif() - TRIBITS_PRIVATE_ADD_TEST_ADD_LABEL_AND_KEYWORDS(${TEST_NAME}) + tribits_private_add_test_add_label_and_keywords(${TEST_NAME}) #This if clause will set the number of PROCESSORS to reserve during testing #to the number requested for the test. - IF(MAX_NUM_PROCESSORS_USED) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES + if(MAX_NUM_PROCESSORS_USED) + tribits_set_tests_properties(${TEST_NAME} PROPERTIES PROCESSORS "${MAX_NUM_PROCESSORS_USED}") - ENDIF() + endif() - TRIBITS_PRIVATE_ADD_TEST_ADD_ENVIRONMENT_AND_RESOURCE(${TEST_NAME} + tribits_private_add_test_add_environment_and_resource(${TEST_NAME} ${MAX_NUM_PROCESSORS_USED}) - IF (SET_DISABLED_AND_MSG) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES DISABLED ON) - ENDIF() + if (SET_DISABLED_AND_MSG) + tribits_set_tests_properties(${TEST_NAME} PROPERTIES DISABLED ON) + endif() - IF (PARSE_FINAL_PASS_REGULAR_EXPRESSION) - TRIBITS_SET_TESTS_PROPERTIES( ${TEST_NAME} PROPERTIES + if (PARSE_FINAL_PASS_REGULAR_EXPRESSION) + tribits_set_tests_properties( ${TEST_NAME} PROPERTIES PASS_REGULAR_EXPRESSION "${PARSE_FINAL_PASS_REGULAR_EXPRESSION}" ) - ELSEIF (PARSE_FINAL_FAIL_REGULAR_EXPRESSION) - TRIBITS_SET_TESTS_PROPERTIES( ${TEST_NAME} PROPERTIES + elseif (PARSE_FINAL_FAIL_REGULAR_EXPRESSION) + tribits_set_tests_properties( ${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "${PARSE_FINAL_FAIL_REGULAR_EXPRESSION}" ) - ELSE() - TRIBITS_SET_TESTS_PROPERTIES( ${TEST_NAME} PROPERTIES + else() + tribits_set_tests_properties( ${TEST_NAME} PROPERTIES PASS_REGULAR_EXPRESSION "OVERALL FINAL RESULT: TEST PASSED .${TEST_NAME}." ) - ENDIF() + endif() - TRIBITS_PRIVATE_ADD_TEST_SET_TIMEOUT(${TEST_NAME} TIMEOUT_USED) + tribits_private_add_test_set_timeout(${TEST_NAME} TIMEOUT_USED) - TRIBITS_PRIVATE_ADD_TEST_SET_ENVIRONMENT(${TEST_NAME}) + tribits_private_add_test_set_environment(${TEST_NAME}) - IF (TPL_ENABLE_MPI AND HAS_AT_LEAST_ONE_EXEC) - SET(MAX_NUM_MPI_PROCS_USED_TO_PRINT ${MAX_NUM_MPI_PROCS_USED}) - ELSE() - SET(MAX_NUM_MPI_PROCS_USED_TO_PRINT "") - ENDIF() + if (TPL_ENABLE_MPI AND HAS_AT_LEAST_ONE_EXEC) + set(MAX_NUM_MPI_PROCS_USED_TO_PRINT ${MAX_NUM_MPI_PROCS_USED}) + else() + set(MAX_NUM_MPI_PROCS_USED_TO_PRINT "") + endif() - TRIBITS_PRIVATE_ADD_TEST_PRINT_ADDED(${TEST_NAME} + tribits_private_add_test_print_added(${TEST_NAME} "${PARSE_CATEGORIES}" "${MAX_NUM_MPI_PROCS_USED_TO_PRINT}" "${MAX_NUM_PROCESSORS_USED}" "${TIMEOUT_USED}" "${SET_RUN_SERIAL}" "${SET_DISABLED_AND_MSG}") @@ -1451,73 +1451,73 @@ FUNCTION(TRIBITS_ADD_ADVANCED_TEST TEST_NAME_IN) # F.2) Write the cmake -P script # - APPEND_STRING_VAR( TEST_SCRIPT_STR + append_string_var( TEST_SCRIPT_STR "\n" - "SET(PROJECT_NAME ${PROJECT_NAME})\n" + "set(PROJECT_NAME ${PROJECT_NAME})\n" "\n" - "SET(${PROJECT_NAME}_TRIBITS_DIR ${${PROJECT_NAME}_TRIBITS_DIR})\n" + "set(${PROJECT_NAME}_TRIBITS_DIR ${${PROJECT_NAME}_TRIBITS_DIR})\n" "\n" - "SET(TEST_NAME ${TEST_NAME})\n" + "set(TEST_NAME ${TEST_NAME})\n" "\n" - "SET(NUM_CMNDS ${NUM_CMNDS})\n" + "set(NUM_CMNDS ${NUM_CMNDS})\n" "\n" - "SET(OVERALL_WORKING_DIRECTORY \"${PARSE_OVERALL_WORKING_DIRECTORY}\")\n" + "set(OVERALL_WORKING_DIRECTORY \"${PARSE_OVERALL_WORKING_DIRECTORY}\")\n" "\n" - "SET(SKIP_CLEAN_OVERALL_WORKING_DIRECTORY \"${PARSE_SKIP_CLEAN_OVERALL_WORKING_DIRECTORY}\")\n" + "set(SKIP_CLEAN_OVERALL_WORKING_DIRECTORY \"${PARSE_SKIP_CLEAN_OVERALL_WORKING_DIRECTORY}\")\n" "\n" - "SET(FAIL_FAST ${PARSE_FAIL_FAST})\n" + "set(FAIL_FAST ${PARSE_FAIL_FAST})\n" "\n" - "SET(SHOW_START_END_DATE_TIME ${${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME})\n" + "set(SHOW_START_END_DATE_TIME ${${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME})\n" "\n" - "SET(SHOW_MACHINE_LOAD ${${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST})\n" + "set(SHOW_MACHINE_LOAD ${${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST})\n" "\n" - "SET(CATEGORIES ${PARSE_CATEGORIES})\n" + "set(CATEGORIES ${PARSE_CATEGORIES})\n" "\n" - "SET(PROCESSORS ${MAX_NUM_PROCESSORS_USED})\n" + "set(PROCESSORS ${MAX_NUM_PROCESSORS_USED})\n" "\n" - "SET(TIMEOUT ${TIMEOUT_USED})\n" + "set(TIMEOUT ${TIMEOUT_USED})\n" "\n" "#\n" "# Test invocation\n" "#\n" "\n" - "SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_UTILS_DIR})\n" + "set(CMAKE_MODULE_PATH ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_UTILS_DIR})\n" "\n" - "INCLUDE(DriveAdvancedTest)\n" + "include(DriveAdvancedTest)\n" "\n" - "DRIVE_ADVANCED_TEST()\n" + "drive_advanced_test()\n" ) - IF (TRIBITS_ADD_ADVANCED_TEST_UNITTEST) - GLOBAL_SET(TRIBITS_ADD_ADVANCED_TEST_NUM_CMNDS ${NUM_CMNDS}) + if (TRIBITS_ADD_ADVANCED_TEST_UNITTEST) + global_set(TRIBITS_ADD_ADVANCED_TEST_NUM_CMNDS ${NUM_CMNDS}) # NOTE: This var only gets set if the advanced test gets added after # applying all of the various logic. Therefore, unit tests should only # check this variable for being empty to determine that the test was not # added. - ENDIF() + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(TEST_SCRIPT_STR) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(TEST_SCRIPT_STR) + endif() # Write the script file - IF (NOT TRIBITS_ADD_ADVANCED_TEST_SKIP_SCRIPT) + if (NOT TRIBITS_ADD_ADVANCED_TEST_SKIP_SCRIPT) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nWriting file \"${TEST_SCRIPT_FILE}\" ...") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nWriting file \"${TEST_SCRIPT_FILE}\" ...") + endif() - FILE( WRITE "${TEST_SCRIPT_FILE}" + file( WRITE "${TEST_SCRIPT_FILE}" "${TEST_SCRIPT_STR}" ) - ENDIF() + endif() - ELSE() + else() - GLOBAL_SET(TRIBITS_ADD_ADVANCED_TEST_NUM_CMNDS "") + global_set(TRIBITS_ADD_ADVANCED_TEST_NUM_CMNDS "") - ENDIF() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsAddAdvancedTestHelpers.cmake b/cmake/tribits/core/package_arch/TribitsAddAdvancedTestHelpers.cmake index 65d44a402045..8c2e11df36ac 100644 --- a/cmake/tribits/core/package_arch/TribitsAddAdvancedTestHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddAdvancedTestHelpers.cmake @@ -38,68 +38,68 @@ # @HEADER -INCLUDE(TribitsAddTestHelpers) +include(TribitsAddTestHelpers) -# Set default ax number of TEST_ blocks in TRIBITS_ADD_ADVANCED_TEST() -IF ("${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS}" STREQUAL "") - SET(TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS 20) -ENDIF() +# Set default ax number of TEST_ blocks in tribits_add_advanced_test() +if ("${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS}" STREQUAL "") + set(TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS 20) +endif() # NOTE: Given how includes are done in CMake, above is the only safe way to set # the default. # Compute TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX given # TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS -MACRO(TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX_COMPUTE) - MATH(EXPR TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX +macro(tribits_add_advanced_test_max_num_test_cmnd_idx_compute) + math(EXPR TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX "${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS}-1") -ENDMACRO() +endmacro() # Check that the numbers of TEST_ blocks is not violated. # # This gets called on the last # TEST_ block of arguments in the parser. # -FUNCTION(TRIBITS_ADD_ADVANCED_TEST_CHECK_EXCEED_MAX_NUM_TEST_BLOCKS) - IF (NOT "${PARSE_TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX}}" +function(tribits_add_advanced_test_check_exceed_max_num_test_blocks) + if (NOT "${PARSE_TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX}}" STREQUAL "" ) - LIST(FIND PARSE_TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX} + list(FIND PARSE_TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX} "TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS}" TEST_BLOCK_KEYWORD_FIND_IDX) - IF (NOT TEST_BLOCK_KEYWORD_FIND_IDX EQUAL -1) - MESSAGE_WRAPPER(FATAL_ERROR - "${TEST_NAME}: ERROR: Test block TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS} exceeds the max allowed test block TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX} as allowed by TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS=${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS}. To fix this, call set(TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS ) before calling TRIBITS_ADD_ADVANCED_TEST()!") + if (NOT TEST_BLOCK_KEYWORD_FIND_IDX EQUAL -1) + message_wrapper(FATAL_ERROR + "${TEST_NAME}: ERROR: Test block TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS} exceeds the max allowed test block TEST_${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX} as allowed by TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS=${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS}. To fix this, call set(TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_BLOCKS ) before calling tribits_add_advanced_test()!") # NOTE: The above error message is put on one line to simplify unit # testing checking the string. - ENDIF() - ENDIF() -ENDFUNCTION() + endif() + endif() +endfunction() -# Join arguments together to add to a SET(...) statement to passed to -# EXECUTE_PROCESS(...) +# Join arguments together to add to a set(...) statement to passed to +# execute_process(...) # -FUNCTION(TRIBITS_JOIN_EXEC_PROCESS_SET_ARGS OUTPUT_STRING_VAR) - SET(OUTPUT_STRING "") - FOREACH(STRING_VAL_RAW ${ARGN}) +function(tribits_join_exec_process_set_args OUTPUT_STRING_VAR) + set(OUTPUT_STRING "") + foreach(STRING_VAL_RAW ${ARGN}) # Remove quotes around arguments because CTest does not need them - STRING(REGEX REPLACE "\"" "" STRING_VAL "${STRING_VAL_RAW}") - IF (OUTPUT_STRING STREQUAL "") - SET(OUTPUT_STRING "\"${STRING_VAL}\"") - ELSE() - SET(OUTPUT_STRING "${OUTPUT_STRING} \"${STRING_VAL}\"") - ENDIF() - ENDFOREACH() - SET(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE) -ENDFUNCTION() + string(REGEX REPLACE "\"" "" STRING_VAL "${STRING_VAL_RAW}") + if (OUTPUT_STRING STREQUAL "") + set(OUTPUT_STRING "\"${STRING_VAL}\"") + else() + set(OUTPUT_STRING "${OUTPUT_STRING} \"${STRING_VAL}\"") + endif() + endforeach() + set(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE) +endfunction() -# Unit test helper function for TRIBITS_ADD_ADVANCED_TEST(...) that resets -# state before calling TRIBITS_ADD_ADVANCED_TEST(...) in unit test mode. +# Unit test helper function for tribits_add_advanced_test(...) that resets +# state before calling tribits_add_advanced_test(...) in unit test mode. # -# NOTE: The varaibles: +# NOTE: The variables: # # TRIBITS_ADD_ADVANCED_TEST_CMND_ARRAY_${TEST_CMND_IDX} # @@ -112,17 +112,17 @@ ENDFUNCTION() # # If that variable is empty, then the advanced test did *not* get added. # -FUNCTION(TRIBITS_ADD_ADVANCED_TEST_UNITTEST_RESET) +function(tribits_add_advanced_test_unittest_reset) - GLOBAL_SET(TRIBITS_ADD_ADVANCED_TEST_UNITTEST TRUE) + global_set(TRIBITS_ADD_ADVANCED_TEST_UNITTEST TRUE) - GLOBAL_SET(TRIBITS_ADD_ADVANCED_TEST_NUM_CMNDS "") + global_set(TRIBITS_ADD_ADVANCED_TEST_NUM_CMNDS "") - TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX_COMPUTE() - FOREACH( TEST_CMND_IDX RANGE + tribits_add_advanced_test_max_num_test_cmnd_idx_compute() + foreach( TEST_CMND_IDX RANGE ${TRIBITS_ADD_ADVANCED_TEST_MAX_NUM_TEST_CMND_IDX} ) - GLOBAL_SET(TRIBITS_ADD_ADVANCED_TEST_CMND_ARRAY_${TEST_CMND_IDX} "") - ENDFOREACH() + global_set(TRIBITS_ADD_ADVANCED_TEST_CMND_ARRAY_${TEST_CMND_IDX} "") + endforeach() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsAddExecutable.cmake b/cmake/tribits/core/package_arch/TribitsAddExecutable.cmake index d7a18c3c8414..1c9294e98b48 100644 --- a/cmake/tribits/core/package_arch/TribitsAddExecutable.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddExecutable.cmake @@ -38,15 +38,15 @@ # @HEADER -INCLUDE(TribitsAddExecutableTestHelpers) -INCLUDE(TribitsCommonArgsHelpers) -INCLUDE(TribitsAddTestHelpers) -INCLUDE(TribitsGeneralMacros) -INCLUDE(TribitsReportInvalidTribitsUsage) +include(TribitsAddExecutableTestHelpers) +include(TribitsCommonArgsHelpers) +include(TribitsAddTestHelpers) +include(TribitsGeneralMacros) +include(TribitsReportInvalidTribitsUsage) -INCLUDE(PrintVar) -INCLUDE(AppendSet) -INCLUDE(CMakeParseArguments) +include(PrintVar) +include(AppendSet) +include(CMakeParseArguments) ### ### WARNING: See "NOTES TO DEVELOPERS" at the bottom of the file @@ -55,14 +55,14 @@ INCLUDE(CMakeParseArguments) # -# @FUNCTION: TRIBITS_ADD_EXECUTABLE() +# @FUNCTION: tribits_add_executable() # # Function used to create an executable (typically for a test or example), -# using the built-in CMake command ``ADD_EXECUTABLE()``. +# using the built-in CMake command ``add_executable()``. # # Usage:: # -# TRIBITS_ADD_EXECUTABLE( +# tribits_add_executable( # [NOEXEPREFIX] [NOEXESUFFIX] [ADD_DIR_TO_NAME] # SOURCES ... # [CATEGORIES ...] @@ -83,38 +83,38 @@ INCLUDE(CMakeParseArguments) # # *Sections:* # -# * `Formal Arguments (TRIBITS_ADD_EXECUTABLE())`_ -# * `Executable and Target Name (TRIBITS_ADD_EXECUTABLE())`_ -# * `Additional Executable and Source File Properties (TRIBITS_ADD_EXECUTABLE())`_ -# * `Install Target (TRIBITS_ADD_EXECUTABLE())`_ +# * `Formal Arguments (tribits_add_executable())`_ +# * `Executable and Target Name (tribits_add_executable())`_ +# * `Additional Executable and Source File Properties (tribits_add_executable())`_ +# * `Install Target (tribits_add_executable())`_ # -# .. _Formal Arguments (TRIBITS_ADD_EXECUTABLE()): +# .. _Formal Arguments (tribits_add_executable()): # -# **Formal Arguments (TRIBITS_ADD_EXECUTABLE())** +# **Formal Arguments (tribits_add_executable())** # # ```` # # The root name of the executable (and CMake target) (see `Executable and -# Target Name (TRIBITS_ADD_EXECUTABLE())`_). This must be the first +# Target Name (tribits_add_executable())`_). This must be the first # argument. # # ``NOEXEPREFIX`` # # If passed in, then ``${PACKAGE_NAME}_`` is not added the beginning of # the executable name (see `Executable and Target Name -# (TRIBITS_ADD_EXECUTABLE())`_). +# (tribits_add_executable())`_). # # ``NOEXESUFFIX`` # # If passed in, then ``${${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX}`` and # not added to the end of the executable name (except for native Windows -# builds, see `Executable and Target Name (TRIBITS_ADD_EXECUTABLE())`_). +# builds, see `Executable and Target Name (tribits_add_executable())`_). # # ``ADD_DIR_TO_NAME`` # # If passed in, the directory path relative to the package's base # directory (with "/" replaced by "_") is added to the executable name -# (see `Executable and Target Name (TRIBITS_ADD_EXECUTABLE())`_). This +# (see `Executable and Target Name (tribits_add_executable())`_). This # provides a simple way to create unique test executable names inside of a # given TriBITS package. Only test executables in the same directory # would need to have unique ```` passed in. @@ -126,9 +126,9 @@ INCLUDE(CMakeParseArguments) # directory (or can contain the relative path or absolute path). If # ```` is an absolute path, then that full file path is used. This # list of sources (with adjusted directory path) are passed into -# ``ADD_EXECUTABLE( ... )``. After calling this function, +# ``add_executable( ... )``. After calling this function, # the properties of the source files can be altered using the built-in -# CMake command ``SET_SOURCE_FILE_PROPERTIES()``. +# CMake command ``set_source_file_properties()``. # # ``DIRECTORY `` # @@ -146,36 +146,36 @@ INCLUDE(CMakeParseArguments) # ``CATEGORIES ...`` # # Gives the `Test Test Categories`_ for which this test will be added. -# See `TRIBITS_ADD_TEST()`_ for more details. +# See `tribits_add_test()`_ for more details. # # ``HOST ...`` # -# The list of hosts for which to enable the test (see `TRIBITS_ADD_TEST()`_). +# The list of hosts for which to enable the test (see `tribits_add_test()`_). # # ``XHOST ...`` # # The list of hosts for which **not** to enable the test (see -# `TRIBITS_ADD_TEST()`_). +# `tribits_add_test()`_). # # ``HOSTTYPE ...`` # # The list of host types for which to enable the test (see -# `TRIBITS_ADD_TEST()`_). +# `tribits_add_test()`_). # # ``XHOSTTYPE ...`` # # The list of host types for which **not** to enable the test (see -# `TRIBITS_ADD_TEST()`_). +# `tribits_add_test()`_). # # ``EXCLUDE_IF_NOT_TRUE ...`` # # If specified, gives the names of CMake variables that must evaluate to -# true, or the test will not be added (see `TRIBITS_ADD_TEST()`_). +# true, or the test will not be added (see `tribits_add_test()`_). # # ``TESTONLYLIBS ...`` # # Specifies extra test-only libraries defined in this CMake project that -# will be linked to the executable using ``TARGET_LINK_LIBRARY()``. Note +# will be linked to the executable using ``target_link_libraries()``. Note # that regular libraries (i.e. not ``TESTONLY``) defined in the current SE # package or any upstream SE packages can *NOT* be listed! TriBITS # automatically links non ``TESTONLY`` libraries in this package and @@ -184,11 +184,11 @@ INCLUDE(CMakeParseArguments) # directories for each test-only library will automatically be added # using:: # -# INCLUDE_DIRECTORIES(${_INCLUDE_DIRS}) +# include_directories(${_INCLUDE_DIRS}) # # where ``_INCLUDE_DIRS`` was set by:: # -# TRIBITS_ADD_LIBRARY( ... TESTONLY ...) +# tribits_add_library( ... TESTONLY ...) # # Therefore, to link to a defined ``TESTONLY`` library in any upstream # enabled package, one just needs to pass in the library name through @@ -197,7 +197,7 @@ INCLUDE(CMakeParseArguments) # ``IMPORTEDLIBS ...`` # # Specifies extra external libraries that will be linked to the executable -# using ``TARGET_LINK_LIBRARY()``. This can only be used for libraries +# using ``target_link_libraries()``. This can only be used for libraries # that are built external from this CMake project and are not provided # through a proper `TriBITS TPL`_. The latter usage of passing in # external libraries is not recommended. External libraries should be @@ -210,7 +210,7 @@ INCLUDE(CMakeParseArguments) # # If specified, selects if the test will be added in serial and/or MPI # mode. See the ``COMM`` argument in the script -# `TRIBITS_ADD_TEST()`_ for more details. +# `tribits_add_test()`_ for more details. # # ``LINKER_LANGUAGE (C|CXX|Fortran)`` # @@ -218,14 +218,14 @@ INCLUDE(CMakeParseArguments) # CMake target property ``LINKER_LANGUAGE``. TriBITS sets the default # linker language as follows:: # -# IF (${PROJECT_NAME}_ENABLE_CXX) -# SET(LINKER_LANGUAGE CXX) -# ELSEIF (${PROJECT_NAME}_ENABLE_C) -# SET(LINKER_LANGUAGE C) -# ELSE() +# if (${PROJECT_NAME}_ENABLE_CXX) +# set(LINKER_LANGUAGE CXX) +# elseif (${PROJECT_NAME}_ENABLE_C) +# set(LINKER_LANGUAGE C) +# else() # # Let CMake set the default linker language it wants based -# # on source file extensions passed into ``ADD_EXECUTABLE()``. -# ENDIF() +# # on source file extensions passed into ``add_executable()``. +# endif() # # The reason for this logic is that on some platform if you have a Fortran # or C main that links to C++ libraries, then you need the C++ compiler to @@ -238,7 +238,7 @@ INCLUDE(CMakeParseArguments) # ``TARGET_DEFINES -D -D ...`` # # Add the listed defines using -# ``TARGET_COMPILE_DEFINITIONS( ...)``. These should only +# ``target_compile_definitions( ...)``. These should only # affect the listed sources for the built executable and not other # targets. # @@ -246,20 +246,20 @@ INCLUDE(CMakeParseArguments) # # If passed in, then an install target will be added to install the built # executable into the ``${CMAKE_INSTALL_PREFIX}/bin/`` directory (see -# `Install Target (TRIBITS_ADD_EXECUTABLE())`_). +# `Install Target (tribits_add_executable())`_). # # ``ADDED_EXE_TARGET_NAME_OUT `` # # If specified, then on output the variable ```` will be # set with the name of the executable target passed to -# ``ADD_EXECUTABLE( ... )``. Having this name allows the +# ``add_executable( ... )``. Having this name allows the # calling ``CMakeLists.txt`` file access and set additional target # properties (see `Additional Executable and Source File Properties -# (TRIBITS_ADD_EXECUTABLE())`_). +# (tribits_add_executable())`_). # -# .. _Executable and Target Name (TRIBITS_ADD_EXECUTABLE()): +# .. _Executable and Target Name (tribits_add_executable()): # -# **Executable and Target Name (TRIBITS_ADD_EXECUTABLE())** +# **Executable and Target Name (tribits_add_executable())** # # By default, the full name of the executable and target name # is:: @@ -293,92 +293,92 @@ INCLUDE(CMakeParseArguments) # must be careful to pick ```` that will be sufficiently globally # unique. Please use common sense when picking non-namespaced names. # -# .. _Additional Executable and Source File Properties (TRIBITS_ADD_EXECUTABLE()): +# .. _Additional Executable and Source File Properties (tribits_add_executable()): # -# **Additional Executable and Source File Properties (TRIBITS_ADD_EXECUTABLE())** +# **Additional Executable and Source File Properties (tribits_add_executable())** # -# Once ``ADD_EXECUTABLE( ... )`` is called and this function +# Once ``add_executable( ... )`` is called and this function # exists, one can set and change properties on the ```` -# executable target using the built-in ``SET_TARGET_PROPERTIES()`` command as +# executable target using the built-in ``set_target_properties()`` command as # well as properties on any of the source files listed in ``SOURCES`` using -# the built-in ``SET_SOURCE_FILE_PROPERTIES()`` command just like in any CMake +# the built-in ``set_source_file_properties()`` command just like in any CMake # project. IF the executable is added, its name will be returned by the # argument ``ADDED_EXE_TARGET_NAME_OUT ``. For example:: # -# TRIBITS_ADD_EXECUTABLE( someExe ... +# tribits_add_executable( someExe ... # ADDED_EXE_TARGET_NAME_OUT someExe_TARGET_NAME ) # -# IF (someExe_TARGET_NAME) -# SET_TARGET_PROPERTIES( ${someExe_TARGET_NAME} +# if (someExe_TARGET_NAME) +# set_target_properties( ${someExe_TARGET_NAME} # PROPERTIES LINKER_LANGUAGE CXX ) -# ENDIF() +# endif() # -# The ``IF(someExe_TARGET_NAME)`` is needed in case the executable does not +# The ``if(someExe_TARGET_NAME)`` is needed in case the executable does not # get added for some reason (see `Formal Arguments -# (TRIBITS_ADD_EXECUTABLE())`_ for logic that can result in the executable +# (tribits_add_executable())`_ for logic that can result in the executable # target not getting added). # -# .. _Install Target (TRIBITS_ADD_EXECUTABLE()): +# .. _Install Target (tribits_add_executable()): # -# **Install Target (TRIBITS_ADD_EXECUTABLE())** +# **Install Target (tribits_add_executable())** # # If ``INSTALLABLE`` is passed in, then an install target using the built-in -# CMake command ``INSTALL(TARGETS ...)`` is added to install +# CMake command ``install(TARGETS ...)`` is added to install # the built executable into the ``${CMAKE_INSTALL_PREFIX}/bin/`` directory # (actual install directory path is determined by # ``${PROJECT_NAME}_INSTALL_RUNTIME_DIR``, see `Setting the install prefix`_). # -FUNCTION(TRIBITS_ADD_EXECUTABLE EXE_NAME) +function(tribits_add_executable EXE_NAME) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("") - MESSAGE("TRIBITS_ADD_EXECUTABLE: ${EXE_NAME} ${ARGN}") - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("") + message("TRIBITS_ADD_EXECUTABLE: ${EXE_NAME} ${ARGN}") + endif() # # Confirm that package and subpackage macros/functions have been called inteh correct order # - IF (CURRENTLY_PROCESSING_SUBPACKAGE) + if (CURRENTLY_PROCESSING_SUBPACKAGE) # This is a subpackage being processed - IF(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_SUBPACKAGE() before TRIBITS_ADD_EXECUTABLE()" + if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_subpackage() before tribits_add_executable()" " in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - IF(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_ADD_EXECUTABLE() before " - " TRIBITS_SUBPACKAGE_POSTPROCESS() in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_add_executable() before " + " tribits_subpackage_postprocess() in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") + endif() - ELSE() + else() # This is a package being processed - IF(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_PACKAGE() or TRIBITS_PACKAGE_DECL() before" - " TRIBITS_ADD_EXECUTABLE() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + if(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_package() or tribits_package_decl() before" + " tribits_add_executable() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() - IF(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_ADD_EXECUTABLE() before " - " TRIBITS_PACKAGE_POSTPROCESS() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + if(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_add_executable() before " + " tribits_package_postprocess() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() - ENDIF() + endif() # # A) Parse the input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -390,124 +390,124 @@ FUNCTION(TRIBITS_ADD_EXECUTABLE EXE_NAME) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - IF(PARSE_ADDED_EXE_TARGET_NAME_OUT) - SET(${PARSE_ADDED_EXE_TARGET_NAME_OUT} PARENT_SCOPE) - ENDIF() + if(PARSE_ADDED_EXE_TARGET_NAME_OUT) + set(${PARSE_ADDED_EXE_TARGET_NAME_OUT} PARENT_SCOPE) + endif() # # B) Exclude building the test executable based on some criteria # - SET(ADD_THE_TEST FALSE) - SET(TEST_NAME ${EXE_NAME}) # For error message - TRIBITS_ADD_TEST_PROCESS_CATEGORIES(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() - SET(TEST_NAME) - - SET(ADD_THE_TEST FALSE) - TRIBITS_ADD_TEST_PROCESS_HOST_HOSTTYPE(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() - - TRIBITS_PROCESS_COMM_ARGS(ADD_SERIAL_EXE ADD_MPI_EXE ${PARSE_COMM}) - IF (NOT ADD_SERIAL_EXE AND NOT ADD_MPI_EXE) - RETURN() - ENDIF() + set(ADD_THE_TEST FALSE) + set(TEST_NAME ${EXE_NAME}) # For error message + tribits_add_test_process_categories(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() + set(TEST_NAME) + + set(ADD_THE_TEST FALSE) + tribits_add_test_process_host_hosttype(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() + + tribits_process_comm_args(ADD_SERIAL_EXE ADD_MPI_EXE ${PARSE_COMM}) + if (NOT ADD_SERIAL_EXE AND NOT ADD_MPI_EXE) + return() + endif() # # C) Add the executable # - SET(LIBRARY_NAME_PREFIX "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}") + set(LIBRARY_NAME_PREFIX "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}") - IF (NOT TRIBITS_ADD_EXECUTABLE_UNIT_TESTING) - TRIBITS_INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING + if (NOT TRIBITS_ADD_EXECUTABLE_UNIT_TESTING) + tribits_include_directories(REQUIRED_DURING_INSTALLATION_TESTING ${${PACKAGE_NAME}_INCLUDE_DIRS}) -# SET_PROPERTY(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS +# set_property(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS # ${${PACKAGE_NAME}_LIBRARY_DIRS}) - ENDIF() + endif() - SET (EXE_SOURCES) - SET(EXE_BINARY_NAME ${EXE_NAME}) + set (EXE_SOURCES) + set(EXE_BINARY_NAME ${EXE_NAME}) # If requested create a modifier for the name that will be inserted between # the package name and the given name or exe_name for the test - IF(PARSE_ADD_DIR_TO_NAME) - SET(DIRECTORY_NAME "") - TRIBITS_CREATE_NAME_FROM_CURRENT_SOURCE_DIRECTORY(DIRECTORY_NAME) - SET(EXE_BINARY_NAME ${DIRECTORY_NAME}_${EXE_BINARY_NAME}) - ENDIF() + if(PARSE_ADD_DIR_TO_NAME) + set(DIRECTORY_NAME "") + tribits_create_name_from_current_source_directory(DIRECTORY_NAME) + set(EXE_BINARY_NAME ${DIRECTORY_NAME}_${EXE_BINARY_NAME}) + endif() - IF(DEFINED PACKAGE_NAME AND NOT PARSE_NOEXEPREFIX) - SET(EXE_BINARY_NAME ${PACKAGE_NAME}_${EXE_BINARY_NAME}) - ENDIF() + if(DEFINED PACKAGE_NAME AND NOT PARSE_NOEXEPREFIX) + set(EXE_BINARY_NAME ${PACKAGE_NAME}_${EXE_BINARY_NAME}) + endif() # Exclude the build if requested - IF (${EXE_BINARY_NAME}_EXE_DISABLE) - MESSAGE("-- " + if (${EXE_BINARY_NAME}_EXE_DISABLE) + message("-- " "${EXE_BINARY_NAME} EXE NOT being built due to ${EXE_BINARY_NAME}_EXE_DISABLE=" "'${${EXE_BINARY_NAME}_EXE_DISABLE}'") - RETURN() - ENDIF() + return() + endif() # If exe is in subdirectory prepend that dir name to the source files - IF(PARSE_DIRECTORY ) - FOREACH( SOURCE_FILE ${PARSE_SOURCES} ) - IF(IS_ABSOLUTE ${SOURCE_FILE}) - SET (EXE_SOURCES ${EXE_SOURCES} ${SOURCE_FILE}) - ELSE() - SET (EXE_SOURCES ${EXE_SOURCES} ${PARSE_DIRECTORY}/${SOURCE_FILE}) - ENDIF() - ENDFOREACH( ) - ELSE() - FOREACH( SOURCE_FILE ${PARSE_SOURCES} ) - SET (EXE_SOURCES ${EXE_SOURCES} ${SOURCE_FILE}) - ENDFOREACH( ) - ENDIF() + if(PARSE_DIRECTORY ) + foreach( SOURCE_FILE ${PARSE_SOURCES} ) + if(IS_ABSOLUTE ${SOURCE_FILE}) + set (EXE_SOURCES ${EXE_SOURCES} ${SOURCE_FILE}) + else() + set (EXE_SOURCES ${EXE_SOURCES} ${PARSE_DIRECTORY}/${SOURCE_FILE}) + endif() + endforeach( ) + else() + foreach( SOURCE_FILE ${PARSE_SOURCES} ) + set (EXE_SOURCES ${EXE_SOURCES} ${SOURCE_FILE}) + endforeach( ) + endif() # Assert that TESTONLYLIBS only contains TESTONLY libs! - FOREACH(TESTONLYLIB ${PARSE_TESTONLYLIBS}) - SET(PREFIXED_LIB "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${TESTONLYLIB}") - IF (NOT ${PREFIXED_LIB}_INCLUDE_DIRS) - MESSAGE(FATAL_ERROR "ERROR: '${TESTONLYLIB}' in TESTONLYLIBS not a TESTONLY lib!" + foreach(TESTONLYLIB ${PARSE_TESTONLYLIBS}) + set(PREFIXED_LIB "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${TESTONLYLIB}") + if (NOT ${PREFIXED_LIB}_INCLUDE_DIRS) + message(FATAL_ERROR "ERROR: '${TESTONLYLIB}' in TESTONLYLIBS not a TESTONLY lib!" " If this a regular library in this SE package or in an dependent upstream SE" " package then TriBITS will link automatically to it. If you remove this and it" " does not link, then you need to add a new SE package dependency to" " this SE package's dependencies file" " ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/Dependencies.cmake") - ELSEIF(PARSE_INSTALLABLE) - MESSAGE(FATAL_ERROR "ERROR: TESTONLY lib '${TESTONLYLIB}' not allowed with" + elseif(PARSE_INSTALLABLE) + message(FATAL_ERROR "ERROR: TESTONLY lib '${TESTONLYLIB}' not allowed with" " INSTALLABLE executable! An INSTALLABLE executable can only depend on" " non-TESTONLY libraries! Otherwise, when shared libs are used, and" " TESTONLY library would not be installed and the installed executable" " would be unusable!" ) - ENDIF() - ENDFOREACH() + endif() + endforeach() # Assert that IMPORTEDLIBS are not TESTONLY libs are not regular package # libs! - FOREACH(IMPORTEDLIB ${PARSE_IMPORTEDLIBS}) - SET(PREFIXED_LIB "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${IMPORTEDLIB}") - IF (${PREFIXED_LIB}_INCLUDE_DIRS) - MESSAGE(FATAL_ERROR + foreach(IMPORTEDLIB ${PARSE_IMPORTEDLIBS}) + set(PREFIXED_LIB "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${IMPORTEDLIB}") + if (${PREFIXED_LIB}_INCLUDE_DIRS) + message(FATAL_ERROR "ERROR: Lib '${IMPORTEDLIB}' being passed through" " IMPORTEDLIBS is not allowed to be a TESTONLY lib!" " Use TESTONLYLIBS instead!" ) - ENDIF() - LIST(FIND ${PACKAGE_NAME}_LIBRARIES ${PREFIXED_LIB} FOUND_IDX) - IF (NOT FOUND_IDX EQUAL -1) - MESSAGE(FATAL_ERROR + endif() + list(FIND ${PACKAGE_NAME}_LIBRARIES ${PREFIXED_LIB} FOUND_IDX) + if (NOT FOUND_IDX EQUAL -1) + message(FATAL_ERROR "ERROR: Lib '${IMPORTEDLIB}' in IMPORTEDLIBS is in" " this SE package and is *not* an external lib!" " TriBITS takes care of linking against libs the current" " SE package automatically. Please remove '${IMPORTEDLIB}' from IMPORTEDLIBS!") - ELSEIF (TARGET ${PREFIXED_LIB}) - MESSAGE(FATAL_ERROR + elseif (TARGET ${PREFIXED_LIB}) + message(FATAL_ERROR "ERROR: Lib '${IMPORTEDLIB}' being passed through" " IMPORTEDLIBS is *not* an external library but instead is a library" " defined in this CMake project!" @@ -516,19 +516,19 @@ FUNCTION(TRIBITS_ADD_EXECUTABLE EXE_NAME) " package then add the SE package name for that library to the appropriate" " list in this SE package's dependencies file" " ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/Dependencies.cmake") - ENDIF() - ENDFOREACH() + endif() + endforeach() # Convert from old DEPLIBS to TESTONLYLIBS and IMPORTEDLIBS - FOREACH(DEPLIB ${PARSE_DEPLIBS}) - SET(PREFIXED_LIB "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${DEPLIB}") - IF (${PREFIXED_LIB}_INCLUDE_DIRS) - MESSAGE(WARNING "WARNING: Passing TESTONLY lib '${DEPLIB}' through DEPLIBS" + foreach(DEPLIB ${PARSE_DEPLIBS}) + set(PREFIXED_LIB "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${DEPLIB}") + if (${PREFIXED_LIB}_INCLUDE_DIRS) + message(WARNING "WARNING: Passing TESTONLY lib '${DEPLIB}' through DEPLIBS" " is deprecated! Instead, please pass through TESTONLYLIBS instead!" " DEPLIBS is deprecated!") - LIST(APPEND PARSE_TESTONLYLIBS ${DEPLIB}) - ELSEIF (TARGET ${PREFIXED_LIB}) - MESSAGE(WARNING "WARNING: Passing non-TESTONLY lib '${DEPLIB}' through DEPLIBS" + list(APPEND PARSE_TESTONLYLIBS ${DEPLIB}) + elseif (TARGET ${PREFIXED_LIB}) + message(WARNING "WARNING: Passing non-TESTONLY lib '${DEPLIB}' through DEPLIBS" " is deprecated! The library '${DEPLIB}' appears to be a" " library defined in this CMake project." " TriBITS takes care of linking against libraries in dependent upstream" @@ -537,155 +537,155 @@ FUNCTION(TRIBITS_ADD_EXECUTABLE EXE_NAME) " package, then add the SE package name to the appropriate category" " in this SE package's dependencies file: " " ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/Dependencies.cmake") - ELSE() - MESSAGE(WARNING "WARNING: Passing external lib '${DEPLIB}' through" + else() + message(WARNING "WARNING: Passing external lib '${DEPLIB}' through" " DEPLIBS is deprecated! Instead, pass through IMPORTEDLIBS!" " DEPLIBS is deprecated!" " Please note that only external libs are allowed to be passed through" " IMPORTEDLIBS.") - LIST(APPEND PARSE_IMPORTEDLIBS ${DEPLIB}) - ENDIF() - ENDFOREACH() - - FOREACH(TESTONLYLIB_IN ${PARSE_TESTONLYLIBS}) - SET(TESTONLYLIB "${LIBRARY_NAME_PREFIX}${TESTONLYLIB_IN}") - IF (${TESTONLYLIB}_INCLUDE_DIRS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Adding include directories ${TESTONLYLIB}_INCLUDE_DIRS ...") - ENDIF() - INCLUDE_DIRECTORIES(${${TESTONLYLIB}_INCLUDE_DIRS}) - ENDIF() - ENDFOREACH() - - IF (PARSE_DEFINES) - MESSAGE(WARNING "WARNING: Passing extra defines through 'DEFINES' ${PARSE_DEFINES}" + list(APPEND PARSE_IMPORTEDLIBS ${DEPLIB}) + endif() + endforeach() + + foreach(TESTONLYLIB_IN ${PARSE_TESTONLYLIBS}) + set(TESTONLYLIB "${LIBRARY_NAME_PREFIX}${TESTONLYLIB_IN}") + if (${TESTONLYLIB}_INCLUDE_DIRS) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Adding include directories ${TESTONLYLIB}_INCLUDE_DIRS ...") + endif() + include_directories(${${TESTONLYLIB}_INCLUDE_DIRS}) + endif() + endforeach() + + if (PARSE_DEFINES) + message(WARNING "WARNING: Passing extra defines through 'DEFINES' ${PARSE_DEFINES}" " is deprecated. Instead, pass them through 'TARGET_DEFINES'. The 'DEFINES'" - " argument was incorrectly implemented by calling ADD_DEFINITIONS() which has" + " argument was incorrectly implemented by calling add_definitions() which has" " directory scope and not function scope as was documented. This resulted in" " confusing behavior. If one wishes to set defines at the directly level," - " just call ADD_DEFINITIONS() directly.") - ADD_DEFINITIONS(${PARSE_DEFINES}) - ENDIF() - - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("TRIBITS_ADD_EXECUTABLE: ADD_EXECUTABLE(${EXE_BINARY_NAME} ${EXE_SOURCES})") - ENDIF() - ADD_EXECUTABLE(${EXE_BINARY_NAME} ${EXE_SOURCES}) - APPEND_GLOBAL_SET(${PARENT_PACKAGE_NAME}_ALL_TARGETS ${EXE_BINARY_NAME}) - - IF(PARSE_ADDED_EXE_TARGET_NAME_OUT) - SET(${PARSE_ADDED_EXE_TARGET_NAME_OUT} ${EXE_BINARY_NAME} PARENT_SCOPE) - ENDIF() - - IF (PARSE_TARGET_DEFINES) - TARGET_COMPILE_DEFINITIONS(${EXE_BINARY_NAME} PUBLIC ${PARSE_TARGET_DEFINES}) - ENDIF() - - IF(PARSE_NOEXESUFFIX AND NOT WIN32) - SET_TARGET_PROPERTIES(${EXE_BINARY_NAME} PROPERTIES SUFFIX "") - ELSE() - SET_TARGET_PROPERTIES(${EXE_BINARY_NAME} PROPERTIES SUFFIX + " just call add_definitions() directly.") + add_definitions(${PARSE_DEFINES}) + endif() + + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("TRIBITS_ADD_EXECUTABLE: add_executable(${EXE_BINARY_NAME} ${EXE_SOURCES})") + endif() + add_executable(${EXE_BINARY_NAME} ${EXE_SOURCES}) + append_global_set(${PARENT_PACKAGE_NAME}_ALL_TARGETS ${EXE_BINARY_NAME}) + + if(PARSE_ADDED_EXE_TARGET_NAME_OUT) + set(${PARSE_ADDED_EXE_TARGET_NAME_OUT} ${EXE_BINARY_NAME} PARENT_SCOPE) + endif() + + if (PARSE_TARGET_DEFINES) + target_compile_definitions(${EXE_BINARY_NAME} PUBLIC ${PARSE_TARGET_DEFINES}) + endif() + + if(PARSE_NOEXESUFFIX AND NOT WIN32) + set_target_properties(${EXE_BINARY_NAME} PROPERTIES SUFFIX "") + else() + set_target_properties(${EXE_BINARY_NAME} PROPERTIES SUFFIX ${${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX}) - ENDIF() + endif() - TRIBITS_SET_LINKER_LANGUAGE_FROM_ARG( ${EXE_BINARY_NAME} + tribits_set_linker_language_from_arg( ${EXE_BINARY_NAME} "${PARSE_LINKER_LANGUAGE}" ) - SET(LINK_LIBS) + set(LINK_LIBS) # First, add in the passed in TESTONLY dependent libraries - IF (PARSE_TESTONLYLIBS) - FOREACH(LIB ${PARSE_TESTONLYLIBS}) - LIST(APPEND LINK_LIBS "${LIBRARY_NAME_PREFIX}${LIB}") - ENDFOREACH() - ENDIF() + if (PARSE_TESTONLYLIBS) + foreach(LIB ${PARSE_TESTONLYLIBS}) + list(APPEND LINK_LIBS "${LIBRARY_NAME_PREFIX}${LIB}") + endforeach() + endif() # Second, add the package's own regular libraries - IF(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) - LIST(APPEND LINK_LIBS ${${PACKAGE_NAME}_LIBRARIES}) - ELSE() - LIST(APPEND LINK_LIBS ${${PACKAGE_NAME}_INSTALLATION_LIBRARIES}) - ENDIF() + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) + list(APPEND LINK_LIBS ${${PACKAGE_NAME}_LIBRARIES}) + else() + list(APPEND LINK_LIBS ${${PACKAGE_NAME}_INSTALLATION_LIBRARIES}) + endif() # Third, add the IMPORTEDLIBS - IF (PARSE_IMPORTEDLIBS) - LIST(APPEND LINK_LIBS ${PARSE_IMPORTEDLIBS}) - ENDIF() + if (PARSE_IMPORTEDLIBS) + list(APPEND LINK_LIBS ${PARSE_IMPORTEDLIBS}) + endif() - # Call INCLUDE_DIRECTORIES() and LINK_DIRECTORIES(...) for upstream + # Call include_directories() and link_directories(...) for upstream # dependent Packages and TPLs and accumulate the list of libraries that will # need to be linked to. - IF(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING AND NOT ${PACKAGE_NAME}_INCLUDE_DIRS ) # No libraries have been added for this package so # add the upstream package and TPL includes and libraries - TRIBITS_SORT_AND_APPEND_PACKAGE_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_package_include_and_link_dirs_and_libs( ${PACKAGE_NAME} LIB LINK_LIBS) - TRIBITS_SORT_AND_APPEND_TPL_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_tpl_include_and_link_dirs_and_libs( ${PACKAGE_NAME} LIB LINK_LIBS) - ENDIF() + endif() - TRIBITS_SORT_AND_APPEND_PACKAGE_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_package_include_and_link_dirs_and_libs( ${PACKAGE_NAME} TEST LINK_LIBS) - IF(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) - TRIBITS_SORT_AND_APPEND_TPL_INCLUDE_AND_LINK_DIRS_AND_LIBS( + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) + tribits_sort_and_append_tpl_include_and_link_dirs_and_libs( ${PACKAGE_NAME} TEST LINK_LIBS) - ELSE() - LIST(APPEND LINK_LIBS ${${PACKAGE_NAME}_INSTALLATION_TPL_LIBRARIES}) - ENDIF() + else() + list(APPEND LINK_LIBS ${${PACKAGE_NAME}_INSTALLATION_TPL_LIBRARIES}) + endif() # Last, add last_lib to get extra link options on the link line - IF (${PROJECT_NAME}_EXTRA_LINK_FLAGS) - LIST(APPEND LINK_LIBS last_lib) - ENDIF() + if (${PROJECT_NAME}_EXTRA_LINK_FLAGS) + list(APPEND LINK_LIBS last_lib) + endif() - IF (${PROJECT_NAME}_DUMP_LINK_LIBS) - MESSAGE("-- ${EXE_NAME}:LINK_LIBS='${LINK_LIBS}'") - ENDIF() + if (${PROJECT_NAME}_DUMP_LINK_LIBS) + message("-- ${EXE_NAME}:LINK_LIBS='${LINK_LIBS}'") + endif() - TARGET_LINK_LIBRARIES(${EXE_BINARY_NAME} ${LINK_LIBS}) + target_link_libraries(${EXE_BINARY_NAME} PUBLIC ${LINK_LIBS}) - ASSERT_DEFINED(${PROJECT_NAME}_LINK_SEARCH_START_STATIC) - IF (${PROJECT_NAME}_LINK_SEARCH_START_STATIC) - #MESSAGE("${EXE_BINARY_NAME}: Adding property LINK_SEARCH_START_STATIC") - SET_PROPERTY(TARGET ${EXE_BINARY_NAME} PROPERTY LINK_SEARCH_START_STATIC 1) - ENDIF() + assert_defined(${PROJECT_NAME}_LINK_SEARCH_START_STATIC) + if (${PROJECT_NAME}_LINK_SEARCH_START_STATIC) + #message("${EXE_BINARY_NAME}: Adding property LINK_SEARCH_START_STATIC") + set_property(TARGET ${EXE_BINARY_NAME} PROPERTY LINK_SEARCH_START_STATIC 1) + endif() - IF(PARSE_DIRECTORY) - SET_TARGET_PROPERTIES( ${EXE_BINARY_NAME} PROPERTIES + if(PARSE_DIRECTORY) + set_target_properties( ${EXE_BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PARSE_DIRECTORY} ) - ENDIF() + endif() - SET_PROPERTY(TARGET ${EXE_BINARY_NAME} APPEND PROPERTY + set_property(TARGET ${EXE_BINARY_NAME} APPEND PROPERTY LABELS ${PACKAGE_NAME}Exes ${PARENT_PACKAGE_NAME}Exes) - IF(${PROJECT_NAME}_INSTALL_EXECUTABLES AND PARSE_INSTALLABLE) - INSTALL( + if(${PROJECT_NAME}_INSTALL_EXECUTABLES AND PARSE_INSTALLABLE) + install( TARGETS ${EXE_BINARY_NAME} EXPORT ${PROJECT_NAME} DESTINATION ${${PROJECT_NAME}_INSTALL_RUNTIME_DIR} COMPONENT ${PACKAGE_NAME} ) - ENDIF() -ENDFUNCTION() + endif() +endfunction() # # Setup include directories and library dependencies # -#IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) -# MESSAGE("TribitsAddExecutable.cmake") -# PRINT_VAR(${PACKAGE_NAME}_INCLUDE_DIRS) -# PRINT_VAR(${PACKAGE_NAME}_LIBRARY_DIRS) -#ENDIF() +#if (${PROJECT_NAME}_VERBOSE_CONFIGURE) +# message("TribitsAddExecutable.cmake") +# print_var(${PACKAGE_NAME}_INCLUDE_DIRS) +# print_var(${PACKAGE_NAME}_LIBRARY_DIRS) +#endif() # -#IF (NOT TRIBITS_ADD_EXECUTABLE_UNIT_TESTING) -# INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING +#if (NOT TRIBITS_ADD_EXECUTABLE_UNIT_TESTING) +# include_directories(REQUIRED_DURING_INSTALLATION_TESTING # ${${PACKAGE_NAME}_INCLUDE_DIRS}) -# SET_PROPERTY(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS +# set_property(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS # ${${PACKAGE_NAME}_LIBRARY_DIRS}) -#ENDIF() +#endif() diff --git a/cmake/tribits/core/package_arch/TribitsAddExecutableAndTest.cmake b/cmake/tribits/core/package_arch/TribitsAddExecutableAndTest.cmake index e0af3e53d685..46b2b13a088d 100644 --- a/cmake/tribits/core/package_arch/TribitsAddExecutableAndTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddExecutableAndTest.cmake @@ -38,8 +38,8 @@ # @HEADER -INCLUDE(TribitsAddExecutable) -INCLUDE(TribitsAddTest) +include(TribitsAddExecutable) +include(TribitsAddTest) # @@ -47,46 +47,46 @@ INCLUDE(TribitsAddTest) # -MACRO(TRIBITS_FWD_PARSE_ARG VAR_TO_SET_OUT ARGNAME) - IF (PARSE_${ARGNAME}) - SET(${VAR_TO_SET_OUT} ${${VAR_TO_SET_OUT}} ${ARGNAME} ${PARSE_${ARGNAME}}) - ENDIF() -ENDMACRO() +macro(tribits_fwd_parse_arg VAR_TO_SET_OUT ARGNAME) + if (PARSE_${ARGNAME}) + set(${VAR_TO_SET_OUT} ${${VAR_TO_SET_OUT}} ${ARGNAME} ${PARSE_${ARGNAME}}) + endif() +endmacro() -MACRO(TRIBITS_FWD_PARSE_OPT VAR_TO_SET_OUT OPTNAME) - IF (PARSE_${OPTNAME}) - SET(${VAR_TO_SET_OUT} ${${VAR_TO_SET_OUT}} ${OPTNAME}) - ENDIF() -ENDMACRO() +macro(tribits_fwd_parse_opt VAR_TO_SET_OUT OPTNAME) + if (PARSE_${OPTNAME}) + set(${VAR_TO_SET_OUT} ${${VAR_TO_SET_OUT}} ${OPTNAME}) + endif() +endmacro() -MACRO(TRIBITS_ADD_EXECUTABLE_WRAPPER) - IF (TRIBITS_ADD_EXECUTABLE_AND_TEST_TEST_MODE) - SET(TRIBITS_ADD_EXECUTABLE_CAPTURE_ARGS ${ARGN} CACHE INTERNAL "") - ELSE() - TRIBITS_ADD_EXECUTABLE(${ARGN}) - ENDIF() -ENDMACRO() +macro(tribits_add_executable_wrapper) + if (TRIBITS_ADD_EXECUTABLE_AND_TEST_TEST_MODE) + set(TRIBITS_ADD_EXECUTABLE_CAPTURE_ARGS ${ARGN} CACHE INTERNAL "") + else() + tribits_add_executable(${ARGN}) + endif() +endmacro() -MACRO(TRIBITS_ADD_TEST_WRAPPER) - IF (TRIBITS_ADD_EXECUTABLE_AND_TEST_TEST_MODE) - SET(TRIBITS_ADD_TEST_CAPTURE_ARGS ${ARGN} CACHE INTERNAL "") - ELSE() - TRIBITS_ADD_TEST(${ARGN}) - ENDIF() -ENDMACRO() +macro(tribits_add_test_wrapper) + if (TRIBITS_ADD_EXECUTABLE_AND_TEST_TEST_MODE) + set(TRIBITS_ADD_TEST_CAPTURE_ARGS ${ARGN} CACHE INTERNAL "") + else() + tribits_add_test(${ARGN}) + endif() +endmacro() # -# @FUNCTION: TRIBITS_ADD_EXECUTABLE_AND_TEST() +# @FUNCTION: tribits_add_executable_and_test() # # Add an executable and a test (or several tests) all in one shot (just calls -# `TRIBITS_ADD_EXECUTABLE()`_ followed by `TRIBITS_ADD_TEST()`_). +# `tribits_add_executable()`_ followed by `tribits_add_test()`_). # # Usage:: # -# TRIBITS_ADD_EXECUTABLE_AND_TEST( +# tribits_add_executable_and_test( # [NOEXEPREFIX] [NOEXESUFFIX] [ADD_DIR_TO_NAME] # SOURCES ... # [NAME | NAME_POSTFIX ] @@ -118,40 +118,40 @@ ENDMACRO() # ) # # This function takes a fairly common set of arguments to -# `TRIBITS_ADD_EXECUTABLE()`_ and `TRIBITS_ADD_TEST()`_ but not the full set -# passed to ``TRIBITS_ADD_TEST()``. See the documentation for -# `TRIBITS_ADD_EXECUTABLE()`_ and `TRIBITS_ADD_TEST()`_ to see which arguments +# `tribits_add_executable()`_ and `tribits_add_test()`_ but not the full set +# passed to ``tribits_add_test()``. See the documentation for +# `tribits_add_executable()`_ and `tribits_add_test()`_ to see which arguments # are accepted by which functions. # # Arguments that are specific to this function and not directly passed on to -# ``TRIBITS_ADD_EXECUTABLE()`` or ``TRIBITS_ADD_TEST()`` include: +# ``tribits_add_executable()`` or ``tribits_add_test()`` include: # # ``XHOST_TEST ...`` # # When specified, this disables just running the tests for the named hosts # ````, ```` etc. but still builds the executable for the # test. These are just passed in through the ``XHOST`` argument to -# ``TRIBITS_ADD_TEST()``. +# ``tribits_add_test()``. # # ``XHOSTTYPE_TEST ...`` # # When specified, this disables just running the tests for the named host # types ````, ````, ..., but still builds the # executable for the test. These are just passed in through the -# ``XHOSTTYPE`` argument to ``TRIBITS_ADD_TEST()``. +# ``XHOSTTYPE`` argument to ``tribits_add_test()``. # # This is the function to use for simple test executables that you want to run # that either takes no arguments or just a simple set of arguments passed in # through ``ARGS``. For more flexibility, just use -# ``TRIBITS_ADD_EXECUTABLE()`` followed by ``TRIBITS_ADD_TEST()``. +# ``tribits_add_executable()`` followed by ``tribits_add_test()``. # -FUNCTION(TRIBITS_ADD_EXECUTABLE_AND_TEST EXE_NAME) +function(tribits_add_executable_and_test EXE_NAME) # # A) Parse the input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -163,95 +163,95 @@ FUNCTION(TRIBITS_ADD_EXECUTABLE_AND_TEST EXE_NAME) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("") - MESSAGE("TRIBITS_ADD_EXECUTABLE_AND_TEST: ${EXE_NAME} ${ARGN}") - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("") + message("TRIBITS_ADD_EXECUTABLE_AND_TEST: ${EXE_NAME} ${ARGN}") + endif() - IF(PARSE_ADDED_EXE_TARGET_NAME_OUT) - SET(${PARSE_ADDED_EXE_TARGET_NAME_OUT} "" PARENT_SCOPE) - ENDIF() - IF(PARSE_ADDED_TESTS_NAMES_OUT) - SET(${PARSE_ADDED_TESTS_NAMES_OUT} "" PARENT_SCOPE) - ENDIF() + if(PARSE_ADDED_EXE_TARGET_NAME_OUT) + set(${PARSE_ADDED_EXE_TARGET_NAME_OUT} "" PARENT_SCOPE) + endif() + if(PARSE_ADDED_TESTS_NAMES_OUT) + set(${PARSE_ADDED_TESTS_NAMES_OUT} "" PARENT_SCOPE) + endif() # # B) Arguments common to both # - SET(COMMON_CALL_ARGS "") - TRIBITS_FWD_PARSE_ARG(COMMON_CALL_ARGS COMM) - TRIBITS_FWD_PARSE_ARG(COMMON_CALL_ARGS CATEGORIES) - TRIBITS_FWD_PARSE_ARG(COMMON_CALL_ARGS HOST) - TRIBITS_FWD_PARSE_ARG(COMMON_CALL_ARGS XHOST) - TRIBITS_FWD_PARSE_ARG(COMMON_CALL_ARGS HOSTTYPE) - TRIBITS_FWD_PARSE_ARG(COMMON_CALL_ARGS XHOSTTYPE) - TRIBITS_FWD_PARSE_ARG(COMMON_CALL_ARGS EXCLUDE_IF_NOT_TRUE) - TRIBITS_FWD_PARSE_OPT(COMMON_CALL_ARGS NOEXEPREFIX) - TRIBITS_FWD_PARSE_OPT(COMMON_CALL_ARGS NOEXESUFFIX) + set(COMMON_CALL_ARGS "") + tribits_fwd_parse_arg(COMMON_CALL_ARGS COMM) + tribits_fwd_parse_arg(COMMON_CALL_ARGS CATEGORIES) + tribits_fwd_parse_arg(COMMON_CALL_ARGS HOST) + tribits_fwd_parse_arg(COMMON_CALL_ARGS XHOST) + tribits_fwd_parse_arg(COMMON_CALL_ARGS HOSTTYPE) + tribits_fwd_parse_arg(COMMON_CALL_ARGS XHOSTTYPE) + tribits_fwd_parse_arg(COMMON_CALL_ARGS EXCLUDE_IF_NOT_TRUE) + tribits_fwd_parse_opt(COMMON_CALL_ARGS NOEXEPREFIX) + tribits_fwd_parse_opt(COMMON_CALL_ARGS NOEXESUFFIX) # - # C) TribitsAddExecutable(...) + # C) tribitsaddexecutable(...) # - SET(CALL_ARGS "") - TRIBITS_FWD_PARSE_ARG(CALL_ARGS SOURCES) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS DEPLIBS) # Deprecated - TRIBITS_FWD_PARSE_ARG(CALL_ARGS TESTONLYLIBS) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS IMPORTEDLIBS) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS DIRECTORY) - TRIBITS_FWD_PARSE_OPT(CALL_ARGS ADD_DIR_TO_NAME) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS LINKER_LANGUAGE) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS TARGET_DEFINES) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS DEFINES) - TRIBITS_FWD_PARSE_OPT(CALL_ARGS INSTALLABLE) - IF (PARSE_ADDED_EXE_TARGET_NAME_OUT) - LIST(APPEND CALL_ARGS ADDED_EXE_TARGET_NAME_OUT ADDED_EXE_TARGET_NAME) - ENDIF() + set(CALL_ARGS "") + tribits_fwd_parse_arg(CALL_ARGS SOURCES) + tribits_fwd_parse_arg(CALL_ARGS DEPLIBS) # Deprecated + tribits_fwd_parse_arg(CALL_ARGS TESTONLYLIBS) + tribits_fwd_parse_arg(CALL_ARGS IMPORTEDLIBS) + tribits_fwd_parse_arg(CALL_ARGS DIRECTORY) + tribits_fwd_parse_opt(CALL_ARGS ADD_DIR_TO_NAME) + tribits_fwd_parse_arg(CALL_ARGS LINKER_LANGUAGE) + tribits_fwd_parse_arg(CALL_ARGS TARGET_DEFINES) + tribits_fwd_parse_arg(CALL_ARGS DEFINES) + tribits_fwd_parse_opt(CALL_ARGS INSTALLABLE) + if (PARSE_ADDED_EXE_TARGET_NAME_OUT) + list(APPEND CALL_ARGS ADDED_EXE_TARGET_NAME_OUT ADDED_EXE_TARGET_NAME) + endif() - TRIBITS_ADD_EXECUTABLE_WRAPPER(${EXE_NAME} ${COMMON_CALL_ARGS} ${CALL_ARGS}) + tribits_add_executable_wrapper(${EXE_NAME} ${COMMON_CALL_ARGS} ${CALL_ARGS}) - IF(PARSE_ADDED_EXE_TARGET_NAME_OUT) - SET( ${PARSE_ADDED_EXE_TARGET_NAME_OUT} "${ADDED_EXE_TARGET_NAME}" + if(PARSE_ADDED_EXE_TARGET_NAME_OUT) + set( ${PARSE_ADDED_EXE_TARGET_NAME_OUT} "${ADDED_EXE_TARGET_NAME}" PARENT_SCOPE ) - ENDIF() + endif() # - # D) TribitsAddTest(...) + # D) tribitsaddtest(...) # - SET(CALL_ARGS "") - TRIBITS_FWD_PARSE_ARG(CALL_ARGS NAME) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS NAME_POSTFIX) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS DIRECTORY) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS KEYWORDS) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS NUM_MPI_PROCS) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS ARGS) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS PASS_REGULAR_EXPRESSION) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS FAIL_REGULAR_EXPRESSION) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS ENVIRONMENT) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS DISABLED) - TRIBITS_FWD_PARSE_OPT(CALL_ARGS STANDARD_PASS_OUTPUT) - TRIBITS_FWD_PARSE_OPT(CALL_ARGS WILL_FAIL) - TRIBITS_FWD_PARSE_ARG(CALL_ARGS TIMEOUT) - TRIBITS_FWD_PARSE_OPT(CALL_ARGS ADD_DIR_TO_NAME) - TRIBITS_FWD_PARSE_OPT(CALL_ARGS ADDED_TESTS_NAMES_OUT) - IF (PARSE_XHOST_TEST) - SET(CALL_ARGS ${CALL_ARGS} XHOST ${PARSE_XHOST_TEST}) - ENDIF() - IF (PARSE_XHOSTTYPE_TEST) - SET(CALL_ARGS ${CALL_ARGS} XHOSTTYPE ${PARSE_XHOSTTYPE_TEST}) - ENDIF() - IF (PARSE_ADDED_TESTS_NAMES_OUT) - LIST(APPEND CALL_ARGS ADDED_TESTS_NAMES_OUT ADDED_TESTS_NAMES) - ENDIF() + set(CALL_ARGS "") + tribits_fwd_parse_arg(CALL_ARGS NAME) + tribits_fwd_parse_arg(CALL_ARGS NAME_POSTFIX) + tribits_fwd_parse_arg(CALL_ARGS DIRECTORY) + tribits_fwd_parse_arg(CALL_ARGS KEYWORDS) + tribits_fwd_parse_arg(CALL_ARGS NUM_MPI_PROCS) + tribits_fwd_parse_arg(CALL_ARGS ARGS) + tribits_fwd_parse_arg(CALL_ARGS PASS_REGULAR_EXPRESSION) + tribits_fwd_parse_arg(CALL_ARGS FAIL_REGULAR_EXPRESSION) + tribits_fwd_parse_arg(CALL_ARGS ENVIRONMENT) + tribits_fwd_parse_arg(CALL_ARGS DISABLED) + tribits_fwd_parse_opt(CALL_ARGS STANDARD_PASS_OUTPUT) + tribits_fwd_parse_opt(CALL_ARGS WILL_FAIL) + tribits_fwd_parse_arg(CALL_ARGS TIMEOUT) + tribits_fwd_parse_opt(CALL_ARGS ADD_DIR_TO_NAME) + tribits_fwd_parse_opt(CALL_ARGS ADDED_TESTS_NAMES_OUT) + if (PARSE_XHOST_TEST) + set(CALL_ARGS ${CALL_ARGS} XHOST ${PARSE_XHOST_TEST}) + endif() + if (PARSE_XHOSTTYPE_TEST) + set(CALL_ARGS ${CALL_ARGS} XHOSTTYPE ${PARSE_XHOSTTYPE_TEST}) + endif() + if (PARSE_ADDED_TESTS_NAMES_OUT) + list(APPEND CALL_ARGS ADDED_TESTS_NAMES_OUT ADDED_TESTS_NAMES) + endif() - TRIBITS_ADD_TEST_WRAPPER(${EXE_NAME} ${COMMON_CALL_ARGS} ${CALL_ARGS}) + tribits_add_test_wrapper(${EXE_NAME} ${COMMON_CALL_ARGS} ${CALL_ARGS}) - IF(PARSE_ADDED_TESTS_NAMES_OUT) - SET(${PARSE_ADDED_TESTS_NAMES_OUT} "${ADDED_TESTS_NAMES}" PARENT_SCOPE) - ENDIF() + if(PARSE_ADDED_TESTS_NAMES_OUT) + set(${PARSE_ADDED_TESTS_NAMES_OUT} "${ADDED_TESTS_NAMES}" PARENT_SCOPE) + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsAddExecutableTestHelpers.cmake b/cmake/tribits/core/package_arch/TribitsAddExecutableTestHelpers.cmake index 5ea920aa189f..1121de2f3eb1 100644 --- a/cmake/tribits/core/package_arch/TribitsAddExecutableTestHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddExecutableTestHelpers.cmake @@ -37,10 +37,10 @@ # ************************************************************************ # @HEADER -INCLUDE(AdvancedSet) -INCLUDE(MessageWrapper) +include(AdvancedSet) +include(MessageWrapper) -ADVANCED_SET( ${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX ".exe" +advanced_set( ${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX ".exe" CACHE STRING "Default exec suffix on all platforms (can be overridden by each executable added)." ) @@ -50,69 +50,69 @@ ADVANCED_SET( ${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX ".exe" # NOTE: The COMM array arguments is passed as ${ARGN} # -FUNCTION( TRIBITS_PROCESS_COMM_ARGS ADD_SERIAL_FEATURE_OUT ADD_MPI_FEATURE_OUT ) +function( tribits_process_comm_args ADD_SERIAL_FEATURE_OUT ADD_MPI_FEATURE_OUT ) - SET(COMM_ARRAY ${ARGN}) + set(COMM_ARRAY ${ARGN}) - IF (COMM_ARRAY) - SET(ADD_SERIAL_FEATURE OFF) - SET(ADD_MPI_FEATURE OFF) - FOREACH(COMM ${COMM_ARRAY}) - IF(${COMM} STREQUAL "serial") - SET(ADD_SERIAL_FEATURE ON) - ELSEIF (${COMM} STREQUAL "mpi") - SET(ADD_MPI_FEATURE ON) - ELSE() - MESSAGE(SEND_ERROR "Error, the COMM value '${COMM}' is not valid." + if (COMM_ARRAY) + set(ADD_SERIAL_FEATURE OFF) + set(ADD_MPI_FEATURE OFF) + foreach(COMM ${COMM_ARRAY}) + if(${COMM} STREQUAL "serial") + set(ADD_SERIAL_FEATURE ON) + elseif (${COMM} STREQUAL "mpi") + set(ADD_MPI_FEATURE ON) + else() + message(SEND_ERROR "Error, the COMM value '${COMM}' is not valid." " Only 'mpi' and 'serial' are allowed.") - ENDIF() - ENDFOREACH() - ELSE() - SET(ADD_MPI_FEATURE ON) - SET(ADD_SERIAL_FEATURE ON) - ENDIF() + endif() + endforeach() + else() + set(ADD_MPI_FEATURE ON) + set(ADD_SERIAL_FEATURE ON) + endif() - IF (TPL_ENABLE_MPI) - SET(ADD_SERIAL_FEATURE OFF) - IF (NOT ADD_MPI_FEATURE) - SET(EXCLUDED_FEATURE TRUE) - ENDIF() - ELSE() - SET(ADD_MPI_FEATURE OFF) - IF (NOT ADD_SERIAL_FEATURE) - SET(EXCLUDED_FEATURE TRUE) - ENDIF() - ENDIF() + if (TPL_ENABLE_MPI) + set(ADD_SERIAL_FEATURE OFF) + if (NOT ADD_MPI_FEATURE) + set(EXCLUDED_FEATURE TRUE) + endif() + else() + set(ADD_MPI_FEATURE OFF) + if (NOT ADD_SERIAL_FEATURE) + set(EXCLUDED_FEATURE TRUE) + endif() + endif() - IF (TEST_NAME AND EXCLUDED_FEATURE) - MESSAGE_WRAPPER( + if (TEST_NAME AND EXCLUDED_FEATURE) + message_wrapper( "-- ${TEST_NAME}: NOT added test because TPL_ENABLE_MPI='${TPL_ENABLE_MPI}' and COMM='${COMM_ARRAY}'!" ) - ENDIF() + endif() - SET(${ADD_SERIAL_FEATURE_OUT} ${ADD_SERIAL_FEATURE} PARENT_SCOPE) - SET(${ADD_MPI_FEATURE_OUT} ${ADD_MPI_FEATURE} PARENT_SCOPE) + set(${ADD_SERIAL_FEATURE_OUT} ${ADD_SERIAL_FEATURE} PARENT_SCOPE) + set(${ADD_MPI_FEATURE_OUT} ${ADD_MPI_FEATURE} PARENT_SCOPE) -ENDFUNCTION() +endfunction() -FUNCTION( TRIBITS_CREATE_NAME_FROM_CURRENT_SOURCE_DIRECTORY DIRECTORY_NAME ) - SET(DIRECTORY_NAME "") +function( tribits_create_name_from_current_source_directory DIRECTORY_NAME ) + set(DIRECTORY_NAME "") #Get the unique part of the path for this test directory - STRING(REGEX REPLACE ${PACKAGE_SOURCE_DIR} "" unique_dir_path + string(REGEX REPLACE ${PACKAGE_SOURCE_DIR} "" unique_dir_path ${CMAKE_CURRENT_SOURCE_DIR}) - #strip off the preceeding "/" - STRING(LENGTH ${unique_dir_path} udp_length) - MATH(EXPR last_index "${udp_length}-1") - STRING(SUBSTRING ${unique_dir_path} 1 ${last_index} unique_dir_path) + #strip off the preceding "/" + string(LENGTH ${unique_dir_path} udp_length) + math(EXPR last_index "${udp_length}-1") + string(SUBSTRING ${unique_dir_path} 1 ${last_index} unique_dir_path) # Make the name acceptable for filesystems. This may need to be made # compatible with windows since they use a "\" instead of a "/" for # directory delimiters. I'm not sure how this will react if we encounter a # directory name with a space in it. - STRING(REGEX REPLACE "/" "_" DIRECTORY_NAME ${unique_dir_path}) + string(REGEX REPLACE "/" "_" DIRECTORY_NAME ${unique_dir_path}) - #PRINT_VAR(DIRECTORY_NAME) - SET(DIRECTORY_NAME ${DIRECTORY_NAME} PARENT_SCOPE) -ENDFUNCTION() + #print_var(DIRECTORY_NAME) + set(DIRECTORY_NAME ${DIRECTORY_NAME} PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsAddInstallGroupAndPermsFixups.cmake b/cmake/tribits/core/package_arch/TribitsAddInstallGroupAndPermsFixups.cmake index 7404720ea166..885be784ee5b 100644 --- a/cmake/tribits/core/package_arch/TribitsAddInstallGroupAndPermsFixups.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddInstallGroupAndPermsFixups.cmake @@ -1,118 +1,120 @@ -INCLUDE(Join) -INCLUDE(TribitsFilepathHelpers) -INCLUDE(AppendStringVarWithSep) +include(Join) +include(TribitsFilepathHelpers) +include(AppendStringVarWithSep) -FUNCTION(TRIBITS_RAISE_INSTALL_PERMS_MODS_NOT_SUPPORTED_ON_WINDOWS_ERROR) +function(tribits_raise_install_perms_mods_not_supported_on_windows_error) - SET(INSTALL_PERMS_SET "") - TRIBITS_APPEND_INSTALL_PERMS_VAR_NOT_SUPPORTED( + set(INSTALL_PERMS_SET "") + tribits_append_install_perms_var_not_supported( ${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE) - TRIBITS_APPEND_INSTALL_PERMS_VAR_NOT_SUPPORTED( + tribits_append_install_perms_var_not_supported( ${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE) - TRIBITS_APPEND_INSTALL_PERMS_VAR_NOT_SUPPORTED( + tribits_append_install_perms_var_not_supported( ${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE) - TRIBITS_APPEND_INSTALL_PERMS_VAR_NOT_SUPPORTED( + tribits_append_install_perms_var_not_supported( ${PROJECT_NAME}_MAKE_INSTALL_GROUP) - MESSAGE(FATAL_ERROR + message(FATAL_ERROR "ERROR: The options:\n" "${INSTALL_PERMS_SET}" "are not supported on Windows!\n" "Please remove these options and configure from scratch!" ) -ENDFUNCTION() +endfunction() # Reads and writes var INSTALL_PERMS_SET in above function -MACRO(TRIBITS_APPEND_INSTALL_PERMS_VAR_NOT_SUPPORTED VAR_NAME) - IF (NOT "${${VAR_NAME}}" STREQUAL "") - SET(INSTALL_PERMS_SET "${INSTALL_PERMS_SET} ${VAR_NAME}='${${VAR_NAME}}'\n") - ENDIF() -ENDMACRO() +macro(tribits_append_install_perms_var_not_supported VAR_NAME) + if (NOT "${${VAR_NAME}}" STREQUAL "") + set(INSTALL_PERMS_SET "${INSTALL_PERMS_SET} ${VAR_NAME}='${${VAR_NAME}}'\n") + endif() +endmacro() -FUNCTION(TRIBITS_DETERMINE_IF_SETUP_FOR_GROUP_AND_PERMS_MODIFICATIONS +function(tribits_determine_if_setup_for_group_and_perms_modifications SETUP_FOR_GROUP_AND_PERMS_MODIFICATIONS_OUT ) - IF( + if( ${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE OR ${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE OR ${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE OR (NOT "${${PROJECT_NAME}_MAKE_INSTALL_GROUP}" STREQUAL "") ) - SET(setupForGroupAndPermsModifications TRUE) - ELSE() - SET(setupForGroupAndPermsModifications FALSE) - ENDIF() + set(setupForGroupAndPermsModifications TRUE) + else() + set(setupForGroupAndPermsModifications FALSE) + endif() - IF (setupForGroupAndPermsModifications AND + if (setupForGroupAndPermsModifications AND ${PROJECT_NAME}_HOSTTYPE STREQUAL "Windows" ) - TRIBITS_RAISE_INSTALL_PERMS_MODS_NOT_SUPPORTED_ON_WINDOWS_ERROR() - ENDIF() + tribits_raise_install_perms_mods_not_supported_on_windows_error() + endif() - SET(${SETUP_FOR_GROUP_AND_PERMS_MODIFICATIONS_OUT} + set(${SETUP_FOR_GROUP_AND_PERMS_MODIFICATIONS_OUT} ${setupForGroupAndPermsModifications} PARENT_SCOPE) -ENDFUNCTION() +endfunction() -FUNCTION(TRIBITS_CONFIGURE_SET_INSTALLED_GROUP_AND_PERMS_FILE TARGET_FILE) +function(tribits_configure_set_installed_group_and_perms_file TARGET_FILE) - SET(PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR + set(PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR "${${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR}") - TRIBITS_GET_DIR_ARRAY_BELOW_BASE_DIR( + tribits_get_dir_array_below_base_dir( "${${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR}" "${CMAKE_INSTALL_PREFIX}" PROJECT_SUBDIR_PATHS_ARRAY ) - SET(PROJECT_MAKE_INSTALL_GROUP "${${PROJECT_NAME}_MAKE_INSTALL_GROUP}") + set(PROJECT_MAKE_INSTALL_GROUP "${${PROJECT_NAME}_MAKE_INSTALL_GROUP}") - SET(group_perms "") - IF (${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE) - SET(group_perms "g+rwX") - ELSEIF (${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE) - SET(group_perms "g+rX") - ENDIF() + set(group_perms "") + if (${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE) + set(group_perms "g+rwX") + elseif (${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE + OR ${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE + ) + set(group_perms "g+rX") + endif() - SET(other_perms "") - IF (${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE) - SET(other_perms "o+rX") - ENDIF() + set(other_perms "") + if (${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE) + set(other_perms "o+rX") + endif() - JOIN(PROJECT_MAKE_INSTALL_PERMS_CHANGE "," FALSE + join(PROJECT_MAKE_INSTALL_PERMS_CHANGE "," FALSE ${group_perms} ${other_perms} ) - SET(tribits_install_src + set(tribits_install_src "${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}") - CONFIGURE_FILE( + configure_file( "${tribits_install_src}/set_installed_group_and_permissions.cmake.in" "${TARGET_FILE}" @ONLY ) -ENDFUNCTION() +endfunction() -FUNCTION(TRIBITS_ADD_INSTALL_GROUP_AND_PERMS_FIXUPS) +function(tribits_add_install_group_and_perms_fixups) - TRIBITS_DETERMINE_IF_SETUP_FOR_GROUP_AND_PERMS_MODIFICATIONS( + tribits_determine_if_setup_for_group_and_perms_modifications( setupForGroupAndPermsModifications) - IF (setupForGroupAndPermsModifications) + if (setupForGroupAndPermsModifications) - SET(set_installed_group_and_permissions_file + set(set_installed_group_and_permissions_file "${PROJECT_BINARY_DIR}/set_installed_group_and_permissions.cmake") - TRIBITS_CONFIGURE_SET_INSTALLED_GROUP_AND_PERMS_FILE( + tribits_configure_set_installed_group_and_perms_file( "${set_installed_group_and_permissions_file}" ) # Fix up install for default 'install' command - INSTALL(SCRIPT "${set_installed_group_and_permissions_file}") + install(SCRIPT "${set_installed_group_and_permissions_file}") - ENDIF() + endif() -ENDFUNCTION() \ No newline at end of file +endfunction() \ No newline at end of file diff --git a/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake b/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake index 7c4a60490ece..534ef9e75d55 100644 --- a/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake @@ -37,17 +37,17 @@ # ************************************************************************ # @HEADER -INCLUDE(GlobalSet) +include(GlobalSet) # -# @MACRO: TRIBITS_ADD_OPTION_AND_DEFINE() +# @MACRO: tribits_add_option_and_define() # # Add an option and a define variable in one shot. # # Usage:: # -# TRIBITS_ADD_OPTION_AND_DEFINE( +# tribits_add_option_and_define( # "" ) # # This macro sets the user cache ``BOOL`` variable ```` and if @@ -55,25 +55,25 @@ INCLUDE(GlobalSet) # ```` to ``ON``, and otherwise sets it to ``OFF``. This is # designed to make it easy to add a user-enabled option to a configured header # file and have the define set in one shot. This would require that the -# package's configure file (see `TRIBITS_CONFIGURE_FILE()`_) have the line:: +# package's configure file (see `tribits_configure_file()`_) have the line:: # # #cmakedefine # -MACRO(TRIBITS_ADD_OPTION_AND_DEFINE USER_OPTION_NAME MACRO_DEFINE_NAME +macro(tribits_add_option_and_define USER_OPTION_NAME MACRO_DEFINE_NAME DOCSTRING DEFAULT_VALUE ) - #MESSAGE("TRIBITS_ADD_OPTION_AND_DEFINE: '${USER_OPTION_NAME}' '${MACRO_DEFINE_NAME}' '${DEFAULT_VALUE}'") - SET( ${USER_OPTION_NAME} "${DEFAULT_VALUE}" CACHE BOOL "${DOCSTRING}" ) - IF(NOT ${MACRO_DEFINE_NAME} STREQUAL "") - IF(${USER_OPTION_NAME}) - GLOBAL_SET(${MACRO_DEFINE_NAME} ON) - ELSE() - GLOBAL_SET(${MACRO_DEFINE_NAME} OFF) - ENDIF() - ENDIF() -ENDMACRO() + #message("TRIBITS_ADD_OPTION_AND_DEFINE: '${USER_OPTION_NAME}' '${MACRO_DEFINE_NAME}' '${DEFAULT_VALUE}'") + set( ${USER_OPTION_NAME} "${DEFAULT_VALUE}" CACHE BOOL "${DOCSTRING}" ) + if(NOT ${MACRO_DEFINE_NAME} STREQUAL "") + if(${USER_OPTION_NAME}) + global_set(${MACRO_DEFINE_NAME} ON) + else() + global_set(${MACRO_DEFINE_NAME} OFF) + endif() + endif() +endmacro() # 2008/10/05: rabartl: ToDo: Add an option to automatically add the macro # define to any XXX_config.h file that gets configured by -# TRIBITS_CONFIGURE_FILE(...). This will help to eliminate +# tribits_configure_file(...). This will help to eliminate # duplication. diff --git a/cmake/tribits/core/package_arch/TribitsAddTest.cmake b/cmake/tribits/core/package_arch/TribitsAddTest.cmake index ae0ed6afb1e4..9d98021f8729 100644 --- a/cmake/tribits/core/package_arch/TribitsAddTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddTest.cmake @@ -37,18 +37,18 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsAddTestHelpers) +include(TribitsAddTestHelpers) # -# @FUNCTION: TRIBITS_ADD_TEST() +# @FUNCTION: tribits_add_test() # # Add a test or a set of tests for a single executable or command using CTest -# ``ADD_TEST()``. +# ``add_test()``. # # Usage:: # -# TRIBITS_ADD_TEST( +# tribits_add_test( # [NOEXEPREFIX] [NOEXESUFFIX] # [NAME | NAME_POSTFIX ] # [DIRECTORY ] @@ -80,62 +80,62 @@ INCLUDE(TribitsAddTestHelpers) # (i.e. `${PACKAGE_NAME}_ENABLE_TESTS`_) or the parent package (if this is a # subpackage) (i.e. ``${PARENT_PACKAGE_NAME}_ENABLE_TESTS``). (NOTE: A more # efficient way to optionally enable tests is to put them in a ``test/`` -# subdir and then include that subdir with `TRIBITS_ADD_TEST_DIRECTORIES()`_.) +# subdir and then include that subdir with `tribits_add_test_directories()`_.) # # *Sections:* # -# * `Formal Arguments (TRIBITS_ADD_TEST())`_ -# * `Determining the Executable or Command to Run (TRIBITS_ADD_TEST())`_ -# * `Determining the Full Test Name (TRIBITS_ADD_TEST())`_ -# * `Adding Multiple Tests (TRIBITS_ADD_TEST())`_ -# * `Determining Pass/Fail (TRIBITS_ADD_TEST())`_ -# * `Setting additional test properties (TRIBITS_ADD_TEST())`_ -# * `Running multiple tests at the same time (TRIBITS_ADD_TEST())`_ -# * `Setting timeouts for tests (TRIBITS_ADD_TEST())`_ -# * `Debugging and Examining Test Generation (TRIBITS_ADD_TEST())`_ -# * `Disabling Tests Externally (TRIBITS_ADD_TEST())`_ -# * `Adding extra commandline arguments externally (TRIBITS_ADD_TEST())`_ +# * `Formal Arguments (tribits_add_test())`_ +# * `Determining the Executable or Command to Run (tribits_add_test())`_ +# * `Determining the Full Test Name (tribits_add_test())`_ +# * `Adding Multiple Tests (tribits_add_test())`_ +# * `Determining Pass/Fail (tribits_add_test())`_ +# * `Setting additional test properties (tribits_add_test())`_ +# * `Running multiple tests at the same time (tribits_add_test())`_ +# * `Setting timeouts for tests (tribits_add_test())`_ +# * `Debugging and Examining Test Generation (tribits_add_test())`_ +# * `Disabling Tests Externally (tribits_add_test())`_ +# * `Adding extra commandline arguments externally (tribits_add_test())`_ # -# .. _Formal Arguments (TRIBITS_ADD_TEST()): +# .. _Formal Arguments (tribits_add_test()): # -# **Formal Arguments (TRIBITS_ADD_TEST())** +# **Formal Arguments (tribits_add_test())** # # ```` # # The name of the executable or path to the executable to run for the test # (see `Determining the Executable or Command to Run -# (TRIBITS_ADD_TEST())`_). This name is also the default root name for -# the test (see `Determining the Full Test Name (TRIBITS_ADD_TEST())`_). +# (tribits_add_test())`_). This name is also the default root name for +# the test (see `Determining the Full Test Name (tribits_add_test())`_). # # ``NOEXEPREFIX`` # # If specified, then the prefix ``${PACKAGE_NAME}_`` is assumed **not** to # be prepended to ```` (see `Determining the Executable or -# Command to Run (TRIBITS_ADD_TEST())`_). +# Command to Run (tribits_add_test())`_). # # ``NOEXESUFFIX`` # # If specified, then the postfix # ``${${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX}`` is assumed **not** to be # post-pended to ```` (except on Windows platforms, see -# `Determining the Executable or Command to Run (TRIBITS_ADD_TEST())`_). +# `Determining the Executable or Command to Run (tribits_add_test())`_). # # ``NAME `` # # If specified, gives the root name of the test. If not specified, then # ```` is taken to be ````. The actual test -# name passed to ``ADD_TEST()`` will always be prefixed as +# name passed to ``add_test()`` will always be prefixed as # ``${PACKAGE_NAME}_``. The main purpose of this argument # is to allow multiple tests to be defined for the same executable. CTest # requires all test names to be globally unique in a single project. See -# `Determining the Full Test Name (TRIBITS_ADD_TEST())`_. +# `Determining the Full Test Name (tribits_add_test())`_. # # ``NAME_POSTFIX `` # # If specified, gives a postfix that will be added to the standard test # name based on ```` (appended as ``_``). If # the ``NAME `` argument is given, this argument is ignored. -# See `Determining the Full Test Name (TRIBITS_ADD_TEST())`_. +# See `Determining the Full Test Name (tribits_add_test())`_. # # ``DIRECTORY `` # @@ -143,14 +143,14 @@ INCLUDE(TribitsAddTestHelpers) # given by ````. The directory ```` can either be a relative or # absolute path. If not specified, the executable is assumed to be in the # current binary directory ``${CMAKE_CURRENT_BINARY_DIR}``. See -# `Determining the Executable or Command to Run (TRIBITS_ADD_TEST())`_. +# `Determining the Executable or Command to Run (tribits_add_test())`_. # # ``ADD_DIR_TO_NAME`` # # If specified, then the directory name that this test resides in will be # added into the name of the test after the package name is added and # before the root test name (see `Determining the Full Test Name -# (TRIBITS_ADD_TEST())`_). The directory name will have the package's +# (tribits_add_test())`_). The directory name will have the package's # base directory stripped off so only the unique part of the test # directory will be used. All directory separators ``"/"`` will be # changed into underscores ``"_"``. @@ -161,7 +161,7 @@ INCLUDE(TribitsAddTestHelpers) # is running. This is useful for devices (like CUDA GPUs) that require # exclusive access for processes/threads. This just sets the CTest test # property ``RUN_SERIAL`` using the built-in CMake function -# ``SET_TESTS_PROPERTIES()``. Also, the addition of the ``RUN_SERIAL`` +# ``set_tests_properties()``. Also, the addition of the ``RUN_SERIAL`` # test property can be triggered by (the user) setting the global cache # variable ``_SET_RUN_SERIAL=ON``. NOTE: If ``RUN_SERIAL`` # is passed in but ``_SET_RUN_SERIAL=OFF`` (or any value @@ -180,7 +180,7 @@ INCLUDE(TribitsAddTestHelpers) # ``POSTFIX_AND_ARGS_`` form instead. **WARNING:** Multiple # arguments passed to a single test invocation must be quoted or multiple # tests taking single arguments will be created instead! See `Adding -# Multiple Tests (TRIBITS_ADD_TEST())`_ for more details and examples. +# Multiple Tests (tribits_add_test())`_ for more details and examples. # # ``POSTFIX_AND_ARGS_ ...`` # @@ -200,7 +200,7 @@ INCLUDE(TribitsAddTestHelpers) # that one can give a meaningful name to each test case and one can # specify multiple arguments without having to quote them and one can # allow long argument lists to span multiple lines. See `Adding Multiple -# Tests (TRIBITS_ADD_TEST())`_ for more details and examples. +# Tests (tribits_add_test())`_ for more details and examples. # # ``COMM [serial] [mpi]`` # @@ -241,7 +241,7 @@ INCLUDE(TribitsAddTestHelpers) # ``PROCESSORS`` is set to ```` so that CTest knows how # to best schedule the test w.r.t. other tests on a given number of # available processes. See `Running multiple tests at the same time -# (TRIBITS_ADD_TEST())`_. +# (tribits_add_test())`_. # # ``CATEGORIES ...`` # @@ -264,7 +264,7 @@ INCLUDE(TribitsAddTestHelpers) # # If specified, gives a list of hostnames where the test will be included. # The current hostname is determined by the built-in CMake command -# ``SITE_NAME(${PROJECT_NAME}_HOSTNAME)``. On Linux/Unix systems, this is +# ``site_name(${PROJECT_NAME}_HOSTNAME)``. On Linux/Unix systems, this is # typically the value returned by ``uname -n``. If this list is given, # the value of ``${${PROJECT_NAME}_HOSTNAME}`` must equal one of the # listed host names ```` or test will **not** be added. The value @@ -336,7 +336,7 @@ INCLUDE(TribitsAddTestHelpers) # send to stdout. Otherwise, the test will fail. This is set using the # built-in CTest property ``PASS_REGULAR_EXPRESSION``. Consult standard # CMake documentation for full behavior. TIPS: Replace ';' with '[;]' or -# CMake will interpret this as a array element boundary. To match '.', +# CMake will interpret this as an array element boundary. To match '.', # use '[.]'. # # ``FAIL_REGULAR_EXPRESSION ";;..."`` @@ -366,7 +366,7 @@ INCLUDE(TribitsAddTestHelpers) # to run before being timed-out and killed. This sets the CTest property # ``TIMEOUT``. The value ```` will be scaled by the value of # `${PROJECT_NAME}_SCALE_TEST_TIMEOUT`_. See `Setting timeouts for tests -# (TRIBITS_ADD_TEST())`_ for more details. +# (tribits_add_test())`_ for more details. # # **WARNING:** Rather than just increasing the timeout for an expensive # test, please try to either make the test run faster or relegate the test @@ -377,14 +377,14 @@ INCLUDE(TribitsAddTestHelpers) # ``ADDED_TESTS_NAMES_OUT `` # # If specified, then on output the variable ```` will be set -# with the name(S) of the tests passed to ``ADD_TEST()``. If more than +# with the name(S) of the tests passed to ``add_test()``. If more than # one test is added, then this will be a list of test names. Having this # name allows the calling ``CMakeLists.txt`` file access and set # additional test properties (see `Setting additional test properties -# (TRIBITS_ADD_TEST())`_). +# (tribits_add_test())`_). # # In the end, this function just calls the built-in CMake commands -# ``ADD_TEST(${TEST_NAME} ...)`` and ``SET_TESTS_PROPERTIES(${TEST_NAME} +# ``add_test(${TEST_NAME} ...)`` and ``set_tests_properties(${TEST_NAME} # ...)`` to set up a executable process for ``ctest`` to run, determine # pass/fail criteria, and set some other test properties. Therefore, this # wrapper function does not provide any fundamentally new features that are @@ -395,17 +395,17 @@ INCLUDE(TribitsAddTestHelpers) # test name clashes). # # If more flexibility or control is needed when defining tests, then the -# function `TRIBITS_ADD_ADVANCED_TEST()`_ should be used instead. +# function `tribits_add_advanced_test()`_ should be used instead. # # In the following subsections, more details on how tests are defined and run # is given. # -# .. _Determining the Executable or Command to Run (TRIBITS_ADD_TEST()): +# .. _Determining the Executable or Command to Run (tribits_add_test()): # -# **Determining the Executable or Command to Run (TRIBITS_ADD_TEST())** +# **Determining the Executable or Command to Run (tribits_add_test())** # # This function is primarily designed to make it easy to run tests for -# executables built using the function `TRIBITS_ADD_EXECUTABLE()`_. To set up +# executables built using the function `tribits_add_executable()`_. To set up # tests to run arbitrary executables, see below. # # By default, the executable to run is determined by first getting the @@ -415,10 +415,10 @@ INCLUDE(TribitsAddTestHelpers) # ${PACKAGE_NAME}_${${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX} # # which is (by no coincidence) identical to how it is selected in -# `TRIBITS_ADD_EXECUTABLE()`_ (see `Executable and Target Name -# (TRIBITS_ADD_EXECUTABLE())`_). This name can be altered by passing in +# `tribits_add_executable()`_ (see `Executable and Target Name +# (tribits_add_executable())`_). This name can be altered by passing in # ``NOEXEPREFIX``, ``NOEXESUFFIX``, and ``ADD_DIR_TO_NAME`` as described in -# `Executable and Target Name (TRIBITS_ADD_EXECUTABLE())`_. +# `Executable and Target Name (tribits_add_executable())`_. # # By default, this executable is assumed to be in the current CMake binary # directory ``${CMAKE_CURRENT_BINARY_DIR}`` but the directory location can be @@ -438,9 +438,9 @@ INCLUDE(TribitsAddTestHelpers) # not found, then when ``ctest`` goes to run the test, it will mark it as # ``NOT RUN``. # -# .. _Determining the Full Test Name (TRIBITS_ADD_TEST()): +# .. _Determining the Full Test Name (tribits_add_test()): # -# **Determining the Full Test Name (TRIBITS_ADD_TEST())** +# **Determining the Full Test Name (tribits_add_test())** # # By default, the base test name is selected to be:: # @@ -460,9 +460,9 @@ INCLUDE(TribitsAddTestHelpers) # # Let the test name determined as described above be ````. If # no arguments or only a single set of arguments are passed in through -# ``ARGS``, then this is the test name actually passed in to ``ADD_TEST()``. +# ``ARGS``, then this is the test name actually passed in to ``add_test()``. # If multiple tests are defined, then this name becomes the base test name for -# each of the tests (see `Adding Multiple Tests (TRIBITS_ADD_TEST())`_). +# each of the tests (see `Adding Multiple Tests (tribits_add_test())`_). # # Finally, for any test that gets defined, if MPI is enabled # (i.e. ``TPL_ENABLE_MPI=ON``), then the terminal suffix @@ -470,9 +470,9 @@ INCLUDE(TribitsAddTestHelpers) # for multiple tests). No such prefix is added for the serial case # (i.e. ``TPL_ENABLE_MPI=OFF``). # -# .. _Adding Multiple Tests (TRIBITS_ADD_TEST()): +# .. _Adding Multiple Tests (tribits_add_test()): # -# **Adding Multiple Tests (TRIBITS_ADD_TEST())** +# **Adding Multiple Tests (tribits_add_test())** # # Using this function, one can add executable arguments and can even add # multiple tests in one of two ways. One can either pass in one or more @@ -528,9 +528,9 @@ INCLUDE(TribitsAddTestHelpers) # fresh, the ``ARGS`` argument would only create a single test and the # arguments would not be quoted. # -# .. _Determining Pass/Fail (TRIBITS_ADD_TEST()): +# .. _Determining Pass/Fail (tribits_add_test()): # -# **Determining Pass/Fail (TRIBITS_ADD_TEST())** +# **Determining Pass/Fail (tribits_add_test())** # # The only means to determine pass/fail is to use the built-in CTest # properties ``PASS_REGULAR_EXPRESSION`` and ``FAIL_REGULAR_EXPRESSION`` which @@ -538,30 +538,30 @@ INCLUDE(TribitsAddTestHelpers) # invert these using ``WILL_FAIL``). For simple tests, that is enough. # However, for more complex executables, one may need to examine one or more # output files to determine pass/fail. Raw CMake/CTest cannot do this. In -# this case, one should use `TRIBITS_ADD_ADVANCED_TEST()`_ instead to add the +# this case, one should use `tribits_add_advanced_test()`_ instead to add the # test. # -# .. _Setting additional test properties (TRIBITS_ADD_TEST()): +# .. _Setting additional test properties (tribits_add_test()): # -# **Setting additional test properties (TRIBITS_ADD_TEST())** +# **Setting additional test properties (tribits_add_test())** # -# After this function returns, any tests that get added using ``ADD_TEST()`` +# After this function returns, any tests that get added using ``add_test()`` # can have additional properties set and changed using -# ``SET_TESTS_PROPERTIES()``. Therefore, any tests properties that are not +# ``set_tests_properties()``. Therefore, any tests properties that are not # directly supported and passed through this wrapper function can be set in -# the outer ``CMakeLists.txt`` file after the call to ``TRIBITS_ADD_TEST()``. +# the outer ``CMakeLists.txt`` file after the call to ``tribits_add_test()``. # # If tests are added, then the names of those tests will be returned in the # variable ``ADDED_TESTS_NAMES_OUT ``. This can be used, for # example, to override the ``PROCESSORS`` property for the tests with:: # -# TRIBITS_ADD_TEST( someTest ... +# tribits_add_test( someTest ... # ADDED_TESTS_NAMES_OUT someTest_TEST_NAME ) # -# IF (someTest_TEST_NAME) -# SET_TESTS_PROPERTIES( ${someTest_TEST_NAME} +# if (someTest_TEST_NAME) +# set_tests_properties( ${someTest_TEST_NAME} # PROPERTIES ATTACHED_FILES someTest.log ) -# ENDIF() +# endif() # # where the test writes a log file ``someTest.log`` that we want to submit to # CDash also. @@ -571,39 +571,39 @@ INCLUDE(TribitsAddTestHelpers) # ``COMM``, ``XHOST``, etc.). # # The following built-in CTest test properties are set through `Formal -# Arguments (TRIBITS_ADD_TEST())`_ or are otherwise automatically set by this +# Arguments (tribits_add_test())`_ or are otherwise automatically set by this # function and should **NOT** be overridden by direct calls to -# ``SET_TESTS_PROPERTIES()``: ``ENVIRONMENT``, ``FAIL_REGULAR_EXPRESSION``, +# ``set_tests_properties()``: ``ENVIRONMENT``, ``FAIL_REGULAR_EXPRESSION``, # ``LABELS``, ``PASS_REGULAR_EXPRESSION``, ``RUN_SERIAL``, ``TIMEOUT``, and # ``WILL_FAIL``. # # However, generally, other built-in CTest test properties can be set after # the test is added like show above. Examples of test properties that can be -# set using direct calls to ``SET_TESTS_PROPERTIES()`` include +# set using direct calls to ``set_tests_properties()`` include # ``ATTACHED_FILES``, ``ATTACHED_FILES_ON_FAIL``, ``COST``, ``DEPENDS``, # ``MEASUREMENT``, ``RESOURCE_LOCK`` and ``WORKING_DIRECTORY``. # # For example, one can set a dependency between two tests using:: # -# TRIBITS_ADD_TEST( test_a [...] +# tribits_add_test( test_a [...] # ADDED_TESTS_NAMES_OUT test_a_TEST_NAME ) # -# TRIBITS_ADD_TEST( test_b [...] +# tribits_add_test( test_b [...] # ADDED_TESTS_NAMES_OUT test_z_TEST_NAME ) # -# IF (test_a_TEST_NAME AND test_b_TEST_NAME) -# SET_TESTS_PROPERTIES(${test_b_TEST_NAME} +# if (test_a_TEST_NAME AND test_b_TEST_NAME) +# set_tests_properties(${test_b_TEST_NAME} # PROPERTIES DEPENDS ${test_a_TEST_NAME}) -# ENDIF() +# endif() # # This ensures that test ``test_b`` will always be run after ``test_a`` if # both tests are run by CTest. # -# .. _Running multiple tests at the same time (TRIBITS_ADD_TEST()): +# .. _Running multiple tests at the same time (tribits_add_test()): # -# **Running multiple tests at the same time (TRIBITS_ADD_TEST())** +# **Running multiple tests at the same time (tribits_add_test())** # -# By default, CTest will run as many tests defined with ``ADD_TEST()`` at same +# By default, CTest will run as many tests defined with ``add_test()`` at same # time as it can according to its parallel level (e.g. ``'ctest -j'`` or # the CTest property ``CTEST_PARALLEL_LEVEL``). For example, when raw # ``'ctest -j10'`` is run, CTest will run multiple tests at the same time to @@ -615,7 +615,7 @@ INCLUDE(TribitsAddTestHelpers) # ``NUM_MPI_PROCS `` (see above), this TriBITS function will set the # built-in CTest property ``PROCESSORS`` to ```` using:: # -# SET_TESTS_PROPERTIES( PROPERTIES PROCESSORS ) +# set_tests_properties( PROPERTIES PROCESSORS ) # # This tells CTest that the defined test uses ```` processes and # CTest will use that information to not exceed the requested parallel level. @@ -642,7 +642,7 @@ INCLUDE(TribitsAddTestHelpers) # # In this case, it sets the CTest ``PROCESSORS`` property as:: # -# SET_TESTS_PROPERTIES( PROPERTIES PROCESSORS ) +# set_tests_properties( PROPERTIES PROCESSORS ) # # When the number of processes a test uses does not cleanly divide into the # requested CTest parallel level, it is not clear how CTest schedules the @@ -667,9 +667,9 @@ INCLUDE(TribitsAddTestHelpers) # important when running multiple ``ctest -J`` invocations on the same test # machine. # -# .. _Setting timeouts for tests (TRIBITS_ADD_TEST()): +# .. _Setting timeouts for tests (tribits_add_test()): # -# **Setting timeouts for tests (TRIBITS_ADD_TEST())** +# **Setting timeouts for tests (tribits_add_test())** # # By default, all tests have a default timeout (1500 seconds for most # projects, see `DART_TESTING_TIMEOUT`_). That means that if they hang @@ -693,7 +693,7 @@ INCLUDE(TribitsAddTestHelpers) # `` (see `Overriding test timeouts`_). # # Alternatively, timeouts for individual tests can be set using the input -# argument ``TIMEOUT`` (see `Formal Arguments (TRIBITS_ADD_TEST())`_ above). +# argument ``TIMEOUT`` (see `Formal Arguments (tribits_add_test())`_ above). # The timeout value passed in to this function is then scaled by # ``${PROJECT_NAME}_SCALE_TEST_TIMEOUT`` and the scaled timeout is then set as # the CTest test property ``TIMEOUT``. One can observe the value of this @@ -716,9 +716,9 @@ INCLUDE(TribitsAddTestHelpers) # * Else, no timeout is set and the test can run (and hang) forever until # manually killed by the user. # -# .. _Debugging and Examining Test Generation (TRIBITS_ADD_TEST()): +# .. _Debugging and Examining Test Generation (tribits_add_test()): # -# **Debugging and Examining Test Generation (TRIBITS_ADD_TEST())** +# **Debugging and Examining Test Generation (tribits_add_test())** # # In order to see what tests get added and if not then why, configure with # ``${PROJECT_NAME}_TRACE_ADD_TEST=ON``. That will print one line per show @@ -730,14 +730,14 @@ INCLUDE(TribitsAddTestHelpers) # directory which contains all of the added tests and test properties that are # set. This is the file that is read by ``ctest`` when it runs to determine # what tests to run, determine pass/fail and adjust other behavior using test -# properties. In this file, one can see the exact ``ADD_TEST()`` and -# ``SET_TESTS_PROPERTIES()`` commands. The is the ultimate way to debug +# properties. In this file, one can see the exact ``add_test()`` and +# ``set_tests_properties()`` commands. The is the ultimate way to debug # exactly what tests are getting added by this function (or if the test is # even being added at all). # -# .. _Disabling Tests Externally (TRIBITS_ADD_TEST()): +# .. _Disabling Tests Externally (tribits_add_test()): # -# **Disabling Tests Externally (TRIBITS_ADD_TEST())** +# **Disabling Tests Externally (tribits_add_test())** # # The test can be disabled externally by setting the CMake cache variable # ``_DISABLE=TRUE``. This allows tests to be disabled on a @@ -750,14 +750,14 @@ INCLUDE(TribitsAddTestHelpers) # way, TriBITS will always print a warning to the ``cmake`` stdout at # configure time warning that the test is being disabled. # -# .. _Adding extra commandline arguments externally (TRIBITS_ADD_TEST()): +# .. _Adding extra commandline arguments externally (tribits_add_test()): # -# **Adding extra commandline arguments externally (TRIBITS_ADD_TEST())** +# **Adding extra commandline arguments externally (tribits_add_test())** # # One can add additional command-line arguments for any ctest test added using # this function. In order to do so, set the CMake cache variable:: # -# SET(_EXTRA_ARGS ";;;..." +# set(_EXTRA_ARGS ";;;..." # CACHE STRING "Extra args") # # in a ``*.cmake`` configure options fragment file or:: @@ -768,7 +768,7 @@ INCLUDE(TribitsAddTestHelpers) # # These extra command-line arguments are added after any arguments passed in # through ``ARGS " ..."`` or ``POSTFIX_AND_ARGS_ -# ...``. This allows these extra arguments to override the ealier +# ...``. This allows these extra arguments to override the earlier # arguments. # # The primary motivating use case for ``_EXTRA_ARGS`` is to @@ -776,37 +776,37 @@ INCLUDE(TribitsAddTestHelpers) # example, this allows one to disable specific individual unit tests for a # GTest executable such as with:: # -# SET(_EXTRA_ARGS "--gtest_filter=-::..." +# set(_EXTRA_ARGS "--gtest_filter=-::..." # CACHE STRING "Disable specific unit tests" ) # # For example, this would be an alternative to disabling an entire unit # testing executable using ``-D_DISABLE=ON`` as described above. # -FUNCTION(TRIBITS_ADD_TEST EXE_NAME) +function(tribits_add_test EXE_NAME) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("") - MESSAGE("TRIBITS_ADD_TEST: ${EXE_NAME} ${ARGN}") - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("") + message("TRIBITS_ADD_TEST: ${EXE_NAME} ${ARGN}") + endif() - GLOBAL_SET(TRIBITS_ADD_TEST_ADD_TEST_INPUT) - GLOBAL_SET(TRIBITS_SET_TEST_PROPERTIES_INPUT) - GLOBAL_SET(MESSAGE_WRAPPER_INPUT) + global_set(TRIBITS_ADD_TEST_ADD_TEST_INPUT) + global_set(TRIBITS_SET_TEST_PROPERTIES_INPUT) + global_set(MESSAGE_WRAPPER_INPUT) # # A) Parse the input arguments # # Allow for a maximum of 20 (0 through 19) postfix and argument blocks - SET(MAX_NUM_POSTFIX_AND_ARGS_IDX 19) + set(MAX_NUM_POSTFIX_AND_ARGS_IDX 19) - SET(POSTFIX_AND_ARGS_LIST "") - FOREACH( POSTFIX_AND_ARGS_IDX RANGE ${MAX_NUM_POSTFIX_AND_ARGS_IDX}) - LIST( APPEND POSTFIX_AND_ARGS_LIST POSTFIX_AND_ARGS_${POSTFIX_AND_ARGS_IDX} ) - ENDFOREACH() - #PRINT_VAR(POSTFIX_AND_ARGS_LIST) + set(POSTFIX_AND_ARGS_LIST "") + foreach( POSTFIX_AND_ARGS_IDX RANGE ${MAX_NUM_POSTFIX_AND_ARGS_IDX}) + list( APPEND POSTFIX_AND_ARGS_LIST POSTFIX_AND_ARGS_${POSTFIX_AND_ARGS_IDX} ) + endforeach() + #print_var(POSTFIX_AND_ARGS_LIST) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE # options @@ -818,29 +818,29 @@ FUNCTION(TRIBITS_ADD_TEST EXE_NAME) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - IF (NOT "${PARSE_ARGS}" STREQUAL "") - LIST(LENGTH PARSE_ARGS NUM_PARSE_ARGS) - ELSEIF (PARSE_POSTFIX_AND_ARGS_0) + if (NOT "${PARSE_ARGS}" STREQUAL "") + list(LENGTH PARSE_ARGS NUM_PARSE_ARGS) + elseif (PARSE_POSTFIX_AND_ARGS_0) # We will use this list instead - ELSE() + else() # Niether 'ARGS' nor 'POSTFIX_AND_ARGS' was selected so just assume one # empty arg - SET(PARSE_ARGS " ") - SET(NUM_PARSE_ARGS 1) - ENDIF() + set(PARSE_ARGS " ") + set(NUM_PARSE_ARGS 1) + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("") - MESSAGE("TRIBITS_ADD_TEST: EXE_NAME = ${EXE_NAME}") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("") + message("TRIBITS_ADD_TEST: EXE_NAME = ${EXE_NAME}") + endif() - IF(PARSE_ADDED_TESTS_NAMES_OUT) - SET(${PARSE_ADDED_TESTS_NAMES_OUT} "" PARENT_SCOPE ) - ENDIF() + if(PARSE_ADDED_TESTS_NAMES_OUT) + set(${PARSE_ADDED_TESTS_NAMES_OUT} "" PARENT_SCOPE ) + endif() - SET(ADDED_TESTS_NAMES_OUT) + set(ADDED_TESTS_NAMES_OUT) # # Get test name @@ -848,195 +848,195 @@ FUNCTION(TRIBITS_ADD_TEST EXE_NAME) # If requested create a modifier for the name that will be inserted between # the package name and the given name or exe_name for the test - SET(DIRECTORY_NAME "") - IF(PARSE_ADD_DIR_TO_NAME) - TRIBITS_CREATE_NAME_FROM_CURRENT_SOURCE_DIRECTORY(DIRECTORY_NAME) - SET(DIRECTORY_NAME "${DIRECTORY_NAME}_") - ENDIF() + set(DIRECTORY_NAME "") + if(PARSE_ADD_DIR_TO_NAME) + tribits_create_name_from_current_source_directory(DIRECTORY_NAME) + set(DIRECTORY_NAME "${DIRECTORY_NAME}_") + endif() - #MESSAGE("TRIBITS_ADD_TEST: ${EXE_NAME}: EXE_BINARY_NAME = ${EXE_BINARY_NAME}") + #message("TRIBITS_ADD_TEST: ${EXE_NAME}: EXE_BINARY_NAME = ${EXE_BINARY_NAME}") - IF (PARSE_NAME) - SET(TEST_NAME "${DIRECTORY_NAME}${PARSE_NAME}") - ELSEIF (PARSE_NAME_POSTFIX) - SET(TEST_NAME "${DIRECTORY_NAME}${EXE_NAME}_${PARSE_NAME_POSTFIX}") - ELSE() - SET(TEST_NAME "${DIRECTORY_NAME}${EXE_NAME}") - ENDIF() + if (PARSE_NAME) + set(TEST_NAME "${DIRECTORY_NAME}${PARSE_NAME}") + elseif (PARSE_NAME_POSTFIX) + set(TEST_NAME "${DIRECTORY_NAME}${EXE_NAME}_${PARSE_NAME_POSTFIX}") + else() + set(TEST_NAME "${DIRECTORY_NAME}${EXE_NAME}") + endif() - SET(TEST_NAME "${PACKAGE_NAME}_${TEST_NAME}") + set(TEST_NAME "${PACKAGE_NAME}_${TEST_NAME}") # # B) Add or don't add tests based on a number of criteria # - SET(ADD_THE_TEST FALSE) - TRIBITS_ADD_TEST_PROCESS_ENABLE_TESTS(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() + set(ADD_THE_TEST FALSE) + tribits_add_test_process_enable_tests(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() - TRIBITS_ADD_TEST_PROCESS_SKIP_CTEST_ADD_TEST(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() + tribits_add_test_process_skip_ctest_add_test(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() - SET(ADD_THE_TEST FALSE) - TRIBITS_ADD_TEST_PROCESS_CATEGORIES(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() + set(ADD_THE_TEST FALSE) + tribits_add_test_process_categories(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() - SET(ADD_THE_TEST FALSE) - TRIBITS_ADD_TEST_PROCESS_HOST_HOSTTYPE(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() + set(ADD_THE_TEST FALSE) + tribits_add_test_process_host_hosttype(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() # # C) Set the name and path of the binary that will be run # - TRIBITS_ADD_TEST_GET_EXE_BINARY_NAME( + tribits_add_test_get_exe_binary_name( "${EXE_NAME}" ${PARSE_NOEXEPREFIX} ${PARSE_NOEXESUFFIX} ${PARSE_ADD_DIR_TO_NAME} EXE_BINARY_NAME ) - TRIBITS_ADD_TEST_ADJUST_DIRECTORY( ${EXE_BINARY_NAME} "${PARSE_DIRECTORY}" + tribits_add_test_adjust_directory( ${EXE_BINARY_NAME} "${PARSE_DIRECTORY}" EXECUTABLE_PATH) - #MESSAGE("TRIBITS_ADD_TEST: ${EXE_NAME}: EXECUTABLE_PATH = ${EXECUTABLE_PATH}") + #message("TRIBITS_ADD_TEST: ${EXE_NAME}: EXECUTABLE_PATH = ${EXECUTABLE_PATH}") # # D) Determine if we will add the serial or MPI tests based on input COMM # and TPL_ENABLE_MPI # - TRIBITS_PROCESS_COMM_ARGS(ADD_SERIAL_TEST ADD_MPI_TEST ${PARSE_COMM}) + tribits_process_comm_args(ADD_SERIAL_TEST ADD_MPI_TEST ${PARSE_COMM}) # # E) Get the MPI options # - TRIBITS_ADD_TEST_GET_NUM_PROCS_USED("${PARSE_NUM_MPI_PROCS}" + tribits_add_test_get_num_procs_used("${PARSE_NUM_MPI_PROCS}" "NUM_MPI_PROCS" NUM_PROCS_USED NUM_PROCS_USED_NAME) - IF (NUM_PROCS_USED LESS 0) - SET(ADD_SERIAL_TEST FALSE) - SET(ADD_MPI_TEST FALSE) - ENDIF() + if (NUM_PROCS_USED LESS 0) + set(ADD_SERIAL_TEST FALSE) + set(ADD_MPI_TEST FALSE) + endif() - IF (TPL_ENABLE_MPI) - SET(MPI_NAME_POSTFIX "_MPI_${NUM_PROCS_USED}") - ELSE() - SET(MPI_NAME_POSTFIX "") - ENDIF() + if (TPL_ENABLE_MPI) + set(MPI_NAME_POSTFIX "_MPI_${NUM_PROCS_USED}") + else() + set(MPI_NAME_POSTFIX "") + endif() - TRIBITS_ADD_TEST_GET_NUM_TOTAL_CORES_USED("${TEST_NAME}${MPI_NAME_POSTFIX}" + tribits_add_test_get_num_total_cores_used("${TEST_NAME}${MPI_NAME_POSTFIX}" "${PARSE_NUM_TOTAL_CORES_USED}" "NUM_TOTAL_CORES_USED" "${NUM_PROCS_USED}" "${NUM_PROCS_USED_NAME}" NUM_TOTAL_CORES_USED SKIP_TEST) - IF (SKIP_TEST) - SET(ADD_SERIAL_TEST FALSE) - SET(ADD_MPI_TEST FALSE) - ENDIF() + if (SKIP_TEST) + set(ADD_SERIAL_TEST FALSE) + set(ADD_MPI_TEST FALSE) + endif() # # F) Add the tests # - IF (NOT ADD_SERIAL_TEST AND NOT ADD_MPI_TEST) - RETURN() - ENDIF() + if (NOT ADD_SERIAL_TEST AND NOT ADD_MPI_TEST) + return() + endif() - IF (NOT "${PARSE_ARGS}" STREQUAL "") + if (NOT "${PARSE_ARGS}" STREQUAL "") # F.1) Add tests with simple lists of arguments - SET(COUNTER 0) + set(COUNTER 0) - FOREACH(PARSE_ARG ${PARSE_ARGS}) + foreach(PARSE_ARG ${PARSE_ARGS}) - IF(${NUM_PARSE_ARGS} EQUAL 1) - SET(TEST_NAME_INSTANCE "${TEST_NAME}${MPI_NAME_POSTFIX}") - ELSE() - SET(TEST_NAME_INSTANCE "${TEST_NAME}_${COUNTER}${MPI_NAME_POSTFIX}") - ENDIF() - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "TEST_NAME = ${TEST_NAME_INSTANCE}") - ENDIF() + if(${NUM_PARSE_ARGS} EQUAL 1) + set(TEST_NAME_INSTANCE "${TEST_NAME}${MPI_NAME_POSTFIX}") + else() + set(TEST_NAME_INSTANCE "${TEST_NAME}_${COUNTER}${MPI_NAME_POSTFIX}") + endif() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "TEST_NAME = ${TEST_NAME_INSTANCE}") + endif() - TRIBITS_CONVERT_CMND_ARG_STRING_TO_ADD_TEST_ARG_ARRAY(${PARSE_ARG} INARGS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(INARGS) - ENDIF() + tribits_convert_cmnd_arg_string_to_add_test_arg_array(${PARSE_ARG} INARGS) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(INARGS) + endif() - TRIBITS_SET_RUN_SERIAL(${TEST_NAME_INSTANCE} "${PARSE_RUN_SERIAL}" + tribits_set_run_serial(${TEST_NAME_INSTANCE} "${PARSE_RUN_SERIAL}" SET_RUN_SERIAL) - TRIBITS_SET_DISABLED_AND_MSG(${TEST_NAME_INSTANCE} "${PARSE_DISABLED}" + tribits_set_disabled_and_msg(${TEST_NAME_INSTANCE} "${PARSE_DISABLED}" SET_DISABLED_AND_MSG) - TRIBITS_ADD_TEST_ADD_TEST_ALL( ${TEST_NAME_INSTANCE} + tribits_add_test_add_test_all( ${TEST_NAME_INSTANCE} "${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}" ) - IF(PARSE_ADDED_TESTS_NAMES_OUT AND ADDED_TEST_NAME) - LIST(APPEND ADDED_TESTS_NAMES_OUT ${ADDED_TEST_NAME}) - ENDIF() + if(PARSE_ADDED_TESTS_NAMES_OUT AND ADDED_TEST_NAME) + list(APPEND ADDED_TESTS_NAMES_OUT ${ADDED_TEST_NAME}) + endif() - MATH(EXPR COUNTER ${COUNTER}+1 ) + math(EXPR COUNTER ${COUNTER}+1 ) - ENDFOREACH() + endforeach() - ELSEIF (PARSE_POSTFIX_AND_ARGS_0) + elseif (PARSE_POSTFIX_AND_ARGS_0) # F.2) Add tests with different postfixes for each set of arguments - FOREACH( POSTFIX_AND_ARGS_IDX RANGE ${MAX_NUM_POSTFIX_AND_ARGS_IDX}) + foreach( POSTFIX_AND_ARGS_IDX RANGE ${MAX_NUM_POSTFIX_AND_ARGS_IDX}) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(PARSE_POSTFIX_AND_ARGS_${POSTFIX_AND_ARGS_IDX}) - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(PARSE_POSTFIX_AND_ARGS_${POSTFIX_AND_ARGS_IDX}) + endif() - IF (NOT PARSE_POSTFIX_AND_ARGS_${POSTFIX_AND_ARGS_IDX}) - BREAK() - ENDIF() + if (NOT PARSE_POSTFIX_AND_ARGS_${POSTFIX_AND_ARGS_IDX}) + break() + endif() - SET( POSTFIX_AND_ARGS ${PARSE_POSTFIX_AND_ARGS_${POSTFIX_AND_ARGS_IDX}} ) + set( POSTFIX_AND_ARGS ${PARSE_POSTFIX_AND_ARGS_${POSTFIX_AND_ARGS_IDX}} ) - LIST( GET POSTFIX_AND_ARGS 0 POSTFIX ) - SET( INARGS ${POSTFIX_AND_ARGS} ) # Initially contains postfix as ele 0 - LIST( REMOVE_AT INARGS 0 ) # Strip off the postfix name + list( GET POSTFIX_AND_ARGS 0 POSTFIX ) + set( INARGS ${POSTFIX_AND_ARGS} ) # Initially contains postfix as ele 0 + list( REMOVE_AT INARGS 0 ) # Strip off the postfix name - SET(TEST_NAME_INSTANCE "${TEST_NAME}_${POSTFIX}${MPI_NAME_POSTFIX}") + set(TEST_NAME_INSTANCE "${TEST_NAME}_${POSTFIX}${MPI_NAME_POSTFIX}") - TRIBITS_SET_RUN_SERIAL(${TEST_NAME_INSTANCE} "${PARSE_RUN_SERIAL}" + tribits_set_run_serial(${TEST_NAME_INSTANCE} "${PARSE_RUN_SERIAL}" SET_RUN_SERIAL) - TRIBITS_SET_DISABLED_AND_MSG(${TEST_NAME_INSTANCE} "${PARSE_DISABLED}" + tribits_set_disabled_and_msg(${TEST_NAME_INSTANCE} "${PARSE_DISABLED}" SET_DISABLED_AND_MSG) - TRIBITS_ADD_TEST_ADD_TEST_ALL( ${TEST_NAME_INSTANCE} + tribits_add_test_add_test_all( ${TEST_NAME_INSTANCE} "${EXECUTABLE_PATH}" "${PARSE_CATEGORIES}" "${NUM_PROCS_USED}" "${NUM_TOTAL_CORES_USED}" ${PARSE_CREATE_WORKING_DIR} "${SET_RUN_SERIAL}" "${SET_DISABLED_AND_MSG}" ADDED_TEST_NAME ${INARGS} "${${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() + if(PARSE_ADDED_TESTS_NAMES_OUT AND ADDED_TEST_NAME) + list(APPEND ADDED_TESTS_NAMES_OUT ${ADDED_TEST_NAME}) + endif() - ENDFOREACH() + endforeach() - ENDIF() + endif() - IF(PARSE_ADDED_TESTS_NAMES_OUT) - SET(${PARSE_ADDED_TESTS_NAMES_OUT} "${ADDED_TESTS_NAMES_OUT}" + if(PARSE_ADDED_TESTS_NAMES_OUT) + set(${PARSE_ADDED_TESTS_NAMES_OUT} "${ADDED_TESTS_NAMES_OUT}" PARENT_SCOPE ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake b/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake index a4472313a0d9..f6f82ea09396 100644 --- a/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake @@ -38,18 +38,18 @@ # @HEADER -INCLUDE(TribitsAddExecutableTestHelpers) -INCLUDE(TribitsGeneralMacros) -INCLUDE(TribitsTestCategories) +include(TribitsAddExecutableTestHelpers) +include(TribitsGeneralMacros) +include(TribitsTestCategories) -INCLUDE(CMakeParseArguments) -INCLUDE(GlobalSet) -INCLUDE(AppendGlobalSet) -INCLUDE(AppendStringVarWithSep) -INCLUDE(PrintVar) -INCLUDE(AdvancedSet) -INCLUDE(MessageWrapper) -INCLUDE(TribitsGetCategoriesString) +include(CMakeParseArguments) +include(GlobalSet) +include(AppendGlobalSet) +include(AppendStringVarWithSep) +include(PrintVar) +include(AdvancedSet) +include(MessageWrapper) +include(TribitsGetCategoriesString) # @@ -58,39 +58,39 @@ INCLUDE(TribitsGetCategoriesString) # This must be run just before the packages define their tests and this macro # must be run in the base-level project scope. # -MACRO(TRIBITS_ADD_TEST_HELPERS_INIT) - IF (TPL_ENABLE_CUDA) - SET(TRIBITS_TEST_EXTRA_ENVIRONMENT CTEST_KOKKOS_DEVICE_TYPE=gpus) - SET(TRIBITS_RESOURCES_PER_PROCESS gpus:1) - ENDIF() -ENDMACRO() +macro(tribits_add_test_helpers_init) + if (TPL_ENABLE_CUDA) + set(TRIBITS_TEST_EXTRA_ENVIRONMENT CTEST_KOKKOS_DEVICE_TYPE=gpus) + set(TRIBITS_RESOURCES_PER_PROCESS gpus:1) + endif() +endmacro() # -# Wrapper function for SET_TESTS_PROPERTIES() to be used in unit testing. +# Wrapper function for set_tests_properties() to be used in unit testing. # -FUNCTION(TRIBITS_SET_TESTS_PROPERTIES) - IF (NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) - SET_TESTS_PROPERTIES(${ARGN}) - ENDIF() - IF (TRIBITS_SET_TEST_PROPERTIES_CAPTURE_INPUT) - APPEND_GLOBAL_SET(TRIBITS_SET_TEST_PROPERTIES_INPUT ${ARGN}) - ENDIF() -ENDFUNCTION() +function(tribits_set_tests_properties) + if (NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) + set_tests_properties(${ARGN}) + endif() + if (TRIBITS_SET_TEST_PROPERTIES_CAPTURE_INPUT) + append_global_set(TRIBITS_SET_TEST_PROPERTIES_INPUT ${ARGN}) + endif() +endfunction() # -# Wrapper function for SET_PROPERTY(TEST ...) to be used in unit testing +# Wrapper function for set_property(TEST ...) to be used in unit testing # -FUNCTION(TRIBITS_SET_TEST_PROPERTY) - IF (NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) - SET_PROPERTY(TEST ${ARGN}) - ENDIF() - IF (TRIBITS_SET_TEST_PROPERTIES_CAPTURE_INPUT) - APPEND_GLOBAL_SET(TRIBITS_SET_TEST_PROPERTIES_INPUT ${ARGN}) - ENDIF() -ENDFUNCTION() +function(tribits_set_test_property) + if (NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) + set_property(TEST ${ARGN}) + endif() + if (TRIBITS_SET_TEST_PROPERTIES_CAPTURE_INPUT) + append_global_set(TRIBITS_SET_TEST_PROPERTIES_INPUT ${ARGN}) + endif() +endfunction() # @@ -98,114 +98,114 @@ ENDFUNCTION() # # This function will truncate input TIMEOUT_IN but will allow for a simple # fractional scale factor. It will also truncate the scale factor to just one -# decimal place. CMake MATH(EXPR ...) does not support floating point so I +# decimal place. CMake math(EXPR ...) does not support floating point so I # have to use just manual integer arithmetic. # -FUNCTION(TRIBITS_SCALE_TIMEOUT TIMEOUT_IN SCALED_TIMEOUT_OUT) +function(tribits_scale_timeout TIMEOUT_IN SCALED_TIMEOUT_OUT) - IF (${PROJECT_NAME}_SCALE_TEST_TIMEOUT + if (${PROJECT_NAME}_SCALE_TEST_TIMEOUT AND NOT "${${PROJECT_NAME}_SCALE_TEST_TIMEOUT}" EQUAL "1.0" ) # Strip of any fractional part of the timeout - SPLIT("${TIMEOUT_IN}" "[.]" TIMEOUT_IN_ARRAY) - #PRINT_VAR(TIMEOUT_IN_ARRAY) - LIST(GET TIMEOUT_IN_ARRAY 0 TIMEOUT_IN_TRUNCATED) - #PRINT_VAR(TIMEOUT_IN_TRUNCATED) + split("${TIMEOUT_IN}" "[.]" TIMEOUT_IN_ARRAY) + #print_var(TIMEOUT_IN_ARRAY) + list(GET TIMEOUT_IN_ARRAY 0 TIMEOUT_IN_TRUNCATED) + #print_var(TIMEOUT_IN_TRUNCATED) # Split the factional part of the scaling factor into SCALE_TEST_INT and # SCALE_TEST_INT_FRAC and do the math ourself with integer floating pint - SPLIT("${${PROJECT_NAME}_SCALE_TEST_TIMEOUT}" "[.]" SCALE_TEST_ARRAY) - LIST(LENGTH SCALE_TEST_ARRAY SCALE_TEST_ARRAY_LEN) - #PRINT_VAR(SCALE_TEST_ARRAY_LEN) + split("${${PROJECT_NAME}_SCALE_TEST_TIMEOUT}" "[.]" SCALE_TEST_ARRAY) + list(LENGTH SCALE_TEST_ARRAY SCALE_TEST_ARRAY_LEN) + #print_var(SCALE_TEST_ARRAY_LEN) - LIST(GET SCALE_TEST_ARRAY 0 SCALE_TEST_INT) - #PRINT_VAR(SCALE_TEST_INT) + list(GET SCALE_TEST_ARRAY 0 SCALE_TEST_INT) + #print_var(SCALE_TEST_INT) - MATH(EXPR TIMEOUT_USED + math(EXPR TIMEOUT_USED "${TIMEOUT_IN_TRUNCATED} * ${SCALE_TEST_INT}") - #PRINT_VAR(TIMEOUT_USED) + #print_var(TIMEOUT_USED) - IF ("${SCALE_TEST_ARRAY_LEN}" GREATER 1) + if ("${SCALE_TEST_ARRAY_LEN}" GREATER 1) # Handle the factional part (only take the first digit) - LIST(GET SCALE_TEST_ARRAY 1 SCALE_TEST_INT_FRAC_FULL) # Could be more than 1 digit - #PRINT_VAR(SCALE_TEST_INT_FRAC_FULL) - STRING(SUBSTRING "${SCALE_TEST_INT_FRAC_FULL}" 0 1 SCALE_TEST_INT_FRAC) - #PRINT_VAR(SCALE_TEST_INT_FRAC) - MATH(EXPR TIMEOUT_USED + list(GET SCALE_TEST_ARRAY 1 SCALE_TEST_INT_FRAC_FULL) # Could be more than 1 digit + #print_var(SCALE_TEST_INT_FRAC_FULL) + string(SUBSTRING "${SCALE_TEST_INT_FRAC_FULL}" 0 1 SCALE_TEST_INT_FRAC) + #print_var(SCALE_TEST_INT_FRAC) + math(EXPR TIMEOUT_USED "${TIMEOUT_USED} + (${SCALE_TEST_INT_FRAC} * ${TIMEOUT_IN_TRUNCATED}) / 10") - #PRINT_VAR(TIMEOUT_USED) - ENDIF() + #print_var(TIMEOUT_USED) + endif() - ELSE() + else() - SET(TIMEOUT_USED "${TIMEOUT_IN}") + set(TIMEOUT_USED "${TIMEOUT_IN}") - ENDIF() + endif() - SET(${SCALED_TIMEOUT_OUT} ${TIMEOUT_USED} PARENT_SCOPE) + set(${SCALED_TIMEOUT_OUT} ${TIMEOUT_USED} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # # Function that converts a complete string of command-line arguments -# into a form that ADD_TEST(...) can correctly deal with. +# into a form that add_test(...) can correctly deal with. # # The main thing this function does is to replace spaces ' ' with -# array separators ';' since this is how ADD_TEST(...) expects to deal +# array separators ';' since this is how add_test(...) expects to deal # with command-line arguments, as array arguments. However, this # function will not do a replacement of ' ' with ';' if a quote is # active. This allows you to pass in quoted arguments and have them # treated as a single argument. # -FUNCTION(TRIBITS_CONVERT_CMND_ARG_STRING_TO_ADD_TEST_ARG_ARRAY CMND_ARG_STRING ARG_ARRAY_VARNAME) +function(tribits_convert_cmnd_arg_string_to_add_test_arg_array CMND_ARG_STRING ARG_ARRAY_VARNAME) - #MESSAGE("TRIBITS_CONVERT_CMND_ARG_STRING_TO_ADD_TEST_ARG_ARRAY") - #PRINT_VAR(CMND_ARG_STRING) - #PRINT_VAR(ARG_ARRAY_VARNAME) + #message("TRIBITS_CONVERT_CMND_ARG_STRING_TO_ADD_TEST_ARG_ARRAY") + #print_var(CMND_ARG_STRING) + #print_var(ARG_ARRAY_VARNAME) - STRING(LENGTH ${CMND_ARG_STRING} STR_LEN) - #PRINT_VAR(STR_LEN) + string(LENGTH ${CMND_ARG_STRING} STR_LEN) + #print_var(STR_LEN) - MATH(EXPR STR_LAST_IDX "${STR_LEN}-1") + math(EXPR STR_LAST_IDX "${STR_LEN}-1") - SET(NEWSTR) + set(NEWSTR) - SET(ACTIVE_QUOTE OFF) + set(ACTIVE_QUOTE OFF) - FOREACH(IDX RANGE ${STR_LAST_IDX}) + foreach(IDX RANGE ${STR_LAST_IDX}) - STRING(SUBSTRING ${CMND_ARG_STRING} ${IDX} 1 STR_CHAR) - #PRINT_VAR(STR_CHAR) + string(SUBSTRING ${CMND_ARG_STRING} ${IDX} 1 STR_CHAR) + #print_var(STR_CHAR) - IF (STR_CHAR STREQUAL "\"") - IF (NOT ACTIVE_QUOTE) - SET(ACTIVE_QUOTE ON) - ELSE() - SET(ACTIVE_QUOTE OFF) - ENDIF() - #PRINT_VAR(ACTIVE_QUOTE) - ENDIF() + if (STR_CHAR STREQUAL "\"") + if (NOT ACTIVE_QUOTE) + set(ACTIVE_QUOTE ON) + else() + set(ACTIVE_QUOTE OFF) + endif() + #print_var(ACTIVE_QUOTE) + endif() - IF (NOT STR_CHAR STREQUAL " ") - SET(NEWSTR "${NEWSTR}${STR_CHAR}") - ELSE() - IF (ACTIVE_QUOTE) - SET(NEWSTR "${NEWSTR}${STR_CHAR}") - ELSE() - SET(NEWSTR "${NEWSTR};") - ENDIF() - ENDIF() + if (NOT STR_CHAR STREQUAL " ") + set(NEWSTR "${NEWSTR}${STR_CHAR}") + else() + if (ACTIVE_QUOTE) + set(NEWSTR "${NEWSTR}${STR_CHAR}") + else() + set(NEWSTR "${NEWSTR};") + endif() + endif() - ENDFOREACH() + endforeach() - #PRINT_VAR(NEWSTR) + #print_var(NEWSTR) - SET(${ARG_ARRAY_VARNAME} ${NEWSTR} PARENT_SCOPE) + set(${ARG_ARRAY_VARNAME} ${NEWSTR} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # @@ -213,24 +213,24 @@ ENDFUNCTION() # package or subpackage. # -FUNCTION(TRIBITS_ADD_TEST_PROCESS_ENABLE_TESTS ADD_THE_TEST_OUT) - IF(${PACKAGE_NAME}_ENABLE_TESTS OR ${PARENT_PACKAGE_NAME}_ENABLE_TESTS) - SET(ADD_THE_TEST TRUE) - ELSE() - IF (PARENT_PACKAGE_NAME STREQUAL PACKAGE_NAME) - SET(PARENT_EANBLE_TESTS_DISABLE_MSG) - ELSE() - SET(PARENT_EANBLE_TESTS_DISABLE_MSG +function(tribits_add_test_process_enable_tests ADD_THE_TEST_OUT) + if(${PACKAGE_NAME}_ENABLE_TESTS OR ${PARENT_PACKAGE_NAME}_ENABLE_TESTS) + set(ADD_THE_TEST TRUE) + else() + if (PARENT_PACKAGE_NAME STREQUAL PACKAGE_NAME) + set(PARENT_EANBLE_TESTS_DISABLE_MSG) + else() + set(PARENT_EANBLE_TESTS_DISABLE_MSG ", ${PARENT_PACKAGE_NAME}_ENABLE_TESTS='${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}'" ) - ENDIF() - MESSAGE_WRAPPER( + endif() + message_wrapper( "-- ${TEST_NAME}: NOT added test because ${PACKAGE_NAME}_ENABLE_TESTS='${${PACKAGE_NAME}_ENABLE_TESTS}${PARENT_EANBLE_TESTS_DISABLE_MSG}'." ) - SET(ADD_THE_TEST FALSE) - ENDIF() - SET(${ADD_THE_TEST_OUT} ${ADD_THE_TEST} PARENT_SCOPE) -ENDFUNCTION() + set(ADD_THE_TEST FALSE) + endif() + set(${ADD_THE_TEST_OUT} ${ADD_THE_TEST} PARENT_SCOPE) +endfunction() # @@ -240,82 +240,82 @@ ENDFUNCTION() # implicitly due to scoping of CMake. # -FUNCTION(TRIBITS_ADD_TEST_PROCESS_HOST_HOSTTYPE ADD_THE_TEST_OUT) +function(tribits_add_test_process_host_hosttype ADD_THE_TEST_OUT) - IF ("${${PROJECT_NAME}_HOSTNAME}" STREQUAL "") - SET(${PROJECT_NAME}_HOSTNAME dummy_host) - ENDIF() + if ("${${PROJECT_NAME}_HOSTNAME}" STREQUAL "") + set(${PROJECT_NAME}_HOSTNAME dummy_host) + endif() - SET(ADD_THE_TEST TRUE) + set(ADD_THE_TEST TRUE) - IF (ADD_THE_TEST) - IF (NOT PARSE_HOST) - SET (PARSE_HOST ${${PROJECT_NAME}_HOSTNAME}) - ENDIF() + if (ADD_THE_TEST) + if (NOT PARSE_HOST) + set (PARSE_HOST ${${PROJECT_NAME}_HOSTNAME}) + endif() LIST (FIND PARSE_HOST ${${PROJECT_NAME}_HOSTNAME} INDEX_OF_HOSTNAME_IN_HOST_LIST) - IF (${INDEX_OF_HOSTNAME_IN_HOST_LIST} EQUAL -1) - SET(ADD_THE_TEST FALSE) - SET(HOST_MATCH_MSG + if (${INDEX_OF_HOSTNAME_IN_HOST_LIST} EQUAL -1) + set(ADD_THE_TEST FALSE) + set(HOST_MATCH_MSG "-- ${TEST_NAME}: NOT added test because ${PROJECT_NAME}_HOSTNAME='${${PROJECT_NAME}_HOSTNAME}' does not match list HOST='${PARSE_HOST}'!" ) - ENDIF() - ENDIF() + endif() + endif() - IF (ADD_THE_TEST) - IF (NOT PARSE_XHOST) - SET (PARSE_XHOST NONE) - ENDIF() + if (ADD_THE_TEST) + if (NOT PARSE_XHOST) + set (PARSE_XHOST NONE) + endif() LIST (FIND PARSE_XHOST ${${PROJECT_NAME}_HOSTNAME} INDEX_OF_HOSTNAME_IN_XHOST_LIST) - IF (NOT ${INDEX_OF_HOSTNAME_IN_XHOST_LIST} EQUAL -1) - SET(ADD_THE_TEST FALSE) - SET(HOST_MATCH_MSG + if (NOT ${INDEX_OF_HOSTNAME_IN_XHOST_LIST} EQUAL -1) + set(ADD_THE_TEST FALSE) + set(HOST_MATCH_MSG "-- ${TEST_NAME}: NOT added test because ${PROJECT_NAME}_HOSTNAME='${${PROJECT_NAME}_HOSTNAME}' matches list XHOST='${PARSE_XHOST}'!" ) - ENDIF() - ENDIF() + endif() + endif() - IF (ADD_THE_TEST) - IF (NOT PARSE_HOSTTYPE) - SET(PARSE_HOSTTYPE ${CMAKE_HOST_SYSTEM_NAME}) - ENDIF() + if (ADD_THE_TEST) + if (NOT PARSE_HOSTTYPE) + set(PARSE_HOSTTYPE ${CMAKE_HOST_SYSTEM_NAME}) + endif() LIST (FIND PARSE_HOSTTYPE ${CMAKE_HOST_SYSTEM_NAME} INDEX_OF_HOSTSYSTEMNAME_IN_HOSTTYPE_LIST) - IF (${INDEX_OF_HOSTSYSTEMNAME_IN_HOSTTYPE_LIST} EQUAL -1) - SET(ADD_THE_TEST FALSE) - SET(HOST_MATCH_MSG + if (${INDEX_OF_HOSTSYSTEMNAME_IN_HOSTTYPE_LIST} EQUAL -1) + set(ADD_THE_TEST FALSE) + set(HOST_MATCH_MSG "-- ${TEST_NAME}: NOT added test because CMAKE_HOST_SYSTEM_NAME='${CMAKE_HOST_SYSTEM_NAME}' does not match list HOSTTYPE='${PARSE_HOSTTYPE}'!" ) - ENDIF() - ENDIF() + endif() + endif() - IF (ADD_THE_TEST) - IF (NOT PARSE_XHOSTTYPE) - SET(PARSE_XHOSTTYPE NONE) - ENDIF() + if (ADD_THE_TEST) + if (NOT PARSE_XHOSTTYPE) + set(PARSE_XHOSTTYPE NONE) + endif() LIST (FIND PARSE_XHOSTTYPE ${CMAKE_HOST_SYSTEM_NAME} INDEX_OF_HOSTSYSTEMNAME_IN_XHOSTTYPE_LIST) - IF (NOT ${INDEX_OF_HOSTSYSTEMNAME_IN_XHOSTTYPE_LIST} EQUAL -1) - SET(ADD_THE_TEST FALSE) - SET(HOST_MATCH_MSG + if (NOT ${INDEX_OF_HOSTSYSTEMNAME_IN_XHOSTTYPE_LIST} EQUAL -1) + set(ADD_THE_TEST FALSE) + set(HOST_MATCH_MSG "-- ${TEST_NAME}: NOT added test because CMAKE_HOST_SYSTEM_NAME='${CMAKE_HOST_SYSTEM_NAME}' matches list XHOSTTYPE='${PARSE_XHOSTTYPE}'!" ) - ENDIF() - ENDIF() + endif() + endif() - FOREACH(VAR_NAME ${PARSE_EXCLUDE_IF_NOT_TRUE}) - IF (ADD_THE_TEST AND NOT ${VAR_NAME}) - SET(ADD_THE_TEST FALSE) - SET(HOST_MATCH_MSG + foreach(VAR_NAME ${PARSE_EXCLUDE_IF_NOT_TRUE}) + if (ADD_THE_TEST AND NOT ${VAR_NAME}) + set(ADD_THE_TEST FALSE) + set(HOST_MATCH_MSG "-- ${TEST_NAME}: NOT added test because EXCLUDE_IF_NOT_TRUE ${VAR_NAME}='${${VAR_NAME}}'!" ) - ENDIF() - ENDFOREACH() + endif() + endforeach() - IF (HOST_MATCH_MSG AND ${PROJECT_NAME}_TRACE_ADD_TEST) - MESSAGE_WRAPPER("${HOST_MATCH_MSG}") - ENDIF() + if (HOST_MATCH_MSG AND ${PROJECT_NAME}_TRACE_ADD_TEST) + message_wrapper("${HOST_MATCH_MSG}") + endif() - SET(${ADD_THE_TEST_OUT} ${ADD_THE_TEST} PARENT_SCOPE) + set(${ADD_THE_TEST_OUT} ${ADD_THE_TEST} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # @@ -324,81 +324,81 @@ ENDFUNCTION() # Warning: Argument PARSE_CATEGORIES is passed in implicitly due to scoping of # CMake. # -FUNCTION(TRIBITS_ADD_TEST_PROCESS_CATEGORIES ADD_THE_TEST_OUT) +function(tribits_add_test_process_categories ADD_THE_TEST_OUT) - TRIBITS_FILTER_AND_ASSERT_CATEGORIES(PARSE_CATEGORIES) - SET(PARSE_CATEGORIES ${PARSE_CATEGORIES} PARENT_SCOPE) + tribits_filter_and_assert_categories(PARSE_CATEGORIES) + set(PARSE_CATEGORIES ${PARSE_CATEGORIES} PARENT_SCOPE) - SET(ADD_THE_TEST FALSE) + set(ADD_THE_TEST FALSE) - # Set the default test-specific cateogry to basic if it is not set - IF (NOT PARSE_CATEGORIES) - SET (PARSE_CATEGORIES BASIC) - ENDIF() + # Set the default test-specific category to basic if it is not set + if (NOT PARSE_CATEGORIES) + set (PARSE_CATEGORIES BASIC) + endif() - #PRINT_VAR(${PROJECT_NAME}_TEST_CATEGORIES) - #PRINT_VAR(PARSE_CATEGORIES) + #print_var(${PROJECT_NAME}_TEST_CATEGORIES) + #print_var(PARSE_CATEGORIES) - IF ("${${PROJECT_NAME}_TEST_CATEGORIES}" STREQUAL "") + if ("${${PROJECT_NAME}_TEST_CATEGORIES}" STREQUAL "") # In case this is not a TriBITS project! - SET(${PROJECT_NAME}_TEST_CATEGORIES BASIC) - ENDIF() + set(${PROJECT_NAME}_TEST_CATEGORIES BASIC) + endif() # Process the test categories - ASSERT_DEFINED(${PROJECT_NAME}_TEST_CATEGORIES) - FOREACH(CATEGORY_USR_SET ${${PROJECT_NAME}_TEST_CATEGORIES}) - #PRINT_VAR(CATEGORY_USR_SET) - #PRINT_VAR(PARSE_CATEGORIES) - FOREACH(CATEGORY ${PARSE_CATEGORIES}) - IF (CATEGORY STREQUAL ${CATEGORY_USR_SET}) + assert_defined(${PROJECT_NAME}_TEST_CATEGORIES) + foreach(CATEGORY_USR_SET ${${PROJECT_NAME}_TEST_CATEGORIES}) + #print_var(CATEGORY_USR_SET) + #print_var(PARSE_CATEGORIES) + foreach(CATEGORY ${PARSE_CATEGORIES}) + if (CATEGORY STREQUAL ${CATEGORY_USR_SET}) # Exact match for the category, add the test - SET(ADD_THE_TEST TRUE) - ELSEIF(CATEGORY STREQUAL "BASIC") - IF (CATEGORY_USR_SET STREQUAL "CONTINUOUS" OR CATEGORY_USR_SET STREQUAL "NIGHTLY" + set(ADD_THE_TEST TRUE) + elseif(CATEGORY STREQUAL "BASIC") + if (CATEGORY_USR_SET STREQUAL "CONTINUOUS" OR CATEGORY_USR_SET STREQUAL "NIGHTLY" OR CATEGORY_USR_SET STREQUAL "HEAVY" ) - SET(ADD_THE_TEST TRUE) - ENDIF() - ELSEIF(CATEGORY STREQUAL "CONTINUOUS") - IF (CATEGORY_USR_SET STREQUAL "NIGHTLY" OR CATEGORY_USR_SET STREQUAL "HEAVY") - SET(ADD_THE_TEST TRUE) - ENDIF() - ELSEIF(CATEGORY STREQUAL "NIGHTLY") - IF (CATEGORY_USR_SET STREQUAL "HEAVY") - SET(ADD_THE_TEST TRUE) - ENDIF() - ELSE() + set(ADD_THE_TEST TRUE) + endif() + elseif(CATEGORY STREQUAL "CONTINUOUS") + if (CATEGORY_USR_SET STREQUAL "NIGHTLY" OR CATEGORY_USR_SET STREQUAL "HEAVY") + set(ADD_THE_TEST TRUE) + endif() + elseif(CATEGORY STREQUAL "NIGHTLY") + if (CATEGORY_USR_SET STREQUAL "HEAVY") + set(ADD_THE_TEST TRUE) + endif() + else() # No matches for the category, don't add the test - ENDIF() - ENDFOREACH() - ENDFOREACH() + endif() + endforeach() + endforeach() - #PRINT_VAR(TEST_NAME) - #PRINT_VAR(ADD_THE_TEST) - #PRINT_VAR(${PROJECT_NAME}_TRACE_ADD_TEST) + #print_var(TEST_NAME) + #print_var(ADD_THE_TEST) + #print_var(${PROJECT_NAME}_TRACE_ADD_TEST) - IF (TEST_NAME AND NOT ADD_THE_TEST AND ${PROJECT_NAME}_TRACE_ADD_TEST) - MESSAGE_WRAPPER( + if (TEST_NAME AND NOT ADD_THE_TEST AND ${PROJECT_NAME}_TRACE_ADD_TEST) + message_wrapper( "-- ${TEST_NAME}: NOT added test because ${PROJECT_NAME}_TEST_CATEGORIES='${${PROJECT_NAME}_TEST_CATEGORIES}' does not match this test's CATEGORIES='${PARSE_CATEGORIES}'!" ) - ENDIF() + endif() - SET(${ADD_THE_TEST_OUT} ${ADD_THE_TEST} PARENT_SCOPE) - #PRINT_VAR(${ADD_THE_TEST_OUT}) + set(${ADD_THE_TEST_OUT} ${ADD_THE_TEST} PARENT_SCOPE) + #print_var(${ADD_THE_TEST_OUT}) -ENDFUNCTION() +endfunction() # -# FUNCTION: TRIBITS_ADD_TEST_GET_EXE_BINARY_NAME() +# FUNCTION: tribits_add_test_get_exe_binary_name() # # Get the full name of a package executable given its root name and other # arguments. # # Usage: # -# TRIBITS_ADD_TEST_GET_EXE_BINARY_NAME( +# tribits_add_test_get_exe_binary_name( # # NOEXEPREFIX_IN # NOEXESUFFIX_IN @@ -410,117 +410,117 @@ ENDFUNCTION() # # ${PACKAGE_NAME}_${${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX} # -FUNCTION(TRIBITS_ADD_TEST_GET_EXE_BINARY_NAME EXE_NAME_IN +function(tribits_add_test_get_exe_binary_name EXE_NAME_IN NOEXEPREFIX_IN NOEXESUFFIX_IN ADD_DIR_TO_NAME EXE_BINARY_NAME_OUT ) - SET(EXE_BINARY_NAME "${EXE_NAME_IN}") - IF(PARSE_ADD_DIR_TO_NAME) - SET(DIRECTORY_NAME "") - TRIBITS_CREATE_NAME_FROM_CURRENT_SOURCE_DIRECTORY(DIRECTORY_NAME) - SET(EXE_BINARY_NAME "${DIRECTORY_NAME}_${EXE_BINARY_NAME}") - ENDIF() - IF (NOEXESUFFIX_IN) - SET(EXECUTABLE_SUFFIX "") - ELSE() - SET(EXECUTABLE_SUFFIX ${${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX}) - ENDIF() - SET(EXE_BINARY_NAME "${EXE_BINARY_NAME}${EXECUTABLE_SUFFIX}") - IF(PACKAGE_NAME AND NOT NOEXEPREFIX_IN) - SET(EXE_BINARY_NAME ${PACKAGE_NAME}_${EXE_BINARY_NAME}) - ENDIF() - SET(${EXE_BINARY_NAME_OUT} ${EXE_BINARY_NAME} PARENT_SCOPE) -ENDFUNCTION() + set(EXE_BINARY_NAME "${EXE_NAME_IN}") + if(PARSE_ADD_DIR_TO_NAME) + set(DIRECTORY_NAME "") + tribits_create_name_from_current_source_directory(DIRECTORY_NAME) + set(EXE_BINARY_NAME "${DIRECTORY_NAME}_${EXE_BINARY_NAME}") + endif() + if (NOEXESUFFIX_IN) + set(EXECUTABLE_SUFFIX "") + else() + set(EXECUTABLE_SUFFIX ${${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX}) + endif() + set(EXE_BINARY_NAME "${EXE_BINARY_NAME}${EXECUTABLE_SUFFIX}") + if(PACKAGE_NAME AND NOT NOEXEPREFIX_IN) + set(EXE_BINARY_NAME ${PACKAGE_NAME}_${EXE_BINARY_NAME}) + endif() + set(${EXE_BINARY_NAME_OUT} ${EXE_BINARY_NAME} PARENT_SCOPE) +endfunction() # # Adjust the directory path to an executable for a test # -FUNCTION(TRIBITS_ADD_TEST_ADJUST_DIRECTORY EXE_BINARY_NAME DIRECTORY +function(tribits_add_test_adjust_directory EXE_BINARY_NAME DIRECTORY EXECUTABLE_PATH_OUT ) - SET(EXECUTABLE_PATH "${EXE_BINARY_NAME}") + set(EXECUTABLE_PATH "${EXE_BINARY_NAME}") - IF (NOT IS_ABSOLUTE ${EXECUTABLE_PATH}) + if (NOT IS_ABSOLUTE ${EXECUTABLE_PATH}) - IF (CMAKE_CONFIGURATION_TYPE) - SET(EXECUTABLE_PATH "${CMAKE_CONFIGURATION_TYPE}/${EXECUTABLE_PATH}") - ENDIF() + if (CMAKE_CONFIGURATION_TYPE) + set(EXECUTABLE_PATH "${CMAKE_CONFIGURATION_TYPE}/${EXECUTABLE_PATH}") + endif() - IF (DIRECTORY) - SET(EXECUTABLE_PATH "${DIRECTORY}/${EXECUTABLE_PATH}") - ENDIF() + if (DIRECTORY) + set(EXECUTABLE_PATH "${DIRECTORY}/${EXECUTABLE_PATH}") + endif() - IF (NOT IS_ABSOLUTE ${EXECUTABLE_PATH}) - SET(EXECUTABLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_PATH}") - ENDIF() + if (NOT IS_ABSOLUTE ${EXECUTABLE_PATH}) + set(EXECUTABLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_PATH}") + endif() - ENDIF() + endif() - SET(${EXECUTABLE_PATH_OUT} ${EXECUTABLE_PATH} PARENT_SCOPE) + set(${EXECUTABLE_PATH_OUT} ${EXECUTABLE_PATH} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # # Get the number of MPI processes to use # -FUNCTION(TRIBITS_ADD_TEST_GET_NUM_PROCS_USED NUM_MPI_PROCS_IN +function(tribits_add_test_get_num_procs_used NUM_MPI_PROCS_IN NUM_MPI_PROCS_VAR_NAME_IN NUM_MPI_PROCS_USED_OUT NUM_MPI_PROCS_USED_NAME_OUT ) - IF (NOT TPL_ENABLE_MPI) - SET(MPI_EXEC_DEFAULT_NUMPROCS 1) - ELSEIF (NOT DEFINED MPI_EXEC_DEFAULT_NUMPROCS) - SET(MPI_EXEC_DEFAULT_NUMPROCS 1) - ENDIF() - IF (NOT TPL_ENABLE_MPI) - SET(MPI_EXEC_MAX_NUMPROCS 1) - ELSEIF (NOT DEFINED MPI_EXEC_MAX_NUMPROCS) - SET(MPI_EXEC_MAX_NUMPROCS 1) - ENDIF() - IF (NOT NUM_MPI_PROCS_IN) - SET(NUM_MPI_PROCS_IN ${MPI_EXEC_DEFAULT_NUMPROCS}) - SET(NUM_PROCS_VAR_NAME "MPI_EXEC_DEFAULT_NUMPROCS") - ELSE() - SET(NUM_PROCS_VAR_NAME "${NUM_MPI_PROCS_VAR_NAME_IN}") - ENDIF() - IF (${NUM_MPI_PROCS_IN} MATCHES [0-9]+-[0-9]+) - STRING(REGEX REPLACE "([0-9]+)-([0-9]+)" "\\1" MIN_NP ${NUM_MPI_PROCS_IN} ) - STRING(REGEX REPLACE "([0-9]+)-([0-9]+)" "\\2" MAX_NP ${NUM_MPI_PROCS_IN} ) - IF(${MIN_NP} LESS ${MPI_EXEC_MAX_NUMPROCS} AND + if (NOT TPL_ENABLE_MPI) + set(MPI_EXEC_DEFAULT_NUMPROCS 1) + elseif (NOT DEFINED MPI_EXEC_DEFAULT_NUMPROCS) + set(MPI_EXEC_DEFAULT_NUMPROCS 1) + endif() + if (NOT TPL_ENABLE_MPI) + set(MPI_EXEC_MAX_NUMPROCS 1) + elseif (NOT DEFINED MPI_EXEC_MAX_NUMPROCS) + set(MPI_EXEC_MAX_NUMPROCS 1) + endif() + if (NOT NUM_MPI_PROCS_IN) + set(NUM_MPI_PROCS_IN ${MPI_EXEC_DEFAULT_NUMPROCS}) + set(NUM_PROCS_VAR_NAME "MPI_EXEC_DEFAULT_NUMPROCS") + else() + set(NUM_PROCS_VAR_NAME "${NUM_MPI_PROCS_VAR_NAME_IN}") + endif() + if (${NUM_MPI_PROCS_IN} MATCHES [0-9]+-[0-9]+) + string(REGEX REPLACE "([0-9]+)-([0-9]+)" "\\1" MIN_NP ${NUM_MPI_PROCS_IN} ) + string(REGEX REPLACE "([0-9]+)-([0-9]+)" "\\2" MAX_NP ${NUM_MPI_PROCS_IN} ) + if(${MIN_NP} LESS ${MPI_EXEC_MAX_NUMPROCS} AND ${MAX_NP} GREATER ${MPI_EXEC_MAX_NUMPROCS} ) - SET(NUM_PROCS_USED ${MPI_EXEC_MAX_NUMPROCS}) - ELSEIF (${MIN_NP} EQUAL ${MPI_EXEC_MAX_NUMPROCS}) - SET(NUM_PROCS_USED ${MIN_NP}) - ELSEIF (${MAX_NP} EQUAL ${MPI_EXEC_MAX_NUMPROCS}) - SET(NUM_PROCS_USED ${MAX_NP}) - ELSEIF (${MAX_NP} LESS ${MPI_EXEC_MAX_NUMPROCS}) - SET(NUM_PROCS_USED ${MAX_NP}) - ELSE() + set(NUM_PROCS_USED ${MPI_EXEC_MAX_NUMPROCS}) + elseif (${MIN_NP} EQUAL ${MPI_EXEC_MAX_NUMPROCS}) + set(NUM_PROCS_USED ${MIN_NP}) + elseif (${MAX_NP} EQUAL ${MPI_EXEC_MAX_NUMPROCS}) + set(NUM_PROCS_USED ${MAX_NP}) + elseif (${MAX_NP} LESS ${MPI_EXEC_MAX_NUMPROCS}) + set(NUM_PROCS_USED ${MAX_NP}) + else() # The number of available processors is outside the given range so the # test should not be run. - SET(NUM_PROCS_USED -1) - ENDIF() - ELSEIF (${NUM_MPI_PROCS_IN} MATCHES [0-9]+,[0-9]+) - MESSAGE(SEND_ERROR "The test ${TEST_NAME} can not be added yet" + set(NUM_PROCS_USED -1) + endif() + elseif (${NUM_MPI_PROCS_IN} MATCHES [0-9]+,[0-9]+) + message(SEND_ERROR "The test ${TEST_NAME} can not be added yet" " because it we do not yet support the form of" " NUM_MPI_PROCS=${NUM_MPI_PROCS_IN}") - SET(NUM_PROCS_USED -1) - ELSE() - IF(${NUM_MPI_PROCS_IN} GREATER ${MPI_EXEC_MAX_NUMPROCS}) - SET(NUM_PROCS_USED -1) - IF (${PROJECT_NAME}_TRACE_ADD_TEST) - MESSAGE_WRAPPER("-- ${TEST_NAME}: NOT added test because ${NUM_PROCS_VAR_NAME}='${NUM_MPI_PROCS_IN}' > MPI_EXEC_MAX_NUMPROCS='${MPI_EXEC_MAX_NUMPROCS}'!") - ENDIF() - ELSE() - SET(NUM_PROCS_USED ${NUM_MPI_PROCS_IN}) - ENDIF() - ENDIF() - SET(${NUM_MPI_PROCS_USED_OUT} ${NUM_PROCS_USED} PARENT_SCOPE) - SET(${NUM_MPI_PROCS_USED_NAME_OUT} ${NUM_PROCS_VAR_NAME} PARENT_SCOPE) -ENDFUNCTION() + set(NUM_PROCS_USED -1) + else() + if(${NUM_MPI_PROCS_IN} GREATER ${MPI_EXEC_MAX_NUMPROCS}) + set(NUM_PROCS_USED -1) + if (${PROJECT_NAME}_TRACE_ADD_TEST) + message_wrapper("-- ${TEST_NAME}: NOT added test because ${NUM_PROCS_VAR_NAME}='${NUM_MPI_PROCS_IN}' > MPI_EXEC_MAX_NUMPROCS='${MPI_EXEC_MAX_NUMPROCS}'!") + endif() + else() + set(NUM_PROCS_USED ${NUM_MPI_PROCS_IN}) + endif() + endif() + set(${NUM_MPI_PROCS_USED_OUT} ${NUM_PROCS_USED} PARENT_SCOPE) + set(${NUM_MPI_PROCS_USED_NAME_OUT} ${NUM_PROCS_VAR_NAME} PARENT_SCOPE) +endfunction() # @@ -528,11 +528,11 @@ ENDFUNCTION() # # NOTE: The extra test program arguments are passed through ${ARGN}. # -FUNCTION( TRIBITS_ADD_TEST_GET_TEST_CMND_ARRAY CMND_ARRAY_OUT +function( tribits_add_test_get_test_cmnd_array CMND_ARRAY_OUT EXECUTABLE_PATH NUM_PROCS_USED ) - IF (TPL_ENABLE_MPI) - SET(${CMND_ARRAY_OUT} + if (TPL_ENABLE_MPI) + set(${CMND_ARRAY_OUT} "${MPI_EXEC}" ${MPI_EXEC_PRE_NUMPROCS_FLAGS} ${MPI_EXEC_NUMPROCS_FLAG} ${NUM_PROCS_USED} @@ -541,111 +541,111 @@ FUNCTION( TRIBITS_ADD_TEST_GET_TEST_CMND_ARRAY CMND_ARRAY_OUT ${ARGN} PARENT_SCOPE ) - ELSE() - SET(${CMND_ARRAY_OUT} + else() + set(${CMND_ARRAY_OUT} "${EXECUTABLE_PATH}" ${ARGN} PARENT_SCOPE ) - ENDIF() -ENDFUNCTION() + endif() +endfunction() # # Get the number of cores used by process # -FUNCTION(TRIBITS_ADD_TEST_GET_NUM_TOTAL_CORES_USED TEST_NAME_IN +function(tribits_add_test_get_num_total_cores_used TEST_NAME_IN NUM_TOTAL_CORES_USED_IN NUM_TOTAL_CORES_USED_NAME_IN NUM_PROCS_USED_IN NUM_PROCS_USED_NAME_IN NUM_TOTAL_CORES_USED_OUT SKIP_TEST_OUT ) - SET(SKIP_TEST FALSE) + set(SKIP_TEST FALSE) - IF (NUM_TOTAL_CORES_USED_IN) + if (NUM_TOTAL_CORES_USED_IN) - SET(NUM_TOTAL_CORES_USED ${NUM_TOTAL_CORES_USED_IN}) + set(NUM_TOTAL_CORES_USED ${NUM_TOTAL_CORES_USED_IN}) - IF (NUM_TOTAL_CORES_USED_IN GREATER MPI_EXEC_MAX_NUMPROCS) - IF (${PROJECT_NAME}_TRACE_ADD_TEST) - MESSAGE_WRAPPER( + if (NUM_TOTAL_CORES_USED_IN GREATER MPI_EXEC_MAX_NUMPROCS) + if (${PROJECT_NAME}_TRACE_ADD_TEST) + message_wrapper( "-- ${TEST_NAME_IN}: NOT added test because ${NUM_TOTAL_CORES_USED_NAME_IN}='${NUM_TOTAL_CORES_USED_IN}' > MPI_EXEC_MAX_NUMPROCS='${MPI_EXEC_MAX_NUMPROCS}'!" ) - ENDIF() - SET(SKIP_TEST TRUE) - ENDIF() + endif() + set(SKIP_TEST TRUE) + endif() - IF (NUM_PROCS_USED_IN GREATER NUM_TOTAL_CORES_USED_IN) - MESSAGE_WRAPPER( + if (NUM_PROCS_USED_IN GREATER NUM_TOTAL_CORES_USED_IN) + message_wrapper( FATAL_ERROR "ERROR: ${TEST_NAME_IN}: ${NUM_PROCS_USED_NAME_IN}='${NUM_PROCS_USED}' > ${NUM_TOTAL_CORES_USED_NAME_IN}='${NUM_TOTAL_CORES_USED_IN}' not allowed!" ) - SET(SKIP_TEST TRUE) # For unit testing since above will not abort! - ENDIF() + set(SKIP_TEST TRUE) # For unit testing since above will not abort! + endif() - ELSE() + else() - SET(NUM_TOTAL_CORES_USED ${NUM_PROCS_USED_IN}) + set(NUM_TOTAL_CORES_USED ${NUM_PROCS_USED_IN}) - ENDIF() + endif() - SET(${NUM_TOTAL_CORES_USED_OUT} ${NUM_TOTAL_CORES_USED} PARENT_SCOPE) - SET(${SKIP_TEST_OUT} ${SKIP_TEST} PARENT_SCOPE) + set(${NUM_TOTAL_CORES_USED_OUT} ${NUM_TOTAL_CORES_USED} PARENT_SCOPE) + set(${SKIP_TEST_OUT} ${SKIP_TEST} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # # Read ${TEST_NAME_IN}_SET_DISABLED_AND_MSG and set output var -# as used by the TRIBITS_ADD[_ADVANCED]_TEST() +# as used by the TRIBITS_ADD[_ADVANCED]_test() # functions. # # Usage: # -# TRIBITS_SET_DISABLED_AND_MSG( +# tribits_set_disabled_and_msg( # # The full test name passed to add_test() -# "${PARSE_DISABLED}" # From the input arg "DISABLED " to TA[A]T() +# "${PARSE_DISABLED}" # From the input arg "DISABLED " to TA[A]t() # # Sets var of this name on output # ) # -FUNCTION(TRIBITS_SET_DISABLED_AND_MSG TEST_NAME_IN PARSE_DISABLED +function(tribits_set_disabled_and_msg TEST_NAME_IN PARSE_DISABLED SET_DISABLED_AND_MSG_OUT ) - SET(SET_DISABLED_AND_MSG "${PARSE_DISABLED}") - IF (NOT "${${TEST_NAME_IN}_SET_DISABLED_AND_MSG}" STREQUAL "") # Override! - SET(SET_DISABLED_AND_MSG "${${TEST_NAME_IN}_SET_DISABLED_AND_MSG}") - ENDIF() + set(SET_DISABLED_AND_MSG "${PARSE_DISABLED}") + if (NOT "${${TEST_NAME_IN}_SET_DISABLED_AND_MSG}" STREQUAL "") # Override! + set(SET_DISABLED_AND_MSG "${${TEST_NAME_IN}_SET_DISABLED_AND_MSG}") + endif() - SET(${SET_DISABLED_AND_MSG_OUT} "${SET_DISABLED_AND_MSG}" PARENT_SCOPE) + set(${SET_DISABLED_AND_MSG_OUT} "${SET_DISABLED_AND_MSG}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() # # Read ${TEST_NAME_IN}_SET_RUN_SERIAL and set output var SET_RUN_SERIAL_OUT as -# used by the TRIBITS_ADD[_ADVANCED]_TEST() functions. +# used by the TRIBITS_ADD[_ADVANCED]_test() functions. # # Usage: # -# TRIBITS_SET_RUN_SERIAL( +# tribits_set_run_serial( # # The full test name passed to add_test() -# "${PARSE_RUN_SERIAL}" # From the input option "RUN_SERIAL" to TA[A]T() +# "${PARSE_RUN_SERIAL}" # From the input option "RUN_SERIAL" to TA[A]t() # # Sets var of this name on output # ) # -FUNCTION(TRIBITS_SET_RUN_SERIAL TEST_NAME_IN PARSE_RUN_SERIAL +function(tribits_set_run_serial TEST_NAME_IN PARSE_RUN_SERIAL SET_RUN_SERIAL_OUT ) - SET(SET_RUN_SERIAL "${PARSE_RUN_SERIAL}") - IF (NOT "${${TEST_NAME_IN}_SET_RUN_SERIAL}" STREQUAL "") # Override! - SET(SET_RUN_SERIAL "${${TEST_NAME_IN}_SET_RUN_SERIAL}") - ENDIF() + set(SET_RUN_SERIAL "${PARSE_RUN_SERIAL}") + if (NOT "${${TEST_NAME_IN}_SET_RUN_SERIAL}" STREQUAL "") # Override! + set(SET_RUN_SERIAL "${${TEST_NAME_IN}_SET_RUN_SERIAL}") + endif() - SET(${SET_RUN_SERIAL_OUT} "${SET_RUN_SERIAL}" PARENT_SCOPE) + set(${SET_RUN_SERIAL_OUT} "${SET_RUN_SERIAL}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() # @@ -653,203 +653,203 @@ ENDFUNCTION() # # Usage: # -# TRIBITS_ADD_TEST_QUERY_DISABLE( +# tribits_add_test_query_disable( # # Set var of this name on output # ) # -FUNCTION(TRIBITS_ADD_TEST_QUERY_DISABLE DISABLE_TEST_VAR_OUT) +function(tribits_add_test_query_disable DISABLE_TEST_VAR_OUT) - #MESSAGE("TRIBITS_ADD_TEST_QUERY_DISABLE(): ${DISABLE_TEST_VAR_OUT} ${ARGN}") - LIST(GET ARGN 0 TEST_NAME_IN) - SET(TEST_NAME_DISABLE_VAR ${TEST_NAME_IN}_DISABLE) - #PRINT_VAR(${TEST_NAME_DISABLE_VAR}) - IF (${TEST_NAME_DISABLE_VAR}) - IF (${PROJECT_NAME}_TRACE_ADD_TEST) - MESSAGE_WRAPPER( + #message("tribits_add_test_query_disable(): ${DISABLE_TEST_VAR_OUT} ${ARGN}") + list(GET ARGN 0 TEST_NAME_IN) + set(TEST_NAME_DISABLE_VAR ${TEST_NAME_IN}_DISABLE) + #print_var(${TEST_NAME_DISABLE_VAR}) + if (${TEST_NAME_DISABLE_VAR}) + if (${PROJECT_NAME}_TRACE_ADD_TEST) + message_wrapper( "-- ${TEST_NAME_IN}: NOT added test because ${TEST_NAME_DISABLE_VAR}='${${TEST_NAME_DISABLE_VAR}}'!") - ENDIF() - SET(${DISABLE_TEST_VAR_OUT} ON PARENT_SCOPE) - ELSE() - SET(${DISABLE_TEST_VAR_OUT} OFF PARENT_SCOPE) - ENDIF() + endif() + set(${DISABLE_TEST_VAR_OUT} ON PARENT_SCOPE) + else() + set(${DISABLE_TEST_VAR_OUT} OFF PARENT_SCOPE) + endif() -ENDFUNCTION() +endfunction() # # Determine if to disable test due to _SKIP_CTEST_ADD_TEST=ON # -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 +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}'") - ELSE() - SET(DISABLE_VAR_MSG + else() + set(DISABLE_VAR_MSG "${PARENT_PACKAGE_NAME}_SKIP_CTEST_ADD_TEST='${${PARENT_PACKAGE_NAME}_SKIP_CTEST_ADD_TEST}'") - ENDIF() - MESSAGE_WRAPPER( + endif() + message_wrapper( "-- ${TEST_NAME}: NOT added test because ${DISABLE_VAR_MSG}!") - SET(ADD_THE_TEST FALSE) - ELSE() - SET(ADD_THE_TEST TRUE) - ENDIF() - SET(${ADD_THE_TEST_OUT} ${ADD_THE_TEST} PARENT_SCOPE) -ENDFUNCTION() + set(ADD_THE_TEST FALSE) + else() + set(ADD_THE_TEST TRUE) + endif() + set(${ADD_THE_TEST_OUT} ${ADD_THE_TEST} PARENT_SCOPE) +endfunction() # # Wrapper for adding a test to facilitate unit testing # -FUNCTION(TRIBITS_ADD_TEST_ADD_TEST TEST_NAME EXE_NAME) +function(tribits_add_test_add_test TEST_NAME EXE_NAME) - IF (TRIBITS_ADD_TEST_ADD_TEST_CAPTURE) - APPEND_GLOBAL_SET(TRIBITS_ADD_TEST_ADD_TEST_INPUT NAME ${TEST_NAME} COMMAND ${ARGN}) - ENDIF() + if (TRIBITS_ADD_TEST_ADD_TEST_CAPTURE) + append_global_set(TRIBITS_ADD_TEST_ADD_TEST_INPUT NAME ${TEST_NAME} COMMAND ${ARGN}) + endif() - IF (NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) - ADD_TEST(NAME ${TEST_NAME} COMMAND ${ARGN}) - ENDIF() + if (NOT TRIBITS_ADD_TEST_ADD_TEST_UNITTEST) + add_test(NAME ${TEST_NAME} COMMAND ${ARGN}) + endif() - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES REQUIRED_FILES ${EXE_NAME}) + tribits_set_tests_properties(${TEST_NAME} PROPERTIES REQUIRED_FILES ${EXE_NAME}) -ENDFUNCTION() +endfunction() # # Set the pass/fail properties of a test that has already been added # -FUNCTION(TRIBITS_PRIVATE_ADD_TEST_SET_PASSFAIL_PROPERTIES TEST_NAME_IN) +function(tribits_private_add_test_set_passfail_properties TEST_NAME_IN) # PASS_REGULAR_EXPRESSION - IF (PARSE_STANDARD_PASS_OUTPUT) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME_IN} PROPERTIES PASS_REGULAR_EXPRESSION + if (PARSE_STANDARD_PASS_OUTPUT) + tribits_set_tests_properties(${TEST_NAME_IN} PROPERTIES PASS_REGULAR_EXPRESSION "End Result: TEST PASSED") - ENDIF() + endif() - IF (PARSE_PASS_REGULAR_EXPRESSION) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME_IN} PROPERTIES PASS_REGULAR_EXPRESSION + if (PARSE_PASS_REGULAR_EXPRESSION) + tribits_set_tests_properties(${TEST_NAME_IN} PROPERTIES PASS_REGULAR_EXPRESSION ${PARSE_PASS_REGULAR_EXPRESSION}) - ENDIF() + endif() - IF (PARSE_WILL_FAIL) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME_IN} PROPERTIES WILL_FAIL ON) - ENDIF() + if (PARSE_WILL_FAIL) + tribits_set_tests_properties(${TEST_NAME_IN} PROPERTIES WILL_FAIL ON) + endif() # FAIL_REGULAR_EXPRESSION - IF (PARSE_FAIL_REGULAR_EXPRESSION) - TRIBITS_SET_TEST_PROPERTY(${TEST_NAME_IN} APPEND PROPERTY FAIL_REGULAR_EXPRESSION + if (PARSE_FAIL_REGULAR_EXPRESSION) + tribits_set_test_property(${TEST_NAME_IN} APPEND PROPERTY FAIL_REGULAR_EXPRESSION "${PARSE_FAIL_REGULAR_EXPRESSION}") - ENDIF() + endif() - IF (${PACKAGE_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE OR + if (${PACKAGE_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE OR ${PROJECT_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE ) - TRIBITS_SET_TEST_PROPERTY(${TEST_NAME_IN} APPEND PROPERTY FAIL_REGULAR_EXPRESSION + tribits_set_test_property(${TEST_NAME_IN} APPEND PROPERTY FAIL_REGULAR_EXPRESSION "The following Teuchos::RCPNode objects were created") # NOTE: The above string must be kept in sync with the C++ code! - ENDIF() + endif() # ToDo: Make a variable ${PROJECT_NAME}_EXTRA_FAIL_REGULAR_EXPRESSION and # move the above logic to Trilinos somehow. -ENDFUNCTION() +endfunction() # # Set the timeout for a test already aded # -FUNCTION(TRIBITS_PRIVATE_ADD_TEST_SET_TIMEOUT TEST_NAME_IN TIMEOUT_USED_OUT) +function(tribits_private_add_test_set_timeout TEST_NAME_IN TIMEOUT_USED_OUT) - IF (PARSE_TIMEOUT) - TRIBITS_SCALE_TIMEOUT("${PARSE_TIMEOUT}" TIMEOUT_USED) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME_IN} PROPERTIES TIMEOUT ${TIMEOUT_USED}) - ELSE() - SET(TIMEOUT_USED "") - ENDIF() + if (PARSE_TIMEOUT) + tribits_scale_timeout("${PARSE_TIMEOUT}" TIMEOUT_USED) + tribits_set_tests_properties(${TEST_NAME_IN} PROPERTIES TIMEOUT ${TIMEOUT_USED}) + else() + set(TIMEOUT_USED "") + endif() - SET(${TIMEOUT_USED_OUT} ${TIMEOUT_USED} PARENT_SCOPE) + set(${TIMEOUT_USED_OUT} ${TIMEOUT_USED} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # # Set the environment for a test already aded # -FUNCTION(TRIBITS_PRIVATE_ADD_TEST_SET_ENVIRONMENT TEST_NAME_IN) +function(tribits_private_add_test_set_environment TEST_NAME_IN) - IF (PARSE_ENVIRONMENT) - TRIBITS_SET_TEST_PROPERTY(${TEST_NAME_IN} PROPERTY ENVIRONMENT ${PARSE_ENVIRONMENT}) - ENDIF() + if (PARSE_ENVIRONMENT) + tribits_set_test_property(${TEST_NAME_IN} PROPERTY ENVIRONMENT ${PARSE_ENVIRONMENT}) + endif() -ENDFUNCTION() +endfunction() # # Set the environment for a test already aded # -FUNCTION(TRIBITS_PRIVATE_ADD_TEST_SET_PROCESSORS TEST_NAME_IN +function(tribits_private_add_test_set_processors TEST_NAME_IN NUM_TOTAL_CORES_USED_IN PROCESSORS_OUT ) - SET(PROCESSORS_USED ${NUM_TOTAL_CORES_USED_IN}) + set(PROCESSORS_USED ${NUM_TOTAL_CORES_USED_IN}) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME_IN} PROPERTIES PROCESSORS + tribits_set_tests_properties(${TEST_NAME_IN} PROPERTIES PROCESSORS "${PROCESSORS_USED}") - SET(${PROCESSORS_OUT} ${PROCESSORS_USED} PARENT_SCOPE) + set(${PROCESSORS_OUT} ${PROCESSORS_USED} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # # Print test added message! # -FUNCTION(TRIBITS_PRIVATE_ADD_TEST_PRINT_ADDED TEST_NAME_IN CATEGORIES_IN +function(tribits_private_add_test_print_added TEST_NAME_IN CATEGORIES_IN NUM_MPI_PROCS_IN PROCESSORS_IN TIMEOUT_IN RUN_SERIAL_IN DISABLED_MSG_IN ) - SET(ADDED_TEST_PROPS "") - TRIBITS_GET_CATEGORIES_STRING("${CATEGORIES_IN}" CATEGORIES_IN_COMMAS) - APPEND_STRING_VAR_WITH_SEP(ADDED_TEST_PROPS + set(ADDED_TEST_PROPS "") + tribits_get_categories_string("${CATEGORIES_IN}" CATEGORIES_IN_COMMAS) + append_string_var_with_sep(ADDED_TEST_PROPS ", " "${CATEGORIES_IN_COMMAS}") - IF (NUM_MPI_PROCS_IN AND TPL_ENABLE_MPI) - APPEND_STRING_VAR_WITH_SEP(ADDED_TEST_PROPS + if (NUM_MPI_PROCS_IN AND TPL_ENABLE_MPI) + append_string_var_with_sep(ADDED_TEST_PROPS ", " "NUM_MPI_PROCS=${NUM_MPI_PROCS_IN}") - ENDIF() - IF (PROCESSORS_IN) - APPEND_STRING_VAR_WITH_SEP(ADDED_TEST_PROPS + endif() + if (PROCESSORS_IN) + append_string_var_with_sep(ADDED_TEST_PROPS ", " "PROCESSORS=${PROCESSORS_IN}") - ENDIF() - IF (TIMEOUT_IN) - APPEND_STRING_VAR_WITH_SEP(ADDED_TEST_PROPS + endif() + if (TIMEOUT_IN) + append_string_var_with_sep(ADDED_TEST_PROPS ", " "TIMEOUT=${TIMEOUT_IN}") - ENDIF() + endif() - IF (RUN_SERIAL_IN) - APPEND_STRING_VAR_WITH_SEP(ADDED_TEST_PROPS + if (RUN_SERIAL_IN) + append_string_var_with_sep(ADDED_TEST_PROPS ", " "RUN_SERIAL") - ENDIF() + endif() - IF (DISABLED_MSG_IN) - APPEND_STRING_VAR_WITH_SEP(ADDED_TEST_PROPS + if (DISABLED_MSG_IN) + append_string_var_with_sep(ADDED_TEST_PROPS ", " "DISABLED") - ENDIF() + endif() - IF (ADDED_TEST_PROPS) - SET(ADDED_TEST_PROPS " (${ADDED_TEST_PROPS})") - ENDIF() + if (ADDED_TEST_PROPS) + set(ADDED_TEST_PROPS " (${ADDED_TEST_PROPS})") + endif() - IF (${PROJECT_NAME}_TRACE_ADD_TEST) - MESSAGE_WRAPPER("-- ${TEST_NAME_IN}: Added test${ADDED_TEST_PROPS}!") - IF (DISABLED_MSG_IN) - MESSAGE_WRAPPER("-- => Reason DISABLED: ${DISABLED_MSG_IN}") - ENDIF() - ENDIF() + if (${PROJECT_NAME}_TRACE_ADD_TEST) + message_wrapper("-- ${TEST_NAME_IN}: Added test${ADDED_TEST_PROPS}!") + if (DISABLED_MSG_IN) + message_wrapper("-- => Reason DISABLED: ${DISABLED_MSG_IN}") + endif() + endif() -ENDFUNCTION() +endfunction() # @@ -857,105 +857,105 @@ ENDFUNCTION() # # NOTE: Pass the command arguments on the end in ARGSN. # -FUNCTION(TRIBITS_ADD_TEST_ADD_TEST_ALL TEST_NAME_IN +function(tribits_add_test_add_test_all TEST_NAME_IN EXECUTABLE_PATH_IN CATEGORIES_IN NUM_PROCS_USED_IN NUM_TOTAL_CORES_USED_IN RUN_SERIAL_IN DISABLED_MSG_IN ADDED_TEST_NAME_OUT ) - TRIBITS_ADD_TEST_GET_TEST_CMND_ARRAY( CMND_ARRAY + tribits_add_test_get_test_cmnd_array( CMND_ARRAY "${EXECUTABLE_PATH_IN}" "${NUM_PROCS_USED_IN}" ${ARGN} ) - TRIBITS_ADD_TEST_QUERY_DISABLE(DISABLE_THIS_TEST ${TEST_NAME_IN}) + tribits_add_test_query_disable(DISABLE_THIS_TEST ${TEST_NAME_IN}) - IF (NOT DISABLE_THIS_TEST) + if (NOT DISABLE_THIS_TEST) - TRIBITS_ADD_TEST_ADD_TEST(${TEST_NAME_IN} ${EXECUTABLE_PATH_IN} ${CMND_ARRAY}) - SET(${ADDED_TEST_NAME_OUT} ${TEST_NAME_IN} PARENT_SCOPE) + tribits_add_test_add_test(${TEST_NAME_IN} ${EXECUTABLE_PATH_IN} ${CMND_ARRAY}) + set(${ADDED_TEST_NAME_OUT} ${TEST_NAME_IN} PARENT_SCOPE) - TRIBITS_PRIVATE_ADD_TEST_POST_PROCESS_ADDED_TEST(${TEST_NAME_IN} + tribits_private_add_test_post_process_added_test(${TEST_NAME_IN} "${CATEGORIES_IN}" ${NUM_PROCS_USED_IN} "${NUM_TOTAL_CORES_USED_IN}" "${RUN_SERIAL_IN}" "${DISABLED_MSG_IN}") - ELSE() + else() - SET(${ADDED_TEST_NAME_OUT} "" PARENT_SCOPE) + set(${ADDED_TEST_NAME_OUT} "" PARENT_SCOPE) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # # Set the label and keywords # -FUNCTION(TRIBITS_PRIVATE_ADD_TEST_ADD_LABEL_AND_KEYWORDS TEST_NAME_IN) +function(tribits_private_add_test_add_label_and_keywords TEST_NAME_IN) - TRIBITS_SET_TEST_PROPERTY(${TEST_NAME_IN} APPEND PROPERTY + tribits_set_test_property(${TEST_NAME_IN} APPEND PROPERTY LABELS ${PARENT_PACKAGE_NAME}) - IF(PARSE_KEYWORDS) - TRIBITS_SET_TEST_PROPERTY(${TEST_NAME_IN} APPEND PROPERTY + if(PARSE_KEYWORDS) + tribits_set_test_property(${TEST_NAME_IN} APPEND PROPERTY LABELS ${PARSE_KEYWORDS}) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # # Postprocess a test that was added # -FUNCTION(TRIBITS_PRIVATE_ADD_TEST_POST_PROCESS_ADDED_TEST TEST_NAME_IN +function(tribits_private_add_test_post_process_added_test TEST_NAME_IN CATEGORIES_IN NUM_PROCS_USED_IN NUM_TOTAL_CORES_USED_IN RUN_SERIAL_IN DISABLED_MSG_IN ) - TRIBITS_PRIVATE_ADD_TEST_SET_PASSFAIL_PROPERTIES(${TEST_NAME_IN}) - TRIBITS_PRIVATE_ADD_TEST_SET_ENVIRONMENT(${TEST_NAME_IN}) - TRIBITS_PRIVATE_ADD_TEST_SET_PROCESSORS(${TEST_NAME_IN} + tribits_private_add_test_set_passfail_properties(${TEST_NAME_IN}) + tribits_private_add_test_set_environment(${TEST_NAME_IN}) + tribits_private_add_test_set_processors(${TEST_NAME_IN} "${NUM_TOTAL_CORES_USED_IN}" PROCESSORS_USED) - TRIBITS_PRIVATE_ADD_TEST_SET_TIMEOUT(${TEST_NAME_IN} TIMEOUT_USED) + tribits_private_add_test_set_timeout(${TEST_NAME_IN} TIMEOUT_USED) - IF(RUN_SERIAL_IN) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME_IN} PROPERTIES RUN_SERIAL ON) - ENDIF() + if(RUN_SERIAL_IN) + tribits_set_tests_properties(${TEST_NAME_IN} PROPERTIES RUN_SERIAL ON) + endif() - IF(DISABLED_MSG_IN) - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME_IN} PROPERTIES DISABLED ON) - ENDIF() + if(DISABLED_MSG_IN) + tribits_set_tests_properties(${TEST_NAME_IN} PROPERTIES DISABLED ON) + endif() - TRIBITS_PRIVATE_ADD_TEST_ADD_ENVIRONMENT_AND_RESOURCE(${TEST_NAME_IN} + tribits_private_add_test_add_environment_and_resource(${TEST_NAME_IN} ${NUM_PROCS_USED_IN}) - TRIBITS_PRIVATE_ADD_TEST_ADD_LABEL_AND_KEYWORDS(${TEST_NAME_IN}) + tribits_private_add_test_add_label_and_keywords(${TEST_NAME_IN}) - TRIBITS_PRIVATE_ADD_TEST_PRINT_ADDED(${TEST_NAME_IN} + tribits_private_add_test_print_added(${TEST_NAME_IN} "${CATEGORIES_IN}" "${NUM_PROCS_USED_IN}" "${PROCESSORS_USED}" "${TIMEOUT_USED}" "${RUN_SERIAL_IN}" "${DISABLED_MSG_IN}") -ENDFUNCTION() +endfunction() # # Add environment and resource properties to a test # -FUNCTION(TRIBITS_PRIVATE_ADD_TEST_ADD_ENVIRONMENT_AND_RESOURCE TEST_NAME_IN +function(tribits_private_add_test_add_environment_and_resource TEST_NAME_IN NUM_PROCS_USED_IN ) - IF(TRIBITS_TEST_EXTRA_ENVIRONMENT) - TRIBITS_SET_TEST_PROPERTY(${TEST_NAME_IN} APPEND PROPERTY ENVIRONMENT + if(TRIBITS_TEST_EXTRA_ENVIRONMENT) + tribits_set_test_property(${TEST_NAME_IN} APPEND PROPERTY ENVIRONMENT "${TRIBITS_TEST_EXTRA_ENVIRONMENT}") - ENDIF() - - IF(TRIBITS_RESOURCES_PER_PROCESS) - SET(NUM_PROCESSES ${NUM_PROCS_USED_IN}) - IF(NOT NUM_PROCESSES OR NUM_PROCESSES LESS 1) - SET(NUM_PROCESSES 1) - ENDIF() - TRIBITS_SET_TESTS_PROPERTIES(${TEST_NAME_IN} PROPERTIES RESOURCE_GROUPS + endif() + + if(TRIBITS_RESOURCES_PER_PROCESS) + set(NUM_PROCESSES ${NUM_PROCS_USED_IN}) + if(NOT NUM_PROCESSES OR NUM_PROCESSES LESS 1) + set(NUM_PROCESSES 1) + endif() + tribits_set_tests_properties(${TEST_NAME_IN} PROPERTIES RESOURCE_GROUPS "${NUM_PROCESSES},${TRIBITS_RESOURCES_PER_PROCESS}") - ENDIF() -ENDFUNCTION() + endif() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake index 829a21b81ef2..a08508730ff1 100644 --- a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake +++ b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake @@ -38,39 +38,38 @@ # @HEADER -INCLUDE(TribitsProcessPackagesAndDirsLists) -INCLUDE(TribitsAddOptionAndDefine) -INCLUDE(TribitsGeneralMacros) - -INCLUDE(AdvancedOption) -INCLUDE(AdvancedSet) -INCLUDE(AppendStringVar) -INCLUDE(CMakeBuildTypesList) -INCLUDE(FindListElement) -INCLUDE(GlobalNullSet) -INCLUDE(PrintNonemptyVar) -INCLUDE(PrintNonemptyVarWithSpaces) -INCLUDE(PrintVar) -INCLUDE(RemoveGlobalDuplicates) -INCLUDE(SetDefault) -INCLUDE(MessageWrapper) -INCLUDE(DualScopeSet) -INCLUDE(CMakeParseArguments) - +include(TribitsProcessPackagesAndDirsLists) +include(TribitsAddOptionAndDefine) +include(TribitsGeneralMacros) + +include(AdvancedOption) +include(AdvancedSet) +include(AppendStringVar) +include(CMakeBuildTypesList) +include(FindListElement) +include(GlobalNullSet) +include(PrintNonemptyVar) +include(PrintNonemptyVarWithSpaces) +include(PrintVar) +include(RemoveGlobalDuplicates) +include(SetDefault) +include(MessageWrapper) +include(DualScopeSet) +include(CMakeParseArguments) # # Private helper macros # -FUNCTION(TRIBITS_PRIVATE_PRINT_DISABLE +function(tribits_private_print_disable ENABLE_BEING_DISABLED_VAR_NAME PACKAGE_WITH_SOMETHING_BEING_DISABLED DEP_TYPE_STR THING_DISALBED_TYPE THING_DISABLED_NAME ) - #PRINT_VAR(${ENABLE_BEING_DISABLED_VAR_NAME}) - IF (${ENABLE_BEING_DISABLED_VAR_NAME}) - IF (${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES) - MESSAGE( + #print_var(${ENABLE_BEING_DISABLED_VAR_NAME}) + if (${ENABLE_BEING_DISABLED_VAR_NAME}) + if (${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES) + message( " ***\n" " *** NOTE: Setting ${ENABLE_BEING_DISABLED_VAR_NAME}=OFF" " which was '${${ENABLE_BEING_DISABLED_VAR_NAME}}' because" @@ -80,8 +79,8 @@ FUNCTION(TRIBITS_PRIVATE_PRINT_DISABLE " but ${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES=ON!\n" " ***\n" ) - ELSE() - MESSAGE(FATAL_ERROR + else() + message(FATAL_ERROR " ***\n" " *** ERROR: Setting ${ENABLE_BEING_DISABLED_VAR_NAME}=OFF" " which was '${${ENABLE_BEING_DISABLED_VAR_NAME}}' because" @@ -90,341 +89,341 @@ FUNCTION(TRIBITS_PRIVATE_PRINT_DISABLE " ${THING_DISALBED_TYPE} ${THING_DISABLED_NAME}!\n" " ***\n" ) - ENDIF() - ELSE() - MESSAGE("-- " + endif() + else() + message("-- " "Setting ${ENABLE_BEING_DISABLED_VAR_NAME}=OFF" " because ${PACKAGE_WITH_SOMETHING_BEING_DISABLED} has a required ${DEP_TYPE_STR}" " dependence on disabled ${THING_DISALBED_TYPE} ${THING_DISABLED_NAME}") - ENDIF() -ENDFUNCTION() + endif() +endfunction() -MACRO(TRIBITS_PRIVATE_DISABLE_TPL_REQUIRED_PACKAGE_ENABLE +macro(tribits_private_disable_tpl_required_package_enable TPL_NAME PACKAGE_NAME LIBRARY_DEP ) - #MESSAGE("TRIBITS_PRIVATE_DISABLE_TPL_REQUIRED_PACKAGE_ENABLE" + #message("TRIBITS_PRIVATE_DISABLE_TPL_REQUIRED_PACKAGE_ENABLE" # " ${TPL_NAME} ${PACKAGE_NAME} ${LIBRARY_DEP}") - # Only turn off PACKAGE_NAME libraries and test/eamples if it + # Only turn off PACKAGE_NAME libraries and test/examples if it # is currently enabled or could be enabled. - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} + assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} OR ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} STREQUAL "" ) - IF ("${LIBRARY_DEP}" STREQUAL "TRUE") + if ("${LIBRARY_DEP}" STREQUAL "TRUE") - TRIBITS_PRIVATE_PRINT_DISABLE( + tribits_private_print_disable( ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} ${PACKAGE_NAME} "library" "TPL" ${TPL_NAME} ) - SET(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} OFF) + set(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} OFF) - ELSE() + else() - SET(DEP_TYPE_STR "test/example") + set(DEP_TYPE_STR "test/example") - IF (${PACKAGE_NAME}_ENABLE_TESTS + if (${PACKAGE_NAME}_ENABLE_TESTS OR "${${PACKAGE_NAME}_ENABLE_TESTS}" STREQUAL "" ) - TRIBITS_PRIVATE_PRINT_DISABLE( + tribits_private_print_disable( ${PACKAGE_NAME}_ENABLE_TESTS ${PACKAGE_NAME} "${DEP_TYPE_STR}" "TPL" ${TPL_NAME} ) - SET(${PACKAGE_NAME}_ENABLE_TESTS OFF) - ENDIF() + set(${PACKAGE_NAME}_ENABLE_TESTS OFF) + endif() - IF (${PACKAGE_NAME}_ENABLE_EXAMPLES + if (${PACKAGE_NAME}_ENABLE_EXAMPLES OR "${${PACKAGE_NAME}_ENABLE_EXAMPLES}" STREQUAL "" ) - TRIBITS_PRIVATE_PRINT_DISABLE( + tribits_private_print_disable( ${PACKAGE_NAME}_ENABLE_EXAMPLES ${PACKAGE_NAME} "${DEP_TYPE_STR}" "TPL" ${TPL_NAME} ) - SET(${PACKAGE_NAME}_ENABLE_EXAMPLES OFF) - ENDIF() + set(${PACKAGE_NAME}_ENABLE_EXAMPLES OFF) + endif() # NOTE: We can't assert that ${PACKAGE_NAME}_ENABLE_TESTS or # ${PACKAGE_NAME}_ENABLE_EXAMPLES exists yet because - # TRIBITS_ADD_OPTIONAL_PACKAGE_ENABLES() which defines them is not + # tribits_add_optional_package_enables() which defines them is not # called until after the final package enables are set. - ENDIF() + endif() - ENDIF() + endif() -ENDMACRO() +endmacro() -FUNCTION(TRIBITS_PRIVATE_PRINT_DISABLE_REQUIRED_PACKAGE_ENABLE +function(tribits_private_print_disable_required_package_enable PACKAGE_NAME PACKAGE_ENABLE_SOMETHING_VAR_NAME FORWARD_DEP_PACKAGE_NAME DEP_TYPE_STR ) - TRIBITS_PRIVATE_PRINT_DISABLE( + tribits_private_print_disable( ${PACKAGE_ENABLE_SOMETHING_VAR_NAME} ${FORWARD_DEP_PACKAGE_NAME} "${DEP_TYPE_STR}" "package" ${PACKAGE_NAME} ) -ENDFUNCTION() +endfunction() -MACRO(TRIBITS_PRIVATE_DISABLE_REQUIRED_PACKAGE_ENABLES +macro(tribits_private_disable_required_package_enables FORWARD_DEP_PACKAGE_NAME PACKAGE_NAME LIBRARY_DEP ) - #MESSAGE("TRIBITS_PRIVATE_DISABLE_REQUIRED_PACKAGE_ENABLES" + #message("TRIBITS_PRIVATE_DISABLE_REQUIRED_PACKAGE_ENABLES" # " ${FORWARD_DEP_PACKAGE_NAME} ${LIBRARY_DEP}") - # Only turn off FORWARD_DEP_PACKAGE libraries and test/eamples if it + # Only turn off FORWARD_DEP_PACKAGE libraries and test/examples if it # is currently enabled or could be enabled - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} + assert_defined(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} OR ${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} STREQUAL "" ) - IF ("${LIBRARY_DEP}" STREQUAL "TRUE") + if ("${LIBRARY_DEP}" STREQUAL "TRUE") - TRIBITS_PRIVATE_PRINT_DISABLE_REQUIRED_PACKAGE_ENABLE( + tribits_private_print_disable_required_package_enable( ${PACKAGE_NAME} ${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} ${FORWARD_DEP_PACKAGE_NAME} "library" ) - SET(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} OFF) + set(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} OFF) - ELSE() + else() - SET(DEP_TYPE_STR "test/example") + set(DEP_TYPE_STR "test/example") - IF (${FORWARD_DEP_PACKAGE_NAME}_ENABLE_TESTS + if (${FORWARD_DEP_PACKAGE_NAME}_ENABLE_TESTS OR "${${FORWARD_DEP_PACKAGE_NAME}_ENABLE_TESTS}" STREQUAL "" ) - TRIBITS_PRIVATE_PRINT_DISABLE_REQUIRED_PACKAGE_ENABLE( + tribits_private_print_disable_required_package_enable( ${PACKAGE_NAME} ${FORWARD_DEP_PACKAGE_NAME}_ENABLE_TESTS ${FORWARD_DEP_PACKAGE_NAME} "${DEP_TYPE_STR}" ) - SET(${FORWARD_DEP_PACKAGE_NAME}_ENABLE_TESTS OFF) - ENDIF() + set(${FORWARD_DEP_PACKAGE_NAME}_ENABLE_TESTS OFF) + endif() - IF (${FORWARD_DEP_PACKAGE_NAME}_ENABLE_EXAMPLES + if (${FORWARD_DEP_PACKAGE_NAME}_ENABLE_EXAMPLES OR "${${FORWARD_DEP_PACKAGE_NAME}_ENABLE_EXAMPLES}" STREQUAL "" ) - TRIBITS_PRIVATE_PRINT_DISABLE_REQUIRED_PACKAGE_ENABLE( + tribits_private_print_disable_required_package_enable( ${PACKAGE_NAME} ${FORWARD_DEP_PACKAGE_NAME}_ENABLE_EXAMPLES ${FORWARD_DEP_PACKAGE_NAME} "${DEP_TYPE_STR}" ) - SET(${FORWARD_DEP_PACKAGE_NAME}_ENABLE_EXAMPLES OFF) - ENDIF() + set(${FORWARD_DEP_PACKAGE_NAME}_ENABLE_EXAMPLES OFF) + endif() - ENDIF() + endif() - ENDIF() + endif() -ENDMACRO() +endmacro() -MACRO(TRIBITS_PRIVATE_DISABLE_OPTIONAL_PACKAGE_ENABLES +macro(tribits_private_disable_optional_package_enables FORWARD_DEP_PACKAGE_NAME PACKAGE_NAME ) - #MESSAGE("TRIBITS_PRIVATE_DISABLE_OPTIONAL_PACKAGE_ENABLES" + #message("TRIBITS_PRIVATE_DISABLE_OPTIONAL_PACKAGE_ENABLES" # " ${FORWARD_DEP_PACKAGE_NAME} ${PACKAGE_NAME}") - #MESSAGE("-- " "${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME} = ${${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}}") + #message("-- " "${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME} = ${${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}}") - #ASSERT_DEFINED(${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}) - IF (${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME} OR "${${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}}" STREQUAL "") + #assert_defined(${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}) + if (${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME} OR "${${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}}" STREQUAL "") # Always disable the conditional enable but only print the message if the package is enabled. - #MESSAGE("-- Disasble ${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} ...") - IF (${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}) - IF (${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}) # is explicity try already! - MESSAGE("-- " + #message("-- Disable ${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} ...") + if (${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}) + if (${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}) # is explicitly try already! + message("-- " "NOTE: Setting ${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}=OFF" " which was ${${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}}" " because ${FORWARD_DEP_PACKAGE_NAME} has an optional library dependence" " on disabled package ${PACKAGE_NAME}") - ELSE() # Not explicitly set - MESSAGE("-- " + else() # Not explicitly set + message("-- " "Setting ${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME}=OFF" " because ${FORWARD_DEP_PACKAGE_NAME} has an optional library dependence" " on disabled package ${PACKAGE_NAME}") - ENDIF() - ENDIF() - SET(${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME} OFF) - ENDIF() + endif() + endif() + set(${FORWARD_DEP_PACKAGE_NAME}_ENABLE_${PACKAGE_NAME} OFF) + endif() -ENDMACRO() +endmacro() # Macro that disabled a packages if its required upstream TPL is disabled.. # -MACRO(TRIBITS_DISABLE_PACKAGE_IF_TPL_DISABLED TRIBITS_PACKAGE) +macro(tribits_disable_package_if_tpl_disabled TRIBITS_PACKAGE) - FOREACH(TPL_NAME ${${TRIBITS_PACKAGE}_LIB_REQUIRED_DEP_TPLS}) - IF ( (NOT TPL_ENABLE_${TPL_NAME}) AND + foreach(TPL_NAME ${${TRIBITS_PACKAGE}_LIB_REQUIRED_DEP_TPLS}) + if ( (NOT TPL_ENABLE_${TPL_NAME}) AND (NOT "${TPL_ENABLE_${TPL_NAME}}" STREQUAL "") ) - TRIBITS_PRIVATE_DISABLE_TPL_REQUIRED_PACKAGE_ENABLE( + tribits_private_disable_tpl_required_package_enable( ${TPL_NAME} ${TRIBITS_PACKAGE} TRUE ) - ENDIF() - ENDFOREACH() + endif() + endforeach() - FOREACH(TPL_NAME ${${TRIBITS_PACKAGE}_TEST_REQUIRED_DEP_TPLS}) - IF ( (NOT TPL_ENABLE_${TPL_NAME}) AND + foreach(TPL_NAME ${${TRIBITS_PACKAGE}_TEST_REQUIRED_DEP_TPLS}) + if ( (NOT TPL_ENABLE_${TPL_NAME}) AND (NOT "${TPL_ENABLE_${TPL_NAME}}" STREQUAL "") ) - TRIBITS_PRIVATE_DISABLE_TPL_REQUIRED_PACKAGE_ENABLE( + tribits_private_disable_tpl_required_package_enable( ${TPL_NAME} ${TRIBITS_PACKAGE} FALSE ) - ENDIF() - ENDFOREACH() + endif() + endforeach() -ENDMACRO() +endmacro() # Macro that disables all of the subpackages of a parent package. # -MACRO(TRIBITS_DISABLE_PARENTS_SUBPACKAGES PARENT_PACKAGE_NAME) +macro(tribits_disable_parents_subpackages PARENT_PACKAGE_NAME) - #MESSAGE("TRIBITS_DISABLE_PARENTS_SUBPACKAGES: ${PARENT_PACKAGE_NAME}") + #message("TRIBITS_DISABLE_PARENTS_SUBPACKAGES: ${PARENT_PACKAGE_NAME}") - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME}) + #print_var(${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME}) - IF(NOT ${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME} + if(NOT ${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME} AND NOT ${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME} STREQUAL "" ) - SET(SUBPACKAGE_IDX 0) - FOREACH(TRIBITS_SUBPACKAGE ${${PARENT_PACKAGE_NAME}_SUBPACKAGES}) + set(SUBPACKAGE_IDX 0) + foreach(TRIBITS_SUBPACKAGE ${${PARENT_PACKAGE_NAME}_SUBPACKAGES}) - SET(SUBPACKAGE_NAME ${TRIBITS_SUBPACKAGE}) - SET(SUBPACKAGE_FULLNAME ${PARENT_PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + set(SUBPACKAGE_NAME ${TRIBITS_SUBPACKAGE}) + set(SUBPACKAGE_FULLNAME ${PARENT_PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - IF (NOT ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME} STREQUAL "OFF") - SET(ENABLE_BEING_DISABLED_VAR_NAME ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - MESSAGE("-- " + #print_var(${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + if (NOT ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME} STREQUAL "OFF") + set(ENABLE_BEING_DISABLED_VAR_NAME ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + message("-- " "Setting subpackage enable ${ENABLE_BEING_DISABLED_VAR_NAME}=OFF" " because parent package ${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME}=OFF") - SET(${ENABLE_BEING_DISABLED_VAR_NAME} OFF) - ENDIF() + set(${ENABLE_BEING_DISABLED_VAR_NAME} OFF) + endif() - MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") + math(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") - ENDFOREACH() + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # # Macro that enables all of the subpackages of a parent package. # -MACRO(TRIBITS_ENABLE_PARENTS_SUBPACKAGES PARENT_PACKAGE_NAME) +macro(tribits_enable_parents_subpackages PARENT_PACKAGE_NAME) - #MESSAGE("TRIBITS_ENABLE_PARENTS_SUBPACKAGES: ${PARENT_PACKAGE_NAME}") + #message("TRIBITS_ENABLE_PARENTS_SUBPACKAGES: ${PARENT_PACKAGE_NAME}") - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME}) + #print_var(${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME}) - IF(${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME}) + if(${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME}) - SET(SUBPACKAGE_IDX 0) - FOREACH(TRIBITS_SUBPACKAGE ${${PARENT_PACKAGE_NAME}_SUBPACKAGES}) + set(SUBPACKAGE_IDX 0) + foreach(TRIBITS_SUBPACKAGE ${${PARENT_PACKAGE_NAME}_SUBPACKAGES}) - SET(SUBPACKAGE_NAME ${TRIBITS_SUBPACKAGE}) - SET(SUBPACKAGE_FULLNAME ${PARENT_PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + set(SUBPACKAGE_NAME ${TRIBITS_SUBPACKAGE}) + set(SUBPACKAGE_FULLNAME ${PARENT_PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + #print_var(${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - IF (NOT ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME} AND + if (NOT ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME} AND NOT "${${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}}" STREQUAL "" ) # The subpackage is already disabled and is not just empty! - ELSEIF (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + elseif (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) # The subpackage is already enabled so there is no reason to enable it! - ELSE() + else() # The subpackage is not hard off or on so turn it on by default - TRIBITS_IMPLICIT_PACKAGE_ENABLE_IS_ALLOWED( "" ${SUBPACKAGE_FULLNAME} + tribits_implicit_package_enable_is_allowed( "" ${SUBPACKAGE_FULLNAME} SUBPACKAGE_ALLOW_IMPLICIT_ENABLE) - IF (SUBPACKAGE_ALLOW_IMPLICIT_ENABLE) - SET(ENABLE_BEING_ENABLED_VAR_NAME ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - MESSAGE("-- " + if (SUBPACKAGE_ALLOW_IMPLICIT_ENABLE) + set(ENABLE_BEING_ENABLED_VAR_NAME ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + message("-- " "Setting subpackage enable ${ENABLE_BEING_ENABLED_VAR_NAME}=ON" " because parent package ${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME}=ON") - SET(${ENABLE_BEING_ENABLED_VAR_NAME} ON) - ENDIF() - ENDIF() + set(${ENABLE_BEING_ENABLED_VAR_NAME} ON) + endif() + endif() - MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") + math(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") - ENDFOREACH() + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # Macro that disables all forward packages that depend on the given packages # -MACRO(TRIBITS_DISABLE_FORWARD_REQUIRED_DEP_PACKAGES PACKAGE_NAME) +macro(tribits_disable_forward_required_dep_packages PACKAGE_NAME) - #MESSAGE("TRIBITS_DISABLE_FORWARD_REQUIRED_DEP_PACKAGES: ${PACKAGE_NAME}") + #message("TRIBITS_DISABLE_FORWARD_REQUIRED_DEP_PACKAGES: ${PACKAGE_NAME}") - IF ( + if ( (NOT ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) AND (NOT "${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}" STREQUAL "") ) - FOREACH(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_LIB_REQUIRED_DEP_PACKAGES}) - TRIBITS_PRIVATE_DISABLE_REQUIRED_PACKAGE_ENABLES(${FWD_DEP_PKG} ${PACKAGE_NAME} TRUE) - ENDFOREACH() + foreach(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_LIB_REQUIRED_DEP_PACKAGES}) + tribits_private_disable_required_package_enables(${FWD_DEP_PKG} ${PACKAGE_NAME} TRUE) + endforeach() - FOREACH(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_DISABLE_OPTIONAL_PACKAGE_ENABLES(${FWD_DEP_PKG} ${PACKAGE_NAME}) - ENDFOREACH() + foreach(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES}) + tribits_private_disable_optional_package_enables(${FWD_DEP_PKG} ${PACKAGE_NAME}) + endforeach() - FOREACH(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES}) - TRIBITS_PRIVATE_DISABLE_REQUIRED_PACKAGE_ENABLES(${FWD_DEP_PKG} ${PACKAGE_NAME} FALSE) - ENDFOREACH() + foreach(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES}) + tribits_private_disable_required_package_enables(${FWD_DEP_PKG} ${PACKAGE_NAME} FALSE) + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # Macro that prints out dependencies for a package # # Does not modify the global state. # -MACRO(TRIBITS_PRINT_PACKAGE_DEPENDENCIES PACKAGE_NAME) +macro(tribits_print_package_dependencies PACKAGE_NAME) - SET(PRINTED_VAR) + set(PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_LIB_REQUIRED_DEP_PACKAGES PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_TEST_REQUIRED_DEP_PACKAGES PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES PRINTED_VAR) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_LIB_REQUIRED_DEP_PACKAGES PRINTED_VAR) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES PRINTED_VAR) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_TEST_REQUIRED_DEP_PACKAGES PRINTED_VAR) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES PRINTED_VAR) - IF (${PROJECT_NAME}_DUMP_FORWARD_PACKAGE_DEPENDENCIES) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_FORWARD_LIB_REQUIRED_DEP_PACKAGES + if (${PROJECT_NAME}_DUMP_FORWARD_PACKAGE_DEPENDENCIES) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_FORWARD_LIB_REQUIRED_DEP_PACKAGES PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES + print_nonempty_var_with_spaces(${PACKAGE_NAME}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES + print_nonempty_var_with_spaces(${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES + print_nonempty_var_with_spaces(${PACKAGE_NAME}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES PRINTED_VAR) - ENDIF() + endif() - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_LIB_REQUIRED_DEP_TPLS PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_TEST_REQUIRED_DEP_TPLS PRINTED_VAR) - PRINT_NONEMPTY_VAR_WITH_SPACES(${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS PRINTED_VAR) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_LIB_REQUIRED_DEP_TPLS PRINTED_VAR) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS PRINTED_VAR) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_TEST_REQUIRED_DEP_TPLS PRINTED_VAR) + print_nonempty_var_with_spaces(${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS PRINTED_VAR) - IF (NOT PRINTED_VAR) - MESSAGE("-- ${PACKAGE_NAME}: No dependencies!") - ENDIF() + if (NOT PRINTED_VAR) + message("-- ${PACKAGE_NAME}: No dependencies!") + endif() -ENDMACRO() +endmacro() # @@ -432,123 +431,123 @@ ENDMACRO() # -MACRO(TRIBITS_PRIVATE_ADD_OPTIONAL_PACKAGE_ENABLE PACKAGE_NAME OPTIONAL_DEP_PACKAGE +macro(tribits_private_add_optional_package_enable PACKAGE_NAME OPTIONAL_DEP_PACKAGE TYPE SET_AS_CACHE_IN ) - #MESSAGE("\nPACKAGE_ARCH_PRIVATE_ADD_OPTIONAL_PACKAGE_ENABLE: ${PACKAGE_NAME} ${OPTIONAL_DEP_PACKAGE}") + #message("\nPACKAGE_ARCH_PRIVATE_ADD_OPTIONAL_PACKAGE_ENABLE: ${PACKAGE_NAME} ${OPTIONAL_DEP_PACKAGE}") - IF (SET_AS_CACHE_IN) + if (SET_AS_CACHE_IN) - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "Enable optional ${TYPE} support in the package ${PACKAGE_NAME}" " for the package ${OPTIONAL_DEP_PACKAGE}." " Set to 'ON', 'OFF', or leave empty" " to allow for other logic to decide." ) - SET_CACHE_ON_OFF_EMPTY( ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} "" + set_cache_on_off_empty( ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} "" ${DOCSTR} ) - ELSE() + else() - IF (NOT DEFINED ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) - SET( ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} "" ) - ENDIF() + if (NOT DEFINED ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) + set( ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} "" ) + endif() - ENDIF() + endif() -ENDMACRO() +endmacro() -MACRO(TRIBITS_PRIVATE_ADD_OPTIONAL_TPL_ENABLE PACKAGE_NAME OPTIONAL_DEP_TPL +macro(tribits_private_add_optional_tpl_enable PACKAGE_NAME OPTIONAL_DEP_TPL TYPE SET_AS_CACHE_IN ) - IF (SET_AS_CACHE_IN) + if (SET_AS_CACHE_IN) - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "Enable optional ${TYPE} support in the package ${PACKAGE_NAME}" " for the TPL ${OPTIONAL_DEP_TPL}." " Set to 'ON', 'OFF', or leave empty" " to allow for other logic to decide." ) - SET_CACHE_ON_OFF_EMPTY( ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} "" + set_cache_on_off_empty( ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} "" ${DOCSTR} ) - ELSE() + else() - IF (NOT DEFINED ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}) - SET( ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} "" ) - ENDIF() + if (NOT DEFINED ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}) + set( ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} "" ) + endif() - ENDIF() + endif() -ENDMACRO() +endmacro() # Macro that enables optional package interdependencies # -MACRO(TRIBITS_ADD_OPTIONAL_PACKAGE_ENABLES PACKAGE_NAME) +macro(tribits_add_optional_package_enables PACKAGE_NAME) - #MESSAGE("\nPACKAGE_ARCH_ADD_OPTIONAL_PACKAGE_ENABLES: ${PACKAGE_NAME}") + #message("\nPACKAGE_ARCH_ADD_OPTIONAL_PACKAGE_ENABLES: ${PACKAGE_NAME}") - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - SET(SET_AS_CACHE ${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}) + assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + set(SET_AS_CACHE ${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}) - IF (SET_AS_CACHE) + if (SET_AS_CACHE) - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "Build tests for the package ${PACKAGE_NAME}. Set to 'ON', 'OFF', or leave empty ''" " to allow for other logic to decide." ) - SET_CACHE_ON_OFF_EMPTY( ${PACKAGE_NAME}_ENABLE_TESTS "" ${DOCSTR} ) + set_cache_on_off_empty( ${PACKAGE_NAME}_ENABLE_TESTS "" ${DOCSTR} ) - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "Build examples for the package ${PACKAGE_NAME}. Set to 'ON', 'OFF', or leave empty ''" " to allow for other logic to decide." ) - SET_CACHE_ON_OFF_EMPTY( ${PACKAGE_NAME}_ENABLE_EXAMPLES "" ${DOCSTR} ) + set_cache_on_off_empty( ${PACKAGE_NAME}_ENABLE_EXAMPLES "" ${DOCSTR} ) - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "Build examples for the package ${PACKAGE_NAME}. Set to 'ON', 'OFF', or leave empty ''" " to allow for other logic to decide." ) - SET( ${PACKAGE_NAME}_SKIP_CTEST_ADD_TEST + set( ${PACKAGE_NAME}_SKIP_CTEST_ADD_TEST "${${PROJECT_NAME}_SKIP_CTEST_ADD_TEST}" CACHE BOOL ${DOCSTR} ) - ELSE() + else() - IF (NOT DEFINED ${PACKAGE_NAME}_ENABLE_TESTS) - SET( ${PACKAGE_NAME}_ENABLE_TESTS "" ) - ENDIF() - IF (NOT DEFINED ${PACKAGE_NAME}_ENABLE_EXAMPLES) - SET( ${PACKAGE_NAME}_ENABLE_EXAMPLES "" ) - ENDIF() + if (NOT DEFINED ${PACKAGE_NAME}_ENABLE_TESTS) + set( ${PACKAGE_NAME}_ENABLE_TESTS "" ) + endif() + if (NOT DEFINED ${PACKAGE_NAME}_ENABLE_EXAMPLES) + set( ${PACKAGE_NAME}_ENABLE_EXAMPLES "" ) + endif() - ENDIF() + endif() - FOREACH(OPTIONAL_DEP_PACKAGE ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_ADD_OPTIONAL_PACKAGE_ENABLE( + foreach(OPTIONAL_DEP_PACKAGE ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES}) + tribits_private_add_optional_package_enable( ${PACKAGE_NAME} ${OPTIONAL_DEP_PACKAGE} "library" "${SET_AS_CACHE}" ) - ENDFOREACH() + endforeach() - FOREACH(OPTIONAL_DEP_PACKAGE ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_ADD_OPTIONAL_PACKAGE_ENABLE( + foreach(OPTIONAL_DEP_PACKAGE ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES}) + tribits_private_add_optional_package_enable( ${PACKAGE_NAME} ${OPTIONAL_DEP_PACKAGE} "test" "${SET_AS_CACHE}" ) - ENDFOREACH() + endforeach() - FOREACH(OPTIONAL_DEP_TPL ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS}) - TRIBITS_PRIVATE_ADD_OPTIONAL_TPL_ENABLE( + foreach(OPTIONAL_DEP_TPL ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS}) + tribits_private_add_optional_tpl_enable( ${PACKAGE_NAME} ${OPTIONAL_DEP_TPL} "library" "${SET_AS_CACHE}" ) - ENDFOREACH() + endforeach() - FOREACH(OPTIONAL_DEP_TPL ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS}) - TRIBITS_PRIVATE_ADD_OPTIONAL_TPL_ENABLE( + foreach(OPTIONAL_DEP_TPL ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS}) + tribits_private_add_optional_tpl_enable( ${PACKAGE_NAME} ${OPTIONAL_DEP_TPL} "test" "${SET_AS_CACHE}" ) - ENDFOREACH() + endforeach() -ENDMACRO() +endmacro() # @@ -560,347 +559,347 @@ ENDMACRO() # ${PACKAGE_NAME} (i.e. ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} is assumed to # be TRUE before calling this macro. # -MACRO(TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_PACKAGE_ENABLE PACKAGE_NAME OPTIONAL_DEP_PACKAGE) +macro(tribits_private_postprocess_optional_package_enable PACKAGE_NAME OPTIONAL_DEP_PACKAGE) - #MESSAGE("TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_PACKAGE_ENABLE: ${PACKAGE_NAME} ${OPTIONAL_DEP_PACKAGE}") - #PRINT_VAR(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) + #message("TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_PACKAGE_ENABLE: ${PACKAGE_NAME} ${OPTIONAL_DEP_PACKAGE}") + #print_var(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) + #print_var(${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) - IF (${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} AND ${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) - MESSAGE("-- " "NOTE:" + if (${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} AND ${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) + message("-- " "NOTE:" " ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}}" " is already set!") - ELSEIF ("${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}}" STREQUAL "") - IF (${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) - MESSAGE("-- " "Setting ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=ON" + elseif ("${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}}" STREQUAL "") + if (${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) + message("-- " "Setting ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=ON" " since ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=ON AND" " ${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=ON") - SET(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} ON) - ELSE() - MESSAGE("-- " "NOT setting ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=ON" + set(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} ON) + else() + message("-- " "NOT setting ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=ON" " since ${OPTIONAL_DEP_PACKAGE} is NOT enabled at this point!") - ENDIF() - ELSEIF (NOT "${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}}" STREQUAL "" + endif() + elseif (NOT "${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}}" STREQUAL "" AND NOT ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} AND ${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE} ) - MESSAGE("-- " "NOTE: ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}}" + message("-- " "NOTE: ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}}" " is already set so not enabling even though ${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}=${${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}} is set!") - ENDIF() + endif() - STRING(TOUPPER ${PACKAGE_NAME} PACKAGE_NAME_UPPER) - STRING(TOUPPER ${OPTIONAL_DEP_PACKAGE} OPTIONAL_DEP_PACKAGE_UPPER) - SET(MACRO_DEFINE_NAME HAVE_${PACKAGE_NAME_UPPER}_${OPTIONAL_DEP_PACKAGE_UPPER}) + string(TOUPPER ${PACKAGE_NAME} PACKAGE_NAME_UPPER) + string(TOUPPER ${OPTIONAL_DEP_PACKAGE} OPTIONAL_DEP_PACKAGE_UPPER) + set(MACRO_DEFINE_NAME HAVE_${PACKAGE_NAME_UPPER}_${OPTIONAL_DEP_PACKAGE_UPPER}) - IF(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) - SET(${MACRO_DEFINE_NAME} ON) - ELSE() - SET(${MACRO_DEFINE_NAME} OFF) - ENDIF() + if(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE}) + set(${MACRO_DEFINE_NAME} ON) + else() + set(${MACRO_DEFINE_NAME} OFF) + endif() -ENDMACRO() +endmacro() # Enable optional intra-package support for enabled target package # ${PACKAGE_NAME} (i.e. ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} is assumed to # be TRUE before calling this macro. # -MACRO(TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_TPL_ENABLE PACKAGE_NAME OPTIONAL_DEP_TPL) +macro(tribits_private_postprocess_optional_tpl_enable PACKAGE_NAME OPTIONAL_DEP_TPL) - #MESSAGE("TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_TPL_ENABLE: ${PACKAGE_NAME} ${OPTIONAL_DEP_TPL}") + #message("TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_TPL_ENABLE: ${PACKAGE_NAME} ${OPTIONAL_DEP_TPL}") - IF (${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} AND TPL_ENABLE_${OPTIONAL_DEP_TPL}) - MESSAGE("-- " "NOTE:" + if (${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} AND TPL_ENABLE_${OPTIONAL_DEP_TPL}) + message("-- " "NOTE:" " ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}=${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}}" " is already set!") - ELSEIF ( + elseif ( (NOT TPL_ENABLE_${OPTIONAL_DEP_TPL}) AND (NOT "${TPL_ENABLE_${OPTIONAL_DEP_TPL}}" STREQUAL "") AND ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} ) - MESSAGE( + message( "\n***" "\n*** NOTE: Setting ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}=OFF" " which was ON since TPL_ENABLE_${OPTIONAL_DEP_TPL}=OFF" "\n***\n" ) - SET(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} OFF) - ELSEIF ("${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}}" STREQUAL "" + set(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} OFF) + elseif ("${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}}" STREQUAL "" AND TPL_ENABLE_${OPTIONAL_DEP_TPL} ) - MESSAGE("-- " "Setting ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}=ON" + message("-- " "Setting ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}=ON" " since TPL_ENABLE_${OPTIONAL_DEP_TPL}=ON") - SET(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} ON) - ELSEIF (NOT "${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}}" STREQUAL "" + set(${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} ON) + elseif (NOT "${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}}" STREQUAL "" AND NOT ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL} AND TPL_ENABLE_${OPTIONAL_DEP_TPL} ) - MESSAGE("-- " "NOTE: ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}=${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}}" + message("-- " "NOTE: ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}=${${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}}" " is already set so not enabling even though TPL_ENABLE_${OPTIONAL_DEP_TPL}=${TPL_ENABLE_${OPTIONAL_DEP_TPL}} is set!") - ENDIF() + endif() - STRING(TOUPPER ${PACKAGE_NAME} PACKAGE_NAME_UPPER) - STRING(TOUPPER ${OPTIONAL_DEP_TPL} OPTIONAL_DEP_TPL_UPPER) - SET(MACRO_DEFINE_NAME HAVE_${PACKAGE_NAME_UPPER}_${OPTIONAL_DEP_TPL_UPPER}) + string(TOUPPER ${PACKAGE_NAME} PACKAGE_NAME_UPPER) + string(TOUPPER ${OPTIONAL_DEP_TPL} OPTIONAL_DEP_TPL_UPPER) + set(MACRO_DEFINE_NAME HAVE_${PACKAGE_NAME_UPPER}_${OPTIONAL_DEP_TPL_UPPER}) - IF (${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}) - SET(${MACRO_DEFINE_NAME} ON) - ELSE() - SET(${MACRO_DEFINE_NAME} OFF) - ENDIF() + if (${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_TPL}) + set(${MACRO_DEFINE_NAME} ON) + else() + set(${MACRO_DEFINE_NAME} OFF) + endif() -ENDMACRO() +endmacro() -# Macro that post-processes optional dependancies after all other +# Macro that post-processes optional dependencies after all other # dependencies have been worked out # -MACRO(TRIBITS_POSTPROCESS_OPTIONAL_PACKAGE_ENABLES PACKAGE_NAME) +macro(tribits_postprocess_optional_package_enables PACKAGE_NAME) - #MESSAGE("\nPACKAGE_ARCH_POSTPROCESS_OPTIONAL_PACKAGE_ENABLES: ${PACKAGE_NAME}") + #message("\nPACKAGE_ARCH_POSTPROCESS_OPTIONAL_PACKAGE_ENABLES: ${PACKAGE_NAME}") - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - FOREACH(OPTIONAL_DEP_PACKAGE ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_PACKAGE_ENABLE( + foreach(OPTIONAL_DEP_PACKAGE ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES}) + tribits_private_postprocess_optional_package_enable( ${PACKAGE_NAME} ${OPTIONAL_DEP_PACKAGE} ) - ENDFOREACH() + endforeach() - FOREACH(OPTIONAL_DEP_PACKAGE ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_PACKAGE_ENABLE( + foreach(OPTIONAL_DEP_PACKAGE ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES}) + tribits_private_postprocess_optional_package_enable( ${PACKAGE_NAME} ${OPTIONAL_DEP_PACKAGE} ) - ENDFOREACH() + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # Macro that post-processes final package enables for packages with subpackage # enables. # -MACRO(TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_ENABLES PACKAGE_NAME) - #MESSAGE("TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_ENABLES '${PACKAGE_NAME}'") - FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - #PRINT_VAR(${SUBPACKAGE_FULLNAME}_ENABLE_TESTS) - #PRINT_VAR(${PACKAGE_NAME}_ENABLE_TESTS) - #PRINT_VAR(${SUBPACKAGE_FULLNAME}_ENABLE_EXAMPLES) - #PRINT_VAR(${PACKAGE_NAME}_ENABLE_EXAMPLES) - IF (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME} +macro(tribits_postprocess_package_with_subpackages_enables PACKAGE_NAME) + #message("TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_ENABLES '${PACKAGE_NAME}'") + foreach(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) + set(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + #print_var(${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + #print_var(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + #print_var(${SUBPACKAGE_FULLNAME}_ENABLE_TESTS) + #print_var(${PACKAGE_NAME}_ENABLE_TESTS) + #print_var(${SUBPACKAGE_FULLNAME}_ENABLE_EXAMPLES) + #print_var(${PACKAGE_NAME}_ENABLE_EXAMPLES) + if (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME} AND NOT ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} ) - MESSAGE("-- " + message("-- " "Setting ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=ON" " because ${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}=ON") - SET(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} ON) - TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_TEST_EXAMPLE_ENABLES( + set(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} ON) + tribits_postprocess_package_with_subpackages_test_example_enables( ${PACKAGE_NAME} TESTS) - TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_TEST_EXAMPLE_ENABLES( + tribits_postprocess_package_with_subpackages_test_example_enables( ${PACKAGE_NAME} EXAMPLES) # NOTE: We need to enable the parent package even if it was disabled by # some means before this because a subpackage is enabled. But other # logic should ensure that the parent package is never disabled and a # subpackage is allowed to be enabled. - ENDIF() - ENDFOREACH() -ENDMACRO() + endif() + endforeach() +endmacro() # Set the parent package tests/examples enables if one subpackage is enabled # and has its tests/examples # -MACRO(TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_TEST_EXAMPLE_ENABLES +macro(tribits_postprocess_package_with_subpackages_test_example_enables PACKAGE_NAME TESTS_OR_EXAMPLES ) - #MESSAGE("TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_TEST_EXAMPLE_ENABLES '${PACKAGE_NAME}'") - FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - #PRINT_VAR(${SUBPACKAGE_FULLNAME}_ENABLE_${TESTS_OR_EXAMPLES}) - #PRINT_VAR(${PACKAGE_NAME}_ENABLE_${TESTS_OR_EXAMPLES}) - #PRINT_VAR(${SUBPACKAGE_FULLNAME}_ENABLE_EXAMPLES) - #PRINT_VAR(${PACKAGE_NAME}_ENABLE_EXAMPLES) - IF (${SUBPACKAGE_FULLNAME}_ENABLE_${TESTS_OR_EXAMPLES} + #message("TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_TEST_EXAMPLE_ENABLES '${PACKAGE_NAME}'") + foreach(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) + set(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + #print_var(${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + #print_var(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + #print_var(${SUBPACKAGE_FULLNAME}_ENABLE_${TESTS_OR_EXAMPLES}) + #print_var(${PACKAGE_NAME}_ENABLE_${TESTS_OR_EXAMPLES}) + #print_var(${SUBPACKAGE_FULLNAME}_ENABLE_EXAMPLES) + #print_var(${PACKAGE_NAME}_ENABLE_EXAMPLES) + if (${SUBPACKAGE_FULLNAME}_ENABLE_${TESTS_OR_EXAMPLES} AND "${${PACKAGE_NAME}_ENABLE_${TESTS_OR_EXAMPLES}}" STREQUAL "" ) - MESSAGE("-- " + message("-- " "Setting ${PACKAGE_NAME}_ENABLE_${TESTS_OR_EXAMPLES}=ON" " because ${SUBPACKAGE_FULLNAME}_ENABLE_${TESTS_OR_EXAMPLES}=ON") - SET(${PACKAGE_NAME}_ENABLE_${TESTS_OR_EXAMPLES} ON) - ENDIF() - ENDFOREACH() -ENDMACRO() + set(${PACKAGE_NAME}_ENABLE_${TESTS_OR_EXAMPLES} ON) + endif() + endforeach() +endmacro() # Post-processes optional package TPL based on if the TPL # has been enabled or not # -MACRO(TRIBITS_POSTPROCESS_OPTIONAL_TPL_ENABLES PACKAGE_NAME) +macro(tribits_postprocess_optional_tpl_enables PACKAGE_NAME) - #MESSAGE("\nPACKAGE_ARCH_ADD_OPTIONAL_TPL_ENABLES: ${PACKAGE_NAME}") + #message("\nPACKAGE_ARCH_ADD_OPTIONAL_TPL_ENABLES: ${PACKAGE_NAME}") - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - FOREACH(OPTIONAL_DEP_TPL ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS}) - TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_TPL_ENABLE( + foreach(OPTIONAL_DEP_TPL ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS}) + tribits_private_postprocess_optional_tpl_enable( ${PACKAGE_NAME} ${OPTIONAL_DEP_TPL} ) - ENDFOREACH() + endforeach() - FOREACH(OPTIONAL_DEP_TPL ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS}) - TRIBITS_PRIVATE_POSTPROCESS_OPTIONAL_TPL_ENABLE( + foreach(OPTIONAL_DEP_TPL ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS}) + tribits_private_postprocess_optional_tpl_enable( ${PACKAGE_NAME} ${OPTIONAL_DEP_TPL} ) - ENDFOREACH() + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # Set an individual package variable enable based on the global value # -MACRO(TRIBITS_SET_ALL_PACKAGES_PACKAGE_ENABLE_VARIABLE PACKAGE_ARCH_VAR PACKAGE_VAR) - - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("") - MESSAGE("TRIBITS_SET_ALL_PACKAGES_PACKAGE_ENABLE_VARIABLE:") - MESSAGE("-- " "${PACKAGE_ARCH_VAR} = ${${PACKAGE_ARCH_VAR}}") - MESSAGE("-- " "${PACKAGE_VAR} = ${${PACKAGE_VAR}}") - ENDIF() - - IF ("${${PACKAGE_VAR}}" STREQUAL "") - IF (${PACKAGE_ARCH_VAR}) - MESSAGE("-- " "Setting ${PACKAGE_VAR}=ON") - SET(${PACKAGE_VAR} ON) - ELSEIF ( +macro(tribits_set_all_packages_package_enable_variable PACKAGE_ARCH_VAR PACKAGE_VAR) + + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("") + message("TRIBITS_SET_ALL_PACKAGES_PACKAGE_ENABLE_VARIABLE:") + message("-- " "${PACKAGE_ARCH_VAR} = ${${PACKAGE_ARCH_VAR}}") + message("-- " "${PACKAGE_VAR} = ${${PACKAGE_VAR}}") + endif() + + if ("${${PACKAGE_VAR}}" STREQUAL "") + if (${PACKAGE_ARCH_VAR}) + message("-- " "Setting ${PACKAGE_VAR}=ON") + set(${PACKAGE_VAR} ON) + elseif ( (NOT ${PACKAGE_ARCH_VAR}) AND (NOT "${PACKAGE_ARCH_VAR}" STREQUAL "") ) - MESSAGE("-- " "Setting ${PACKAGE_VAR}=OFF") - SET(${PACKAGE_VAR} OFF) - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "ELSE") + message("-- " "Setting ${PACKAGE_VAR}=OFF") + set(${PACKAGE_VAR} OFF) + else() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "ELSE") # Otherwise, we will leave it up the the individual package # to decide? - ENDIF() - ENDIF() - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "${PACKAGE_VAR} NOT DEFAULT") - ENDIF() - ENDIF() + endif() + endif() + else() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "${PACKAGE_VAR} NOT DEFAULT") + endif() + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "${PACKAGE_VAR} = ${${PACKAGE_VAR}}") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "${PACKAGE_VAR} = ${${PACKAGE_VAR}}") + endif() -ENDMACRO() +endmacro() # Macro used to set ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} based on # ${PROJECT_NAME}_ENABLE_ALL_PACKAGES # -MACRO(TRIBITS_APPLY_ALL_PACKAGE_ENABLES PACKAGE_NAME) - TRIBITS_IS_PRIMARY_META_PROJECT_PACKAGE(${PACKAGE_NAME} PACKAGE_IS_PMPP) - TRIBITS_IMPLICIT_PACKAGE_ENABLE_IS_ALLOWED( "" ${PACKAGE_NAME} +macro(tribits_apply_all_package_enables PACKAGE_NAME) + tribits_is_primary_meta_project_package(${PACKAGE_NAME} PACKAGE_IS_PMPP) + tribits_implicit_package_enable_is_allowed( "" ${PACKAGE_NAME} PROCESS_PACKAGE_ENABLE ) - IF (PACKAGE_IS_PMPP AND PROCESS_PACKAGE_ENABLE) - TRIBITS_SET_ALL_PACKAGES_PACKAGE_ENABLE_VARIABLE( + if (PACKAGE_IS_PMPP AND PROCESS_PACKAGE_ENABLE) + tribits_set_all_packages_package_enable_variable( ${PROJECT_NAME}_ENABLE_ALL_PACKAGES ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} ) - ENDIF() -ENDMACRO() + endif() +endmacro() # Macro used to set ${TRIBITS_PACKAGE)_ENABLE_TESTS and ${TRIBITS_PACKAGE)_ENABLE_EXAMPLES # based on ${PROJECT_NAME}_ENABLE_ALL_PACKAGES # -MACRO(TRIBITS_APPLY_TEST_EXAMPLE_ENABLES PACKAGE_NAME) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - TRIBITS_IS_PRIMARY_META_PROJECT_PACKAGE(${PACKAGE_NAME} PACKAGE_IS_PMPP) - IF (PACKAGE_IS_PMPP) - TRIBITS_SET_ALL_PACKAGES_PACKAGE_ENABLE_VARIABLE( +macro(tribits_apply_test_example_enables PACKAGE_NAME) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + tribits_is_primary_meta_project_package(${PACKAGE_NAME} PACKAGE_IS_PMPP) + if (PACKAGE_IS_PMPP) + tribits_set_all_packages_package_enable_variable( ${PROJECT_NAME}_ENABLE_TESTS ${PACKAGE_NAME}_ENABLE_TESTS ) - TRIBITS_SET_ALL_PACKAGES_PACKAGE_ENABLE_VARIABLE( + tribits_set_all_packages_package_enable_variable( ${PROJECT_NAME}_ENABLE_EXAMPLES ${PACKAGE_NAME}_ENABLE_EXAMPLES ) - ENDIF() - ENDIF() -ENDMACRO() + endif() + endif() +endmacro() -MACRO(TRIBITS_PRIVATE_ENABLE_FORWARD_PACKAGE FORWARD_DEP_PACKAGE_NAME PACKAGE_NAME) - TRIBITS_IMPLICIT_PACKAGE_ENABLE_IS_ALLOWED( "" ${FORWARD_DEP_PACKAGE_NAME} +macro(tribits_private_enable_forward_package FORWARD_DEP_PACKAGE_NAME PACKAGE_NAME) + tribits_implicit_package_enable_is_allowed( "" ${FORWARD_DEP_PACKAGE_NAME} ALLOW_PACKAGE_ENABLE ) - #MESSAGE("TRIBITS_PRIVATE_ENABLE_FORWARD_PACKAGE: " + #message("TRIBITS_PRIVATE_ENABLE_FORWARD_PACKAGE: " # "${FORWARD_DEP_PACKAGE_NAME} ${PACKAGE_NAME} ${ALLOW_PACKAGE_ENABLE}") # Enable the forward package if it is not already set to ON or OFF - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}) - IF(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} STREQUAL "" + assert_defined(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}) + if(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} STREQUAL "" AND ALLOW_PACKAGE_ENABLE ) - MESSAGE("-- " "Setting ${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}=ON" + message("-- " "Setting ${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}=ON" " because ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=ON") - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}) - SET(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} ON) - ENDIF() -ENDMACRO() + assert_defined(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}) + set(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} ON) + endif() +endmacro() # Macro used to set ${PROJECT_NAME}_ENABLE_${FWD_PACKAGE_NAME)=ON for all optional # and required forward library dependencies of the package ${PACKAGE_NAME} # -MACRO(TRIBITS_ENABLE_FORWARD_LIB_PACKAGE_ENABLES PACKAGE_NAME) +macro(tribits_enable_forward_lib_package_enables PACKAGE_NAME) - #MESSAGE("\nPACKAGE_ARCH_ENABLE_FORWARD_PACKAGE_ENABLES ${PACKAGE_NAME}") - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + #message("\nPACKAGE_ARCH_ENABLE_FORWARD_PACKAGE_ENABLES ${PACKAGE_NAME}") + #print_var(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) # Enable the forward packages if this package is enabled - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - FOREACH(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_LIB_REQUIRED_DEP_PACKAGES}) - TRIBITS_PRIVATE_ENABLE_FORWARD_PACKAGE(${FWD_DEP_PKG} ${PACKAGE_NAME}) - ENDFOREACH() + foreach(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_LIB_REQUIRED_DEP_PACKAGES}) + tribits_private_enable_forward_package(${FWD_DEP_PKG} ${PACKAGE_NAME}) + endforeach() - FOREACH(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_ENABLE_FORWARD_PACKAGE(${FWD_DEP_PKG} ${PACKAGE_NAME}) - ENDFOREACH() + foreach(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES}) + tribits_private_enable_forward_package(${FWD_DEP_PKG} ${PACKAGE_NAME}) + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # Macro used to set ${PROJECT_NAME}_ENABLE_${FWD_PACKAGE_NAME)=ON for all optional # and required forward test/example dependencies of the package ${PACKAGE_NAME} # -MACRO(TRIBITS_ENABLE_FORWARD_TEST_PACKAGE_ENABLES PACKAGE_NAME) +macro(tribits_enable_forward_test_package_enables PACKAGE_NAME) - #MESSAGE("\nPACKAGE_ARCH_ENABLE_FORWARD_PACKAGE_ENABLES ${PACKAGE_NAME}") - #MESSAGE("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}") + #message("\nPACKAGE_ARCH_ENABLE_FORWARD_PACKAGE_ENABLES ${PACKAGE_NAME}") + #message("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}") # Enable the forward packages if this package is enabled - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - FOREACH(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES}) - TRIBITS_PRIVATE_ENABLE_FORWARD_PACKAGE(${FWD_DEP_PKG} ${PACKAGE_NAME}) - ENDFOREACH() + foreach(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES}) + tribits_private_enable_forward_package(${FWD_DEP_PKG} ${PACKAGE_NAME}) + endforeach() - FOREACH(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_ENABLE_FORWARD_PACKAGE(${FWD_DEP_PKG} ${PACKAGE_NAME}) - ENDFOREACH() + foreach(FWD_DEP_PKG ${${PACKAGE_NAME}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES}) + tribits_private_enable_forward_package(${FWD_DEP_PKG} ${PACKAGE_NAME}) + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # @@ -908,116 +907,116 @@ ENDMACRO() # -MACRO(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGE PACKAGE_NAME DEP_PACKAGE_NAME +macro(tribits_private_enable_dep_package PACKAGE_NAME DEP_PACKAGE_NAME OPTREQ_IN ) - #MESSAGE("TRIBITS_PRIVATE_ENABLE_DEP_PACKAGE: '${PACKAGE_NAME}' '${DEP_PACKAGE_NAME}' '${OPTREQ_IN}'") + #message("TRIBITS_PRIVATE_ENABLE_DEP_PACKAGE: '${PACKAGE_NAME}' '${DEP_PACKAGE_NAME}' '${OPTREQ_IN}'") - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}) - #PRINT_VAR(${PACKAGE_NAME}_ENABLE_${DEP_PACKAGE_NAME}) + assert_defined(${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}) + #print_var(${PACKAGE_NAME}_ENABLE_${DEP_PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}) - #MESSAGE("The package is already enabled so there is nothing to enable!") + #message("The package is already enabled so there is nothing to enable!") - ELSEIF (${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME} STREQUAL "") + elseif (${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME} STREQUAL "") - SET(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE "") + set(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE "") - IF ("${OPTREQ_IN}" STREQUAL "REQUIRED") + if ("${OPTREQ_IN}" STREQUAL "REQUIRED") - #MESSAGE("Always enable the upstream dependency if it is required") + #message("Always enable the upstream dependency if it is required") - MESSAGE("-- " "Setting ${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}=ON" + message("-- " "Setting ${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}=ON" " because ${PACKAGE_NAME} has a required dependence on ${DEP_PACKAGE_NAME}") - SET(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE ON) + set(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE ON) - ELSEIF (${PACKAGE_NAME}_ENABLE_${DEP_PACKAGE_NAME}) + elseif (${PACKAGE_NAME}_ENABLE_${DEP_PACKAGE_NAME}) # Enable the upstream package if the user directly specified the - # optional package enable reguardless if it is PT or ST or even EX. + # optional package enable regardless if it is PT or ST or even EX. - MESSAGE("-- " "Setting ${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}=ON" + message("-- " "Setting ${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}=ON" " because ${PACKAGE_NAME}_ENABLE_${DEP_PACKAGE_NAME}=ON") - SET(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE ON) + set(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE ON) - ELSEIF (${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES) + elseif (${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES) # Enable the package if there is an optional dependence and we are asked # to enabled optional dependencies. - TRIBITS_IMPLICIT_PACKAGE_ENABLE_IS_ALLOWED(${PACKAGE_NAME} ${DEP_PACKAGE_NAME} + tribits_implicit_package_enable_is_allowed(${PACKAGE_NAME} ${DEP_PACKAGE_NAME} ALLOW_IMPLICIT_ENABLE) - IF (ALLOW_IMPLICIT_ENABLE) - MESSAGE("-- " "Setting ${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}=ON" + if (ALLOW_IMPLICIT_ENABLE) + message("-- " "Setting ${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}=ON" " because ${PACKAGE_NAME} has an optional dependence on ${DEP_PACKAGE_NAME}") - SET(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE ON) - ENDIF() + set(TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE ON) + endif() - ENDIF() + endif() # Enable the upstream package - IF (TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE) - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}) - SET(${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME} ON) - ENDIF() + if (TRIBITS_PRIVATE_ENABLE_DEP_PACKAGES_ENABLE_PACKAGE) + assert_defined(${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME}) + set(${PROJECT_NAME}_ENABLE_${DEP_PACKAGE_NAME} ON) + endif() - ENDIF() + endif() -ENDMACRO() +endmacro() -MACRO(TRIBITS_PRIVATE_ENABLE_DEP_TPL PACKAGE_NAME DEP_TPL_NAME) - ASSERT_DEFINED(TPL_ENABLE_${DEP_TPL_NAME}) - IF(TPL_ENABLE_${DEP_TPL_NAME} STREQUAL "") - MESSAGE("-- " "Setting TPL_ENABLE_${DEP_TPL_NAME}=ON because" +macro(tribits_private_enable_dep_tpl PACKAGE_NAME DEP_TPL_NAME) + assert_defined(TPL_ENABLE_${DEP_TPL_NAME}) + if(TPL_ENABLE_${DEP_TPL_NAME} STREQUAL "") + message("-- " "Setting TPL_ENABLE_${DEP_TPL_NAME}=ON because" " it is required by the enabled package ${PACKAGE_NAME}") - ASSERT_DEFINED(TPL_ENABLE_${DEP_TPL_NAME}) - SET(TPL_ENABLE_${DEP_TPL_NAME} ON) - SET(TPL_${DEP_TPL_NAME}_ENABLING_PKG ${PACKAGE_NAME}) - ENDIF() -ENDMACRO() + assert_defined(TPL_ENABLE_${DEP_TPL_NAME}) + set(TPL_ENABLE_${DEP_TPL_NAME} ON) + set(TPL_${DEP_TPL_NAME}_ENABLING_PKG ${PACKAGE_NAME}) + endif() +endmacro() -MACRO(TRIBITS_PRIVATE_ENABLE_OPTIONAL_DEP_TPL PACKAGE_NAME DEP_TPL_NAME) - #ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_${DEP_TPL_NAME}) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} +macro(tribits_private_enable_optional_dep_tpl PACKAGE_NAME DEP_TPL_NAME) + #assert_defined(${PACKAGE_NAME}_ENABLE_${DEP_TPL_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} AND ${PACKAGE_NAME}_ENABLE_${DEP_TPL_NAME} AND TPL_ENABLE_${DEP_TPL_NAME} STREQUAL "" ) - MESSAGE("-- " "Setting TPL_ENABLE_${DEP_TPL_NAME}=ON because" + message("-- " "Setting TPL_ENABLE_${DEP_TPL_NAME}=ON because" " ${PACKAGE_NAME}_ENABLE_${DEP_TPL_NAME}=ON") - ASSERT_DEFINED(TPL_ENABLE_${DEP_TPL_NAME}) - SET(TPL_ENABLE_${DEP_TPL_NAME} ON) - ENDIF() -ENDMACRO() + assert_defined(TPL_ENABLE_${DEP_TPL_NAME}) + set(TPL_ENABLE_${DEP_TPL_NAME} ON) + endif() +endmacro() # Macro that enables the optional TPLs for given package # -MACRO(TRIBITS_ENABLE_OPTIONAL_TPLS PACKAGE_NAME) +macro(tribits_enable_optional_tpls PACKAGE_NAME) - #MESSAGE("TRIBITS_ENABLE_OPTIONAL_TPLS: ${PACKAGE_NAME}") - #MESSAGE("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}") + #message("TRIBITS_ENABLE_OPTIONAL_TPLS: ${PACKAGE_NAME}") + #message("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}") - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - FOREACH(DEP_TPL ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS}) - TRIBITS_PRIVATE_ENABLE_OPTIONAL_DEP_TPL(${PACKAGE_NAME} ${DEP_TPL}) - ENDFOREACH() + foreach(DEP_TPL ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS}) + tribits_private_enable_optional_dep_tpl(${PACKAGE_NAME} ${DEP_TPL}) + endforeach() - FOREACH(DEP_TPL ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS}) - TRIBITS_PRIVATE_ENABLE_OPTIONAL_DEP_TPL(${PACKAGE_NAME} ${DEP_TPL}) - ENDFOREACH() + foreach(DEP_TPL ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS}) + tribits_private_enable_optional_dep_tpl(${PACKAGE_NAME} ${DEP_TPL}) + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # Macro that enables upstream (required and optional) SE packages given SE @@ -1026,190 +1025,190 @@ ENDMACRO() # Here I have to enable the required packages too or the logic just does no # work as expected. # -MACRO(TRIBITS_ENABLE_UPSTREAM_SE_PACKAGES PACKAGE_NAME) +macro(tribits_enable_upstream_se_packages PACKAGE_NAME) - #MESSAGE("TRIBITS_ENABLE_UPSTREAM_SE_PACKAGES: ${PACKAGE_NAME}") - #MESSAGE("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}") + #message("TRIBITS_ENABLE_UPSTREAM_SE_PACKAGES: ${PACKAGE_NAME}") + #message("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}") - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - FOREACH(DEP_PKG ${${PACKAGE_NAME}_LIB_REQUIRED_DEP_PACKAGES}) - TRIBITS_PRIVATE_ENABLE_DEP_PACKAGE(${PACKAGE_NAME} ${DEP_PKG} REQUIRED) - ENDFOREACH() + foreach(DEP_PKG ${${PACKAGE_NAME}_LIB_REQUIRED_DEP_PACKAGES}) + tribits_private_enable_dep_package(${PACKAGE_NAME} ${DEP_PKG} REQUIRED) + endforeach() - FOREACH(DEP_PKG ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_ENABLE_DEP_PACKAGE(${PACKAGE_NAME} ${DEP_PKG} OPTIONAL) - ENDFOREACH() + foreach(DEP_PKG ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES}) + tribits_private_enable_dep_package(${PACKAGE_NAME} ${DEP_PKG} OPTIONAL) + endforeach() - FOREACH(DEP_PKG ${${PACKAGE_NAME}_TEST_REQUIRED_DEP_PACKAGES}) - TRIBITS_PRIVATE_ENABLE_DEP_PACKAGE(${PACKAGE_NAME} ${DEP_PKG} REQUIRED) - ENDFOREACH() + foreach(DEP_PKG ${${PACKAGE_NAME}_TEST_REQUIRED_DEP_PACKAGES}) + tribits_private_enable_dep_package(${PACKAGE_NAME} ${DEP_PKG} REQUIRED) + endforeach() - FOREACH(DEP_PKG ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES}) - TRIBITS_PRIVATE_ENABLE_DEP_PACKAGE(${PACKAGE_NAME} ${DEP_PKG} OPTIONAL) - ENDFOREACH() + foreach(DEP_PKG ${${PACKAGE_NAME}_TEST_OPTIONAL_DEP_PACKAGES}) + tribits_private_enable_dep_package(${PACKAGE_NAME} ${DEP_PKG} OPTIONAL) + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() # Macro that sets the required TPLs for given package # -MACRO(TRIBITS_ENABLE_REQUIRED_TPLS PACKAGE_NAME) +macro(tribits_enable_required_tpls PACKAGE_NAME) - #MESSAGE("PACKAGE_ARCH_ENABLE_REQUIRED_TPL_ENABLES: ${PACKAGE_NAME}") - #MESSAGE("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}") + #message("PACKAGE_ARCH_ENABLE_REQUIRED_TPL_ENABLES: ${PACKAGE_NAME}") + #message("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}") - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - FOREACH(DEP_TPL ${${PACKAGE_NAME}_LIB_REQUIRED_DEP_TPLS}) - TRIBITS_PRIVATE_ENABLE_DEP_TPL(${PACKAGE_NAME} ${DEP_TPL}) - ENDFOREACH() + foreach(DEP_TPL ${${PACKAGE_NAME}_LIB_REQUIRED_DEP_TPLS}) + tribits_private_enable_dep_tpl(${PACKAGE_NAME} ${DEP_TPL}) + endforeach() - FOREACH(DEP_TPL ${${PACKAGE_NAME}_TEST_REQUIRED_DEP_TPLS}) - TRIBITS_PRIVATE_ENABLE_DEP_TPL(${PACKAGE_NAME} ${DEP_TPL}) - ENDFOREACH() + foreach(DEP_TPL ${${PACKAGE_NAME}_TEST_REQUIRED_DEP_TPLS}) + tribits_private_enable_dep_tpl(${PACKAGE_NAME} ${DEP_TPL}) + endforeach() - ENDIF() + endif() -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_ADJUST_PACKAGE_ENABLES() +# @MACRO: tribits_adjust_package_enables() # # Usage: # -# TRIBITS_ADJUST_PACKAGE_ENABLES() +# tribits_adjust_package_enables() # # Macro that adjusts all of the package enables from what the user input to # the final set that will be used to enable packages. # -MACRO(TRIBITS_ADJUST_PACKAGE_ENABLES) - - IF (${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES) - MESSAGE("") - MESSAGE("Setting to empty '' all enabled packages on reqeust ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) - IF (${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) - SET_CACHE_ON_OFF_EMPTY(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE} "" +macro(tribits_adjust_package_enables) + + if (${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES) + message("") + message("Setting to empty '' all enabled packages on request ...") + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) + if (${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) + set_cache_on_off_empty(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE} "" "Forced to empty '' by ${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES=ON" FORCE) - SET(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE} "") - ENDIF() - #PRINT_VAR(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) + set(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE} "") + endif() + #print_var(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) # NOTE: Above, we don't want to set to empty those packages that have hard # disables because this will mess up the logic in later invocations. - ENDFOREACH() - ADVANCED_SET(${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES OFF CACHE BOOL + endforeach() + advanced_set(${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES OFF CACHE BOOL "Forced to FALSE after use" FORCE) - ENDIF() + endif() # # A) Sweep forward through and apply all disables first! # - TRIBITS_GET_NONDISABLED_LIST( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} + tribits_get_nondisabled_list( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} ${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES "") - MESSAGE("") - MESSAGE("Disabling all packages that have a required dependency" + message("") + message("Disabling all packages that have a required dependency" " on disabled TPLs and optional package TPL support based on TPL_ENABLE_=OFF ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}) - TRIBITS_DISABLE_PACKAGE_IF_TPL_DISABLED(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}) + tribits_disable_package_if_tpl_disabled(${TRIBITS_PACKAGE}) + endforeach() - MESSAGE("") - MESSAGE("Disabling subpackages for hard disables of parent packages" + message("") + message("Disabling subpackages for hard disables of parent packages" " due to ${PROJECT_NAME}_ENABLE_=OFF ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) - TRIBITS_DISABLE_PARENTS_SUBPACKAGES(${TRIBITS_PACKAGE}) - ENDFOREACH() - - MESSAGE("") - MESSAGE("Disabling forward required SE packages and optional intra-package" - " support that have a dependancy on disabled SE packages" + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) + tribits_disable_parents_subpackages(${TRIBITS_PACKAGE}) + endforeach() + + message("") + message("Disabling forward required SE packages and optional intra-package" + " support that have a dependency on disabled SE packages" " ${PROJECT_NAME}_ENABLE_=OFF ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) - TRIBITS_DISABLE_FORWARD_REQUIRED_DEP_PACKAGES(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) + tribits_disable_forward_required_dep_packages(${TRIBITS_PACKAGE}) + endforeach() - TRIBITS_GET_NONDISABLED_LIST( ${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES ${PROJECT_NAME} + tribits_get_nondisabled_list( ${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES ${PROJECT_NAME} ${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES "") - SET(${PROJECT_NAME}_REVERSE_NOTDISABLED_SE_PACKAGES + set(${PROJECT_NAME}_REVERSE_NOTDISABLED_SE_PACKAGES "${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}") - LIST(REVERSE ${PROJECT_NAME}_REVERSE_NOTDISABLED_SE_PACKAGES) + list(REVERSE ${PROJECT_NAME}_REVERSE_NOTDISABLED_SE_PACKAGES) # # B) Apply all forward enables # - MESSAGE("") - MESSAGE("Enabling subpackages for hard enables of parent packages" + message("") + message("Enabling subpackages for hard enables of parent packages" " due to ${PROJECT_NAME}_ENABLE_=ON ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}) - TRIBITS_ENABLE_PARENTS_SUBPACKAGES(${TRIBITS_PACKAGE}) - ENDFOREACH() - - IF (${PROJECT_NAME}_ENABLE_ALL_PACKAGES) - MESSAGE("") - MESSAGE("Enabling all SE packages that are not currently disabled because of" + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}) + tribits_enable_parents_subpackages(${TRIBITS_PACKAGE}) + endforeach() + + if (${PROJECT_NAME}_ENABLE_ALL_PACKAGES) + message("") + message("Enabling all SE packages that are not currently disabled because of" " ${PROJECT_NAME}_ENABLE_ALL_PACKAGES=ON" " (${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE=${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE})" " ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}) - TRIBITS_APPLY_ALL_PACKAGE_ENABLES(${TRIBITS_PACKAGE}) - ENDFOREACH() - ENDIF() - - IF (${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES) - MESSAGE("") - MESSAGE("Sweep forward enabling all forward library dependent packages because" + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}) + tribits_apply_all_package_enables(${TRIBITS_PACKAGE}) + endforeach() + endif() + + if (${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES) + message("") + message("Sweep forward enabling all forward library dependent packages because" " ${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES=ON ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}) - TRIBITS_ENABLE_FORWARD_LIB_PACKAGE_ENABLES(${TRIBITS_PACKAGE}) - ENDFOREACH() - MESSAGE("") - MESSAGE("Sweep backward enabling all forward test dependent packages because" + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES}) + tribits_enable_forward_lib_package_enables(${TRIBITS_PACKAGE}) + endforeach() + message("") + message("Sweep backward enabling all forward test dependent packages because" " ${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES=ON ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_REVERSE_NOTDISABLED_SE_PACKAGES}) - TRIBITS_ENABLE_FORWARD_TEST_PACKAGE_ENABLES(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_REVERSE_NOTDISABLED_SE_PACKAGES}) + tribits_enable_forward_test_package_enables(${TRIBITS_PACKAGE}) + endforeach() # NOTE: Above, we want to sweep backward to enable test-dependent packages # because we don't want to enable package Z just because package Y was enabled # because it had a test-only dependency on package X. Sweeping backwards through # the packages makes sure this does not happen. - SET(${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES ON) - ENDIF() + set(${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES ON) + endif() - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES ${PROJECT_NAME} + tribits_get_enabled_list( ${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES ${PROJECT_NAME} ${PROJECT_NAME}_ENABLED_SE_PACKAGES "") # # C) Enable tests for currently enabled SE packages # - IF (${PROJECT_NAME}_ENABLE_TESTS OR ${PROJECT_NAME}_ENABLE_EXAMPLES) - MESSAGE("") - MESSAGE("Enabling all tests and/or examples that have not been" + if (${PROJECT_NAME}_ENABLE_TESTS OR ${PROJECT_NAME}_ENABLE_EXAMPLES) + message("") + message("Enabling all tests and/or examples that have not been" " explicitly disabled because ${PROJECT_NAME}_ENABLE_[TESTS,EXAMPLES]=ON ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - TRIBITS_APPLY_TEST_EXAMPLE_ENABLES(${TRIBITS_PACKAGE}) - ENDFOREACH() - ENDIF() + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + tribits_apply_test_example_enables(${TRIBITS_PACKAGE}) + endforeach() + endif() # NOTE: Above, we enable tests and examples here, before the remaining required # packages so that we don't enable tests that don't need to be enabled based # on the use of the option ${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES. @@ -1218,65 +1217,65 @@ MACRO(TRIBITS_ADJUST_PACKAGE_ENABLES) # D) Sweep backwards and enable upstream required and optional SE packages # - IF (${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES) - SET(EXTRA_MSG_STR " (and optional since ${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES=ON)") - ELSE() - SET(EXTRA_MSG_STR "") - ENDIF() + if (${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES) + set(EXTRA_MSG_STR " (and optional since ${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES=ON)") + else() + set(EXTRA_MSG_STR "") + endif() - MESSAGE("") - MESSAGE("Enabling all required${EXTRA_MSG_STR} upstream SE packages for current set of" + message("") + message("Enabling all required${EXTRA_MSG_STR} upstream SE packages for current set of" " enabled packages" " (${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE=${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE})" " ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_REVERSE_NOTDISABLED_SE_PACKAGES}) - TRIBITS_ENABLE_UPSTREAM_SE_PACKAGES(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_REVERSE_NOTDISABLED_SE_PACKAGES}) + tribits_enable_upstream_se_packages(${TRIBITS_PACKAGE}) + endforeach() # NOTE: Above, we have to loop through the packages backward to enable all # the packages that feed into these packages. This has to include *all* # upstream SE package enables including required SE packages, optional SE # packages (when ${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES), and SE # packages - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES ${PROJECT_NAME} + tribits_get_enabled_list( ${PROJECT_NAME}_NOTDISABLED_SE_PACKAGES ${PROJECT_NAME} ${PROJECT_NAME}_ENABLED_SE_PACKAGES "") - MESSAGE("") - MESSAGE("Enabling all optional intra-package enables _ENABLE_" + message("") + message("Enabling all optional intra-package enables _ENABLE_" " that are not currently disabled if both sets of packages are enabled ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - TRIBITS_POSTPROCESS_OPTIONAL_PACKAGE_ENABLES(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + tribits_postprocess_optional_package_enables(${TRIBITS_PACKAGE}) + endforeach() # # E) Enable TPLs # - MESSAGE("") - MESSAGE("Enabling all remaining required TPLs for current set of" + message("") + message("Enabling all remaining required TPLs for current set of" " enabled packages ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - TRIBITS_ENABLE_REQUIRED_TPLS(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + tribits_enable_required_tpls(${TRIBITS_PACKAGE}) + endforeach() - MESSAGE("") - MESSAGE("Enabling all optional package TPL support" + message("") + message("Enabling all optional package TPL support" " _ENABLE_ not currently disabled for" " enabled TPLs ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - TRIBITS_POSTPROCESS_OPTIONAL_TPL_ENABLES(${TRIBITS_PACKAGE}) - ENDFOREACH() - - MESSAGE("") - MESSAGE("Enabling TPLs based on _ENABLE_=ON if TPL is not explicitly disabled ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - TRIBITS_ENABLE_OPTIONAL_TPLS(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + tribits_postprocess_optional_tpl_enables(${TRIBITS_PACKAGE}) + endforeach() + + message("") + message("Enabling TPLs based on _ENABLE_=ON if TPL is not explicitly disabled ...") + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + tribits_enable_optional_tpls(${TRIBITS_PACKAGE}) + endforeach() # NOTE: We need to do this after the above optional package TPL support # logic so that the TPL will be turned on for this package only as requested # in bug 4298. @@ -1285,30 +1284,30 @@ MACRO(TRIBITS_ADJUST_PACKAGE_ENABLES) # F) Set user cache variables for current set of enabled SE packages # - MESSAGE("") - MESSAGE("Set cache entries for optional packages/TPLs and tests/examples for packages actually enabled ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - TRIBITS_ADD_OPTIONAL_PACKAGE_ENABLES(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + message("Set cache entries for optional packages/TPLs and tests/examples for packages actually enabled ...") + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + tribits_add_optional_package_enables(${TRIBITS_PACKAGE}) + endforeach() # # G) Turn on parent packages where at least one subpackage has been enabled # - MESSAGE("") - MESSAGE("Enabling the shell of non-enabled parent packages (mostly for show) that have at least one subpackage enabled ...") - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) - TRIBITS_POSTPROCESS_PACKAGE_WITH_SUBPACKAGES_ENABLES(${TRIBITS_PACKAGE}) - ENDFOREACH() + message("") + message("Enabling the shell of non-enabled parent packages (mostly for show) that have at least one subpackage enabled ...") + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) + tribits_postprocess_package_with_subpackages_enables(${TRIBITS_PACKAGE}) + endforeach() # NOTE: The above ensures that loops involving the parent package will # process the parent package but doing this last ensures that no downstream # dependencies will be enabled. - TRIBITS_SET_UP_ENABLED_LISTS_AND_SE_PKG_IDX() + tribits_set_up_enabled_lists_and_se_pkg_idx() -ENDMACRO() +endmacro() # Function that sets up the full package dependencies for each enabled @@ -1316,133 +1315,133 @@ ENDMACRO() # # This is needed in several different parts of the TriBITS implementation. # -FUNCTION(TRIBITS_PACKAGE_SET_FULL_ENABLED_DEP_PACKAGES PACKAGE_NAME) +function(tribits_package_set_full_enabled_dep_packages PACKAGE_NAME) - FOREACH(DEP_PKG ${${PACKAGE_NAME}_LIB_REQUIRED_DEP_PACKAGES}) - IF (${PROJECT_NAME}_ENABLE_${DEP_PKG}) - LIST(APPEND PACKAGE_FULL_DEPS_LIST ${DEP_PKG}) - ENDIF() + foreach(DEP_PKG ${${PACKAGE_NAME}_LIB_REQUIRED_DEP_PACKAGES}) + if (${PROJECT_NAME}_ENABLE_${DEP_PKG}) + list(APPEND PACKAGE_FULL_DEPS_LIST ${DEP_PKG}) + endif() # NOTE: This if() should not be needed but this is a safeguard - ENDFOREACH() + endforeach() - FOREACH(DEP_PKG ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES}) - IF (${PACKAGE_NAME}_ENABLE_${DEP_PKG}) - LIST(APPEND PACKAGE_FULL_DEPS_LIST ${DEP_PKG}) - ENDIF() - ENDFOREACH() + foreach(DEP_PKG ${${PACKAGE_NAME}_LIB_OPTIONAL_DEP_PACKAGES}) + if (${PACKAGE_NAME}_ENABLE_${DEP_PKG}) + list(APPEND PACKAGE_FULL_DEPS_LIST ${DEP_PKG}) + endif() + endforeach() - IF(PACKAGE_FULL_DEPS_LIST) - LIST(REMOVE_DUPLICATES PACKAGE_FULL_DEPS_LIST) + if(PACKAGE_FULL_DEPS_LIST) + list(REMOVE_DUPLICATES PACKAGE_FULL_DEPS_LIST) - FOREACH(DEP_PACKAGE ${PACKAGE_FULL_DEPS_LIST}) - LIST(APPEND PACKAGE_FULL_DEPS_LIST ${${DEP_PACKAGE}_FULL_ENABLED_DEP_PACKAGES}) - ENDFOREACH() + foreach(DEP_PACKAGE ${PACKAGE_FULL_DEPS_LIST}) + list(APPEND PACKAGE_FULL_DEPS_LIST ${${DEP_PACKAGE}_FULL_ENABLED_DEP_PACKAGES}) + endforeach() - LIST(REMOVE_DUPLICATES PACKAGE_FULL_DEPS_LIST) - ENDIF() + list(REMOVE_DUPLICATES PACKAGE_FULL_DEPS_LIST) + endif() - SET(ORDERED_PACKAGE_FULL_DEPS_LIST) + set(ORDERED_PACKAGE_FULL_DEPS_LIST) - FOREACH(DEP_PACKAGE ${PACKAGE_FULL_DEPS_LIST}) + foreach(DEP_PACKAGE ${PACKAGE_FULL_DEPS_LIST}) - #PRINT_VAR(${DEP_PACKAGE}_SE_PKG_IDX) - SET(DEP_PACKAGE_VALUE ${${DEP_PACKAGE}_SE_PKG_IDX}) + #print_var(${DEP_PACKAGE}_SE_PKG_IDX) + set(DEP_PACKAGE_VALUE ${${DEP_PACKAGE}_SE_PKG_IDX}) - SET(SORTED_INDEX 0) - SET(INSERTED_DEP_PACKAGE FALSE) + set(SORTED_INDEX 0) + set(INSERTED_DEP_PACKAGE FALSE) - FOREACH(SORTED_PACKAGE ${ORDERED_PACKAGE_FULL_DEPS_LIST}) + foreach(SORTED_PACKAGE ${ORDERED_PACKAGE_FULL_DEPS_LIST}) - #PRINT_VAR(${SORTED_PACKAGE}_SE_PKG_IDX) - SET(SORTED_PACKAGE_VALUE ${${SORTED_PACKAGE}_SE_PKG_IDX}) + #print_var(${SORTED_PACKAGE}_SE_PKG_IDX) + set(SORTED_PACKAGE_VALUE ${${SORTED_PACKAGE}_SE_PKG_IDX}) - IF (${DEP_PACKAGE_VALUE} GREATER ${SORTED_PACKAGE_VALUE}) - LIST(INSERT ORDERED_PACKAGE_FULL_DEPS_LIST ${SORTED_INDEX} ${DEP_PACKAGE}) - SET(INSERTED_DEP_PACKAGE TRUE) - BREAK() - ENDIF() + if (${DEP_PACKAGE_VALUE} GREATER ${SORTED_PACKAGE_VALUE}) + list(INSERT ORDERED_PACKAGE_FULL_DEPS_LIST ${SORTED_INDEX} ${DEP_PACKAGE}) + set(INSERTED_DEP_PACKAGE TRUE) + break() + endif() - MATH(EXPR SORTED_INDEX ${SORTED_INDEX}+1) + math(EXPR SORTED_INDEX ${SORTED_INDEX}+1) - ENDFOREACH() + endforeach() - IF(NOT INSERTED_DEP_PACKAGE) - LIST(APPEND ORDERED_PACKAGE_FULL_DEPS_LIST ${DEP_PACKAGE}) - ENDIF() + if(NOT INSERTED_DEP_PACKAGE) + list(APPEND ORDERED_PACKAGE_FULL_DEPS_LIST ${DEP_PACKAGE}) + endif() - ENDFOREACH() + endforeach() - GLOBAL_SET(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES + global_set(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES ${ORDERED_PACKAGE_FULL_DEPS_LIST}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) + endif() -ENDFUNCTION() +endfunction() # Function that creates enable-only dependency data-structures # -FUNCTION(TRIBITS_SET_UP_ENABLED_ONLY_DEPENDENCIES) +function(tribits_set_up_enabled_only_dependencies) - SET(GENERATE_EXPORT_DEPENDENCIES ${${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES}) - SET(LAST_EXPORT_SE_PACKAGE) + set(GENERATE_EXPORT_DEPENDENCIES ${${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES}) + set(LAST_EXPORT_SE_PACKAGE) - IF (GENERATE_EXPORT_DEPENDENCIES + if (GENERATE_EXPORT_DEPENDENCIES AND ${PROJECT_NAME}_GENERATE_EXPORT_FILES_FOR_ONLY_LISTED_SE_PACKAGES ) # Find the last enabled SE package for which an export file is requested. - SET(LAST_SE_PKG_IDX -1) - SET(LAST_SE_PKG) - FOREACH(SE_PKG ${${PROJECT_NAME}_GENERATE_EXPORT_FILES_FOR_ONLY_LISTED_SE_PACKAGES}) - #PRINT_VAR(SE_PKG) - SET(SE_PKG_IDX ${${SE_PKG}_SE_PKG_IDX}) - #PRINT_VAR(SE_PKG_IDX) - IF (SE_PKG_IDX) + set(LAST_SE_PKG_IDX -1) + set(LAST_SE_PKG) + foreach(SE_PKG ${${PROJECT_NAME}_GENERATE_EXPORT_FILES_FOR_ONLY_LISTED_SE_PACKAGES}) + #print_var(SE_PKG) + set(SE_PKG_IDX ${${SE_PKG}_SE_PKG_IDX}) + #print_var(SE_PKG_IDX) + if (SE_PKG_IDX) # The listed package is enabled so we will consider it - IF (SE_PKG_IDX GREATER ${LAST_SE_PKG_IDX}) - SET(LAST_SE_PKG_IDX ${SE_PKG_IDX}) - SET(LAST_SE_PKG ${SE_PKG}) - #PRINT_VAR(LAST_SE_PKG_IDX) - #PRINT_VAR(LAST_SE_PKG) - ENDIF() - ENDIF() - ENDFOREACH() - IF (LAST_SE_PKG) + if (SE_PKG_IDX GREATER ${LAST_SE_PKG_IDX}) + set(LAST_SE_PKG_IDX ${SE_PKG_IDX}) + set(LAST_SE_PKG ${SE_PKG}) + #print_var(LAST_SE_PKG_IDX) + #print_var(LAST_SE_PKG) + endif() + endif() + endforeach() + if (LAST_SE_PKG) # At least one listed package was enabled - SET(LAST_EXPORT_SE_PACKAGE ${LAST_SE_PKG}) - ELSE() + set(LAST_EXPORT_SE_PACKAGE ${LAST_SE_PKG}) + else() # None of the listed packages were enabled so don't bother generating # any export dependencies - SET(GENERATE_EXPORT_DEPENDENCIES FALSE) - ENDIF() + set(GENERATE_EXPORT_DEPENDENCIES FALSE) + endif() - ENDIF() + endif() - IF (GENERATE_EXPORT_DEPENDENCIES) + if (GENERATE_EXPORT_DEPENDENCIES) - IF (LAST_EXPORT_SE_PACKAGE) - MESSAGE("\nSetting up export dependencies up through ${LAST_EXPORT_SE_PACKAGE} ...\n") - ELSE() - MESSAGE("\nSetting up export dependencies for all enabled SE packages ...\n") - ENDIF() + if (LAST_EXPORT_SE_PACKAGE) + message("\nSetting up export dependencies up through ${LAST_EXPORT_SE_PACKAGE} ...\n") + else() + message("\nSetting up export dependencies for all enabled SE packages ...\n") + endif() - FOREACH(TRIBITS_SE_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - TRIBITS_PACKAGE_SET_FULL_ENABLED_DEP_PACKAGES(${TRIBITS_SE_PACKAGE}) - IF (${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES) - SET(PRINTED_VAR FALSE) - PRINT_NONEMPTY_VAR_WITH_SPACES(${TRIBITS_SE_PACKAGE}_FULL_ENABLED_DEP_PACKAGES + foreach(TRIBITS_SE_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + tribits_package_set_full_enabled_dep_packages(${TRIBITS_SE_PACKAGE}) + if (${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES) + set(PRINTED_VAR FALSE) + print_nonempty_var_with_spaces(${TRIBITS_SE_PACKAGE}_FULL_ENABLED_DEP_PACKAGES PRINTED_VAR) - IF (NOT PRINTED_VAR) - MESSAGE("-- ${TRIBITS_SE_PACKAGE}: No library dependencies!") - ENDIF() - ENDIF() - IF ("${LAST_EXPORT_SE_PACKAGE}" STREQUAL ${TRIBITS_SE_PACKAGE}) - BREAK() - ENDIF() - ENDFOREACH() - - ENDIF() - -ENDFUNCTION() + if (NOT PRINTED_VAR) + message("-- ${TRIBITS_SE_PACKAGE}: No library dependencies!") + endif() + endif() + if ("${LAST_EXPORT_SE_PACKAGE}" STREQUAL ${TRIBITS_SE_PACKAGE}) + break() + endif() + endforeach() + + endif() + +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsBLASMangling.cmake b/cmake/tribits/core/package_arch/TribitsBLASMangling.cmake index 7215ccf7f683..cac8381a28c6 100644 --- a/cmake/tribits/core/package_arch/TribitsBLASMangling.cmake +++ b/cmake/tribits/core/package_arch/TribitsBLASMangling.cmake @@ -42,19 +42,19 @@ # NOTE: You should determine the overall Fortran name mangling first before # you include this file. -IF (F77_FUNC) - SET(F77_BLAS_MANGLE_DEFAULT ${F77_FUNC}) -ELSE() - SET(F77_BLAS_MANGLE_DEFAULT "UNDEFINED") -ENDIF() -IF(WIN32 AND NOT CYGWIN) - SET(F77_BLAS_MANGLE_DEFAULT "${F77_FUNC}") -ENDIF() +if (F77_FUNC) + set(F77_BLAS_MANGLE_DEFAULT ${F77_FUNC}) +else() + set(F77_BLAS_MANGLE_DEFAULT "UNDEFINED") +endif() +if(WIN32 AND NOT CYGWIN) + set(F77_BLAS_MANGLE_DEFAULT "${F77_FUNC}") +endif() # Set options so that users can change these! -SET(F77_BLAS_MANGLE ${F77_BLAS_MANGLE_DEFAULT} CACHE STRING +set(F77_BLAS_MANGLE ${F77_BLAS_MANGLE_DEFAULT} CACHE STRING "Name mangling to call functions in the provided BLAS library") -MARK_AS_ADVANCED(F77_BLAS_MANGLE) +mark_as_advanced(F77_BLAS_MANGLE) diff --git a/cmake/tribits/core/package_arch/TribitsCMakePolicies.cmake b/cmake/tribits/core/package_arch/TribitsCMakePolicies.cmake index 01a7510d9ef3..75569acb3905 100644 --- a/cmake/tribits/core/package_arch/TribitsCMakePolicies.cmake +++ b/cmake/tribits/core/package_arch/TribitsCMakePolicies.cmake @@ -39,8 +39,8 @@ # Define policies for CMake # It is assumed that the project has already called CMAKE_MINIMUM_REQUIRED. -CMAKE_POLICY(SET CMP0003 NEW) -CMAKE_POLICY(SET CMP0007 NEW) -CMAKE_POLICY(SET CMP0011 NEW) -CMAKE_POLICY(SET CMP0053 NEW) -CMAKE_POLICY(SET CMP0082 NEW) +cmake_policy(SET CMP0003 NEW) +cmake_policy(SET CMP0007 NEW) +cmake_policy(SET CMP0011 NEW) +cmake_policy(SET CMP0053 NEW) +cmake_policy(SET CMP0082 NEW) diff --git a/cmake/tribits/core/package_arch/TribitsCommonArgsHelpers.cmake b/cmake/tribits/core/package_arch/TribitsCommonArgsHelpers.cmake index 1bc6ff5c625a..a6370f153723 100644 --- a/cmake/tribits/core/package_arch/TribitsCommonArgsHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsCommonArgsHelpers.cmake @@ -37,34 +37,34 @@ # ************************************************************************ # @HEADER -FUNCTION(TRIBITS_SET_LINKER_LANGUAGE_FROM_ARG TARGET_NAME_IN LINKER_LANGUAGE_IN) +function(tribits_set_linker_language_from_arg TARGET_NAME_IN LINKER_LANGUAGE_IN) - IF( TRIBITS_SET_LINKER_LANGUAGE_FROM_ARG_DEBUG_DUMP) - MESSAGE("TRIBITS_SET_LINKER_LANGUAGE_FROM_ARG( '${TARGET_NAME_IN}' '${LINKER_LANGUAGE_IN}' )") - ENDIF() + if( TRIBITS_SET_LINKER_LANGUAGE_FROM_ARG_DEBUG_DUMP) + message("tribits_set_linker_language_from_arg( '${TARGET_NAME_IN}' '${LINKER_LANGUAGE_IN}' )") + endif() - IF(LINKER_LANGUAGE_IN) - SET(LINKER_LANGUAGE ${LINKER_LANGUAGE_IN}) - ELSEIF (${PROJECT_NAME}_ENABLE_CXX) - SET(LINKER_LANGUAGE CXX) - ELSEIF(${PROJECT_NAME}_ENABLE_C) - SET(LINKER_LANGUAGE C) - ELSE() - SET(LINKER_LANGUAGE) - ENDIF() + if(LINKER_LANGUAGE_IN) + set(LINKER_LANGUAGE ${LINKER_LANGUAGE_IN}) + elseif (${PROJECT_NAME}_ENABLE_CXX) + set(LINKER_LANGUAGE CXX) + elseif(${PROJECT_NAME}_ENABLE_C) + set(LINKER_LANGUAGE C) + else() + set(LINKER_LANGUAGE) + endif() - IF (LINKER_LANGUAGE) + if (LINKER_LANGUAGE) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE OR TRIBITS_SET_LINKER_LANGUAGE_FROM_ARG_DEBUG_DUMP) - MESSAGE("-- Setting linker language for target '${TARGET_NAME_IN}' to '${LINKER_LANGUAGE}'") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE OR TRIBITS_SET_LINKER_LANGUAGE_FROM_ARG_DEBUG_DUMP) + message("-- Setting linker language for target '${TARGET_NAME_IN}' to '${LINKER_LANGUAGE}'") + endif() - SET_PROPERTY( + set_property( TARGET ${TARGET_NAME_IN} APPEND PROPERTY LINKER_LANGUAGE ${LINKER_LANGUAGE} ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsConfigureCTestCustom.cmake b/cmake/tribits/core/package_arch/TribitsConfigureCTestCustom.cmake index a01f8bdee27d..cfc31872e057 100644 --- a/cmake/tribits/core/package_arch/TribitsConfigureCTestCustom.cmake +++ b/cmake/tribits/core/package_arch/TribitsConfigureCTestCustom.cmake @@ -37,13 +37,13 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsGeneralMacros) +include(TribitsGeneralMacros) -FUNCTION(TRIBITS_CONFIGURE_CTEST_CUSTOM TRIBITS_PROJECT_SOURCE_DIR OUTPUT_BINARY_DIR) - SET(CTEST_CUSTOM_IN ${TRIBITS_PROJECT_SOURCE_DIR}/cmake/ctest/CTestCustom.cmake.in) - #PRINT_VAR(CTEST_CUSTOM_IN) - IF(EXISTS ${CTEST_CUSTOM_IN}) - TRIBITS_TRACE_FILE_PROCESSING(PROJECT CONFIGURE "${CTEST_CUSTOM_IN}") - CONFIGURE_FILE(${CTEST_CUSTOM_IN} ${OUTPUT_BINARY_DIR}/CTestCustom.cmake) - ENDIF() -ENDFUNCTION() +function(tribits_configure_ctest_custom TRIBITS_PROJECT_SOURCE_DIR OUTPUT_BINARY_DIR) + set(CTEST_CUSTOM_IN ${TRIBITS_PROJECT_SOURCE_DIR}/cmake/ctest/CTestCustom.cmake.in) + #print_var(CTEST_CUSTOM_IN) + if(EXISTS ${CTEST_CUSTOM_IN}) + tribits_trace_file_processing(PROJECT CONFIGURE "${CTEST_CUSTOM_IN}") + configure_file(${CTEST_CUSTOM_IN} ${OUTPUT_BINARY_DIR}/CTestCustom.cmake) + endif() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsConstants.cmake b/cmake/tribits/core/package_arch/TribitsConstants.cmake index 7417477290ae..bdc63ef5d847 100644 --- a/cmake/tribits/core/package_arch/TribitsConstants.cmake +++ b/cmake/tribits/core/package_arch/TribitsConstants.cmake @@ -39,68 +39,68 @@ # Define the TriBITS minimum required CMake version -SET(TRIBITS_CMAKE_MINIMUM_REQUIRED 3.17.0) +set(TRIBITS_CMAKE_MINIMUM_REQUIRED 3.17.0) -MACRO(TRIBITS_ASESRT_MINIMUM_CMAKE_VERSION) +macro(tribits_asesrt_minimum_cmake_version) - IF (CMAKE_VERSION VERSION_LESS ${TRIBITS_CMAKE_MINIMUM_REQUIRED}) - MESSAGE(FATAL_ERROR "Error, TriBiTS must have version" + if (CMAKE_VERSION VERSION_LESS ${TRIBITS_CMAKE_MINIMUM_REQUIRED}) + message(FATAL_ERROR "Error, TriBiTS must have version" " ${TRIBITS_CMAKE_MINIMUM_REQUIRED} or higher!") - ENDIF() + endif() -ENDMACRO() +endmacro() # Misc constants -SET(${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES TRUE) -# NOTE: This is left to maintain backward compatiblity after upgrade to CMake +set(${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES TRUE) +# NOTE: This is left to maintain backward compatibility after upgrade to CMake # 3.17 but this option is now hard-coded to TRUE in the implementation. # File names for TriBITS system -SET(${PROJECT_NAME}_PACKAGES_FILE_NAME PackagesList.cmake) +set(${PROJECT_NAME}_PACKAGES_FILE_NAME PackagesList.cmake) -SET(${PROJECT_NAME}_TPLS_FILE_NAME TPLsList.cmake) +set(${PROJECT_NAME}_TPLS_FILE_NAME TPLsList.cmake) -SET(${PROJECT_NAME}_EXTRA_EXTERNAL_REPOS_FILE_NAME ExtraRepositoriesList.cmake) +set(${PROJECT_NAME}_EXTRA_EXTERNAL_REPOS_FILE_NAME ExtraRepositoriesList.cmake) -SET(${PROJECT_NAME}_EXTRA_PACKAGES_FILE_NAME PackagesList.cmake) +set(${PROJECT_NAME}_EXTRA_PACKAGES_FILE_NAME PackagesList.cmake) -SET(${PROJECT_NAME}_REPO_VERSION_FILE_NAME ${PROJECT_NAME}RepoVersion.txt) +set(${PROJECT_NAME}_REPO_VERSION_FILE_NAME ${PROJECT_NAME}RepoVersion.txt) -SET(${PROJECT_NAME}_EXTRA_TPLS_FILE_NAME TPLsList.cmake) +set(${PROJECT_NAME}_EXTRA_TPLS_FILE_NAME TPLsList.cmake) # Directories relative to the TriBITS base directory -SET(TRIBITS_PYTHON_SCRIPTS_DIR "python_utils") +set(TRIBITS_PYTHON_SCRIPTS_DIR "python_utils") -SET(TRIBITS_CI_SUPPORT_DIR "ci_support") +set(TRIBITS_CI_SUPPORT_DIR "ci_support") -SET(TRIBITS_CTEST_DRIVER_DIR "ctest_driver") +set(TRIBITS_CTEST_DRIVER_DIR "ctest_driver") -SET(TRIBITS_CMAKE_UTILS_DIR "core/utils") +set(TRIBITS_CMAKE_UTILS_DIR "core/utils") -SET(TRIBITS_CMAKE_PACKAGE_ARCH_DIR "core/package_arch") +set(TRIBITS_CMAKE_PACKAGE_ARCH_DIR "core/package_arch") -SET(TRIBITS_CMAKE_INSTALLATION_FILES_DIR "core/installation") +set(TRIBITS_CMAKE_INSTALLATION_FILES_DIR "core/installation") # Files and directories related to the specific project -SET(${PROJECT_NAME}_PACKAGE_DEPS_XML_FILE_NAME ${PROJECT_NAME}PackageDependencies.xml) +set(${PROJECT_NAME}_PACKAGE_DEPS_XML_FILE_NAME ${PROJECT_NAME}PackageDependencies.xml) -SET(${PROJECT_NAME}_CDASH_SUBPROJECT_DEPS_XML_FILE_NAME CDashSubprojectDependencies.xml) +set(${PROJECT_NAME}_CDASH_SUBPROJECT_DEPS_XML_FILE_NAME CDashSubprojectDependencies.xml) -SET(${PROJECT_NAME}_PACKAGE_DEPS_TABLE_HTML_FILE_NAME ${PROJECT_NAME}PackageDependenciesTable.html) +set(${PROJECT_NAME}_PACKAGE_DEPS_TABLE_HTML_FILE_NAME ${PROJECT_NAME}PackageDependenciesTable.html) -SET(${PROJECT_NAME}_PACKAGE_DEPS_FILES_DIR "cmake/dependencies") +set(${PROJECT_NAME}_PACKAGE_DEPS_FILES_DIR "cmake/dependencies") # Other stuff -IF(WIN32) +if(WIN32) #Apparently FIND_PROGRAM looks for an exact match of the file name. #So even though "git clone ..." is valid to use on windows we need to give the #full name of the command we want to run. - SET(GIT_NAME git.cmd) -ELSE(WIN32) - SET(GIT_NAME git) -ENDIF(WIN32) + set(GIT_NAME git.cmd) +else(WIN32) + set(GIT_NAME git) +endif(WIN32) diff --git a/cmake/tribits/core/package_arch/TribitsCopyFilesToBinaryDir.cmake b/cmake/tribits/core/package_arch/TribitsCopyFilesToBinaryDir.cmake index 596bcf007f3c..b2f29290f503 100644 --- a/cmake/tribits/core/package_arch/TribitsCopyFilesToBinaryDir.cmake +++ b/cmake/tribits/core/package_arch/TribitsCopyFilesToBinaryDir.cmake @@ -38,12 +38,12 @@ # @HEADER -INCLUDE(TribitsAddTestHelpers) -INCLUDE(CMakeParseArguments) +include(TribitsAddTestHelpers) +include(CMakeParseArguments) # -# @FUNCTION: TRIBITS_COPY_FILES_TO_BINARY_DIR() +# @FUNCTION: tribits_copy_files_to_binary_dir() # # Function that copies a list of files from a source directory to a # destination directory at configure time, typically so that it can be used in @@ -51,7 +51,7 @@ INCLUDE(CMakeParseArguments) # # Usage:: # -# TRIBITS_COPY_FILES_TO_BINARY_DIR( +# tribits_copy_files_to_binary_dir( # # [SOURCE_FILES ...] # [SOURCE_DIR ] @@ -76,7 +76,7 @@ INCLUDE(CMakeParseArguments) # # **1) Source files and destination files have the same name**:: # -# TRIBITS_COPY_FILES_TO_BINARY_DIR( +# tribits_copy_files_to_binary_dir( # # SOURCE_FILES ... # [SOURCE_DIR ] @@ -92,7 +92,7 @@ INCLUDE(CMakeParseArguments) # # **2) Source files have a prefix different from the destination files**:: # -# TRIBITS_COPY_FILES_TO_BINARY_DIR( +# tribits_copy_files_to_binary_dir( # # DEST_FILES ... # SOURCE_PREFIX @@ -108,7 +108,7 @@ INCLUDE(CMakeParseArguments) # # **3) Source files and destination files have completely different names**:: # -# TRIBITS_COPY_FILES_TO_BINARY_DIR( +# tribits_copy_files_to_binary_dir( # # SOURCE_FILES ... # [SOURCE_DIR ] @@ -167,12 +167,12 @@ INCLUDE(CMakeParseArguments) # Option that determines if the prefix ``${PACKAGE_NAME}_`` will be # appended to the arguments in the ``EXEDEPS`` list. # -FUNCTION(TRIBITS_COPY_FILES_TO_BINARY_DIR TARGET_NAME) +function(tribits_copy_files_to_binary_dir TARGET_NAME) # # A) Parse input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -184,138 +184,138 @@ FUNCTION(TRIBITS_COPY_FILES_TO_BINARY_DIR TARGET_NAME) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - SET(ADD_THE_TEST FALSE) - TRIBITS_ADD_TEST_PROCESS_CATEGORIES(ADD_THE_TEST) - IF (NOT ADD_THE_TEST) - RETURN() - ENDIF() + set(ADD_THE_TEST FALSE) + tribits_add_test_process_categories(ADD_THE_TEST) + if (NOT ADD_THE_TEST) + return() + endif() - IF (NOT PARSE_SOURCE_DIR) - SET(PARSE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - ENDIF() + if (NOT PARSE_SOURCE_DIR) + set(PARSE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + endif() - IF (NOT PARSE_DEST_DIR) - SET(PARSE_DEST_DIR ${CMAKE_CURRENT_BINARY_DIR}) - ENDIF() + if (NOT PARSE_DEST_DIR) + set(PARSE_DEST_DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() - SET(RENAME 1) + set(RENAME 1) - IF (PARSE_SOURCE_FILES AND NOT PARSE_DEST_FILES) - SET(PARSE_DEST_FILES ${PARSE_SOURCE_FILES}) - SET(RENAME 0) - ENDIF() + if (PARSE_SOURCE_FILES AND NOT PARSE_DEST_FILES) + set(PARSE_DEST_FILES ${PARSE_SOURCE_FILES}) + set(RENAME 0) + endif() - IF (PARSE_DEST_FILES AND NOT PARSE_SOURCE_FILES) - SET(PARSE_SOURCE_FILES ${PARSE_DEST_FILES}) - SET(RENAME 0) - ENDIF() + if (PARSE_DEST_FILES AND NOT PARSE_SOURCE_FILES) + set(PARSE_SOURCE_FILES ${PARSE_DEST_FILES}) + set(RENAME 0) + endif() # # B) Validate arguments # - LIST(LENGTH PARSE_SOURCE_DIR PARSE_SOURCE_DIR_LEN) - LIST(LENGTH PARSE_SOURCE_FILES PARSE_SOURCE_FILES_LEN) - LIST(LENGTH PARSE_SOURCE_PREFIX PARSE_SOURCE_PREFIX_LEN) - LIST(LENGTH PARSE_DEST_DIR PARSE_DEST_DIR_LEN) - LIST(LENGTH PARSE_DEST_FILES PARSE_DEST_FILES_LEN) + list(LENGTH PARSE_SOURCE_DIR PARSE_SOURCE_DIR_LEN) + list(LENGTH PARSE_SOURCE_FILES PARSE_SOURCE_FILES_LEN) + list(LENGTH PARSE_SOURCE_PREFIX PARSE_SOURCE_PREFIX_LEN) + list(LENGTH PARSE_DEST_DIR PARSE_DEST_DIR_LEN) + list(LENGTH PARSE_DEST_FILES PARSE_DEST_FILES_LEN) - IF (PARSE_SOURCE_DIR_LEN GREATER 1) - MESSAGE(SEND_ERROR "Error, there can only be 0 or one SOURCE_DIR arguments!") - ENDIF() + if (PARSE_SOURCE_DIR_LEN GREATER 1) + message(SEND_ERROR "Error, there can only be 0 or one SOURCE_DIR arguments!") + endif() - IF (PARSE_DEST_DIR_LEN GREATER 1) - MESSAGE(SEND_ERROR "Error, there can only be 0 or one DEST_DIR arguments!") - ENDIF() + if (PARSE_DEST_DIR_LEN GREATER 1) + message(SEND_ERROR "Error, there can only be 0 or one DEST_DIR arguments!") + endif() - IF (PARSE_SOURCE_PREFIX_LEN GREATER 1) - MESSAGE(SEND_ERROR "Error, If SOURCE_PREFIX can only take one argument!") - ENDIF() + if (PARSE_SOURCE_PREFIX_LEN GREATER 1) + message(SEND_ERROR "Error, If SOURCE_PREFIX can only take one argument!") + endif() - IF (PARSE_SOURCE_FILES_LEN EQUAL 0) - MESSAGE(SEND_ERROR "Error, there are no source files listed!") - ENDIF() + if (PARSE_SOURCE_FILES_LEN EQUAL 0) + message(SEND_ERROR "Error, there are no source files listed!") + endif() - IF (PARSE_DEST_FILES_LEN EQUAL 0) - MESSAGE(SEND_ERROR "Error, there are no destination files listed!") - ENDIF() + if (PARSE_DEST_FILES_LEN EQUAL 0) + message(SEND_ERROR "Error, there are no destination files listed!") + endif() - IF (NOT PARSE_SOURCE_FILES_LEN EQUAL ${PARSE_DEST_FILES_LEN}) - MESSAGE(SEND_ERROR "Error, there are not the same number of source files ${PARSE_SOURCE_FILES_LEN} and dest files ${PARSE_DEST_FILES_LEN}!") - ENDIF() + if (NOT PARSE_SOURCE_FILES_LEN EQUAL ${PARSE_DEST_FILES_LEN}) + message(SEND_ERROR "Error, there are not the same number of source files ${PARSE_SOURCE_FILES_LEN} and dest files ${PARSE_DEST_FILES_LEN}!") + endif() # # C) Build the list of command and dependencies # - SET(DEST_FILES_LIST) - IF(RENAME) - MATH(EXPR FILES_IDX_END "${PARSE_DEST_FILES_LEN}-1") + set(DEST_FILES_LIST) + if(RENAME) + math(EXPR FILES_IDX_END "${PARSE_DEST_FILES_LEN}-1") - FOREACH(FILE_IDX RANGE ${FILES_IDX_END}) + foreach(FILE_IDX RANGE ${FILES_IDX_END}) - LIST(GET PARSE_SOURCE_FILES ${FILE_IDX} SOURCE_FILE) - SET(SOURCE_FILE_FULL "${PARSE_SOURCE_DIR}/${PARSE_SOURCE_PREFIX}${SOURCE_FILE}") + list(GET PARSE_SOURCE_FILES ${FILE_IDX} SOURCE_FILE) + set(SOURCE_FILE_FULL "${PARSE_SOURCE_DIR}/${PARSE_SOURCE_PREFIX}${SOURCE_FILE}") - LIST(GET PARSE_DEST_FILES ${FILE_IDX} DEST_FILE) - SET(DEST_FILE_FULL "${PARSE_DEST_DIR}/${DEST_FILE}") + list(GET PARSE_DEST_FILES ${FILE_IDX} DEST_FILE) + set(DEST_FILE_FULL "${PARSE_DEST_DIR}/${DEST_FILE}") - #PRINT_VAR(SOURCE_FILE_FULL) - #PRINT_VAR(DEST_FILE_FULL) + #print_var(SOURCE_FILE_FULL) + #print_var(DEST_FILE_FULL) - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${DEST_FILE_FULL} DEPENDS ${SOURCE_FILE_FULL} COMMAND ${CMAKE_COMMAND} ARGS -E copy ${SOURCE_FILE_FULL} ${DEST_FILE_FULL} ) - LIST(APPEND DEST_FILES_LIST "${DEST_FILE_FULL}") + list(APPEND DEST_FILES_LIST "${DEST_FILE_FULL}") - ENDFOREACH() - ELSE() - FOREACH(SOURCE_FILE ${PARSE_SOURCE_FILES}) - SET(DEST_FILE "${SOURCE_FILE}") + endforeach() + else() + foreach(SOURCE_FILE ${PARSE_SOURCE_FILES}) + set(DEST_FILE "${SOURCE_FILE}") - SET(SOURCE_FILE_FULL "${PARSE_SOURCE_DIR}/${PARSE_SOURCE_PREFIX}${SOURCE_FILE}") - SET(DEST_FILE_FULL "${PARSE_DEST_DIR}/${DEST_FILE}") + set(SOURCE_FILE_FULL "${PARSE_SOURCE_DIR}/${PARSE_SOURCE_PREFIX}${SOURCE_FILE}") + set(DEST_FILE_FULL "${PARSE_DEST_DIR}/${DEST_FILE}") - #PRINT_VAR(SOURCE_FILE_FULL) - #PRINT_VAR(DEST_FILE_FULL) + #print_var(SOURCE_FILE_FULL) + #print_var(DEST_FILE_FULL) - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${DEST_FILE_FULL} DEPENDS ${SOURCE_FILE_FULL} COMMAND ${CMAKE_COMMAND} ARGS -E copy ${SOURCE_FILE_FULL} ${DEST_FILE_FULL} ) - LIST(APPEND DEST_FILES_LIST "${DEST_FILE_FULL}") + list(APPEND DEST_FILES_LIST "${DEST_FILE_FULL}") - ENDFOREACH() - ENDIF() + endforeach() + endif() - #PRINT_VAR(DEST_FILES_LIST) + #print_var(DEST_FILES_LIST) - IF (PACKAGE_NAME AND NOT PARSE_NOEXEPREFIX) - SET(PACKAGE_PREFIX "${PACKAGE_NAME}_") - SET(TARGET_NAME "${PACKAGE_PREFIX}${TARGET_NAME}") - ENDIF() + if (PACKAGE_NAME AND NOT PARSE_NOEXEPREFIX) + set(PACKAGE_PREFIX "${PACKAGE_NAME}_") + set(TARGET_NAME "${PACKAGE_PREFIX}${TARGET_NAME}") + endif() - ADD_CUSTOM_TARGET( ${TARGET_NAME} ALL + add_custom_target( ${TARGET_NAME} ALL DEPENDS ${DEST_FILES_LIST} ) - IF (PARSE_EXEDEPS) - FOREACH(EXEDEP ${PARSE_EXEDEPS}) - ADD_DEPENDENCIES(${PACKAGE_PREFIX}${EXEDEP} ${TARGET_NAME}) - ENDFOREACH() - ENDIF() + if (PARSE_EXEDEPS) + foreach(EXEDEP ${PARSE_EXEDEPS}) + add_dependencies(${PACKAGE_PREFIX}${EXEDEP} ${TARGET_NAME}) + endforeach() + endif() - IF (PARSE_TARGETDEPS) - FOREACH(TARGETDEP ${PARSE_TARGETDEPS}) - ADD_DEPENDENCIES(${TARGETDEP} ${TARGET_NAME}) - ENDFOREACH() - ENDIF() + if (PARSE_TARGETDEPS) + foreach(TARGETDEP ${PARSE_TARGETDEPS}) + add_dependencies(${TARGETDEP} ${TARGET_NAME}) + endforeach() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsCreateClientTemplateHeaders.cmake b/cmake/tribits/core/package_arch/TribitsCreateClientTemplateHeaders.cmake index 6f6adabdcd1d..3288e28ba4bf 100644 --- a/cmake/tribits/core/package_arch/TribitsCreateClientTemplateHeaders.cmake +++ b/cmake/tribits/core/package_arch/TribitsCreateClientTemplateHeaders.cmake @@ -38,8 +38,8 @@ # @HEADER -INCLUDE(CMakeParseArguments) -INCLUDE(PrintVar) +include(CMakeParseArguments) +include(PrintVar) # @@ -49,7 +49,7 @@ INCLUDE(PrintVar) # # Usage: # -# TRIBITS_CREATE_CLIENT_TEMPLATE_HEADERS( +# tribits_create_client_template_headers( # BASE_DIR # [ADDITIONAL_OUTPUT_DIRS ABSDIR1 ABSDIR2 ...] # ) @@ -65,7 +65,7 @@ INCLUDE(PrintVar) # ADDITIONAL_OUTPUT_DIRS # # If set, then the files will be copied to an additional output -# directories as well. These must be abolute paths. +# directories as well. These must be absolute paths. # # The default file extensions are: # @@ -73,15 +73,15 @@ INCLUDE(PrintVar) # ${PARENT_PACKAGE_NAME}_TEMPLATE_DEF_EXT = "_def.hpp" # -FUNCTION(TRIBITS_CREATE_CLIENT_TEMPLATE_HEADERS BASE_DIR) +function(tribits_create_client_template_headers BASE_DIR) - #PRINT_VAR(BASE_DIR) + #print_var(BASE_DIR) # # A) Parse the input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -93,87 +93,87 @@ FUNCTION(TRIBITS_CREATE_CLIENT_TEMPLATE_HEADERS BASE_DIR) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() # # B) Get the names of the extensions # - IF (NOT ${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT) - SET(${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT "_decl.hpp") - ENDIF() + if (NOT ${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT) + set(${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT "_decl.hpp") + endif() - IF (NOT ${PARENT_PACKAGE_NAME}_TEMPLATE_DEF_EXT) - SET(${PARENT_PACKAGE_NAME}_TEMPLATE_DEF_EXT "_def.hpp") - ENDIF() + if (NOT ${PARENT_PACKAGE_NAME}_TEMPLATE_DEF_EXT) + set(${PARENT_PACKAGE_NAME}_TEMPLATE_DEF_EXT "_def.hpp") + endif() # # C) Glob the names of all the X_decl.hpp files # - FILE(GLOB DECL_HEADERS_LIST "${BASE_DIR}/*${${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT}") - #PRINT_VAR(DECL_HEADERS_LIST) + file(GLOB DECL_HEADERS_LIST "${BASE_DIR}/*${${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT}") + #print_var(DECL_HEADERS_LIST) # # D) Write the client header files for each globed decl file # - ASSERT_DEFINED(HAVE_${PARENT_PACKAGE_NAME_UC}_EXPLICIT_INSTANTIATION) + assert_defined(HAVE_${PARENT_PACKAGE_NAME_UC}_EXPLICIT_INSTANTIATION) - FOREACH(DECL_HEADER ${DECL_HEADERS_LIST}) + foreach(DECL_HEADER ${DECL_HEADERS_LIST}) # Get the base file names (without _decl.hpp) - STRING(REGEX REPLACE ".*/(.+)${${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT}" "\\1" DECL_HEADER_BASE ${DECL_HEADER}) - #PRINT_VAR(DECL_HEADER_BASE) + string(REGEX REPLACE ".*/(.+)${${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT}" "\\1" DECL_HEADER_BASE ${DECL_HEADER}) + #print_var(DECL_HEADER_BASE) # Create the client header file - SET(CLIENT_HEADER_STR "") - APPEND_STRING_VAR(CLIENT_HEADER_STR + set(CLIENT_HEADER_STR "") + append_string_var(CLIENT_HEADER_STR "#include \"${DECL_HEADER_BASE}${${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT}\"\n" ) - IF (HAVE_${PARENT_PACKAGE_NAME_UC}_EXPLICIT_INSTANTIATION) - SET(TEMPLATE_INSTANT_TYPE_NAME "explicit instantiation") - ELSE() - SET(TEMPLATE_INSTANT_TYPE_NAME "implicit instantiation") - APPEND_STRING_VAR(CLIENT_HEADER_STR + if (HAVE_${PARENT_PACKAGE_NAME_UC}_EXPLICIT_INSTANTIATION) + set(TEMPLATE_INSTANT_TYPE_NAME "explicit instantiation") + else() + set(TEMPLATE_INSTANT_TYPE_NAME "implicit instantiation") + append_string_var(CLIENT_HEADER_STR "#include \"${DECL_HEADER_BASE}${${PARENT_PACKAGE_NAME}_TEMPLATE_DEF_EXT}\"\n" ) - ENDIF() - SET(BIN_HEADER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DECL_HEADER_BASE}.hpp") - SET(WRITE_NEW_HEADER_FILE TRUE) - IF (EXISTS "${BIN_HEADER_FILE}") + endif() + set(BIN_HEADER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DECL_HEADER_BASE}.hpp") + set(WRITE_NEW_HEADER_FILE TRUE) + if (EXISTS "${BIN_HEADER_FILE}") # See if the file is the same and if it is, skip writing it again to avoid - # unecessarily rebuilding object code. - FILE(READ "${BIN_HEADER_FILE}" EXISTING_BIN_HEADER_STR) - IF (CLIENT_HEADER_STR STREQUAL EXISTING_BIN_HEADER_STR) - SET(WRITE_NEW_HEADER_FILE FALSE) - ENDIF() - ENDIF() + # unnecessarily rebuilding object code. + file(READ "${BIN_HEADER_FILE}" EXISTING_BIN_HEADER_STR) + if (CLIENT_HEADER_STR STREQUAL EXISTING_BIN_HEADER_STR) + set(WRITE_NEW_HEADER_FILE FALSE) + endif() + endif() # Write the header file - IF (WRITE_NEW_HEADER_FILE) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Writing ${TEMPLATE_INSTANT_TYPE_NAME} header ${BIN_HEADER_FILE}") - ENDIF() - FILE(WRITE "${BIN_HEADER_FILE}" "${CLIENT_HEADER_STR}") - ENDIF() + if (WRITE_NEW_HEADER_FILE) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Writing ${TEMPLATE_INSTANT_TYPE_NAME} header ${BIN_HEADER_FILE}") + endif() + file(WRITE "${BIN_HEADER_FILE}" "${CLIENT_HEADER_STR}") + endif() # Create the SIERRA BJAM version of the header file - FOREACH(OUTPUT_DIR ${PARSE_ADDITIONAL_OUTPUT_DIRS}) - SET(EXTERNAL_CLIENT_HEADER_STR "") - APPEND_STRING_VAR(EXTERNAL_CLIENT_HEADER_STR + foreach(OUTPUT_DIR ${PARSE_ADDITIONAL_OUTPUT_DIRS}) + set(EXTERNAL_CLIENT_HEADER_STR "") + append_string_var(EXTERNAL_CLIENT_HEADER_STR "#include \"${DECL_HEADER_BASE}${${PARENT_PACKAGE_NAME}_TEMPLATE_DECL_EXT}\"\n" "#ifndef HAVE_${PARENT_PACKAGE_NAME_UC}_EXPLICIT_INSTANTIATION\n" "# include \"${DECL_HEADER_BASE}${${PARENT_PACKAGE_NAME}_TEMPLATE_DEF_EXT}\"\n" "#endif\n" ) - SET(EXTERNAL_HEADER "${OUTPUT_DIR}/${DECL_HEADER_BASE}.hpp") - IF (NOT EXISTS "${EXTERNAL_HEADER}") - FILE(WRITE "${EXTERNAL_HEADER}" "${EXTERNAL_CLIENT_HEADER_STR}") - ENDIF() - ENDFOREACH() + set(EXTERNAL_HEADER "${OUTPUT_DIR}/${DECL_HEADER_BASE}.hpp") + if (NOT EXISTS "${EXTERNAL_HEADER}") + file(WRITE "${EXTERNAL_HEADER}" "${EXTERNAL_CLIENT_HEADER_STR}") + endif() + endforeach() - ENDFOREACH() + endforeach() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsDefineStandardCompileVars.cmake b/cmake/tribits/core/package_arch/TribitsDefineStandardCompileVars.cmake index 7f3ebd16160b..dc7ddf0a6014 100644 --- a/cmake/tribits/core/package_arch/TribitsDefineStandardCompileVars.cmake +++ b/cmake/tribits/core/package_arch/TribitsDefineStandardCompileVars.cmake @@ -37,97 +37,97 @@ # ************************************************************************ # @HEADER -INCLUDE(CMakeBuildTypesList) +include(CMakeBuildTypesList) -INCLUDE(AdvancedSet) -INCLUDE(AssertDefined) -INCLUDE(MultilineSet) -INCLUDE(DualScopeSet) -INCLUDE(PrependCmndlineArgs) +include(AdvancedSet) +include(AssertDefined) +include(MultilineSet) +include(DualScopeSet) +include(PrependCmndlineArgs) # # Macro that just defines the basic flags # -MACRO(TRIBITS_DEFINE_STANDARD_COMPILE_FLAGS_VARS ENABLE_SHADOWING_WARNINGS) +macro(tribits_define_standard_compile_flags_vars ENABLE_SHADOWING_WARNINGS) # # Setup and general flags # - SET(GENERAL_BUILD_FLAGS) # Applies to all builds, period + set(GENERAL_BUILD_FLAGS) # Applies to all builds, period - IF (${PROJECT_NAME}_ENABLE_CHECKED_STL) - PREPEND_CMNDLINE_ARGS(GENERAL_BUILD_FLAGS "-D_GLIBCXX_DEBUG") - ENDIF() + if (${PROJECT_NAME}_ENABLE_CHECKED_STL) + prepend_cmndline_args(GENERAL_BUILD_FLAGS "-D_GLIBCXX_DEBUG") + endif() - SET(DEBUG_SYMBOLS_FLAGS "-g") + set(DEBUG_SYMBOLS_FLAGS "-g") - SET(GENERAL_DEBUG_FLAGS "${DEBUG_SYMBOLS_FLAGS} -O0") + set(GENERAL_DEBUG_FLAGS "${DEBUG_SYMBOLS_FLAGS} -O0") - SET(C_DEBUG_FLAGS "${GENERAL_DEBUG_FLAGS}") - SET(CXX_DEBUG_FLAGS "${GENERAL_DEBUG_FLAGS}") - SET(Fortran_DEBUG_FLAGS "${GENERAL_DEBUG_FLAGS}") + set(C_DEBUG_FLAGS "${GENERAL_DEBUG_FLAGS}") + set(CXX_DEBUG_FLAGS "${GENERAL_DEBUG_FLAGS}") + set(Fortran_DEBUG_FLAGS "${GENERAL_DEBUG_FLAGS}") - SET(GENERAL_RELEASE_FLAGS "-O3") + set(GENERAL_RELEASE_FLAGS "-O3") - SET(C_RELEASE_FLAGS "${GENERAL_RELEASE_FLAGS} -DNDEBUG") - SET(CXX_RELEASE_FLAGS "${GENERAL_RELEASE_FLAGS} -DNDEBUG") - SET(Fortran_RELEASE_FLAGS "${GENERAL_RELEASE_FLAGS}") + set(C_RELEASE_FLAGS "${GENERAL_RELEASE_FLAGS} -DNDEBUG") + set(CXX_RELEASE_FLAGS "${GENERAL_RELEASE_FLAGS} -DNDEBUG") + set(Fortran_RELEASE_FLAGS "${GENERAL_RELEASE_FLAGS}") - IF (${PROJECT_NAME}_ENABLE_DEBUG_SYMBOLS) - PREPEND_CMNDLINE_ARGS(GENERAL_BUILD_FLAGS "${DEBUG_SYMBOLS_FLAGS}") - ENDIF() + if (${PROJECT_NAME}_ENABLE_DEBUG_SYMBOLS) + prepend_cmndline_args(GENERAL_BUILD_FLAGS "${DEBUG_SYMBOLS_FLAGS}") + endif() - IF (${PROJECT_NAME}_COMMON_STRONG_COMPILE_WARNING_FLAGS) - SET(COMMON_STRONG_COMPILE_WARNING_FLAGS + if (${PROJECT_NAME}_COMMON_STRONG_COMPILE_WARNING_FLAGS) + set(COMMON_STRONG_COMPILE_WARNING_FLAGS ${${PROJECT_NAME}_COMMON_STRONG_COMPILE_WARNING_FLAGS}) - ELSE() - MULTILINE_SET(COMMON_STRONG_COMPILE_WARNING_FLAGS + else() + multiline_set(COMMON_STRONG_COMPILE_WARNING_FLAGS " -pedantic" # Adds more static checking to remove non-ANSI GNU extensions " -Wall" # Enable a bunch of default warnings " -Wno-long-long" # Allow long long int since it is used by MPI, SWIG, etc. ) - ENDIF() - - IF (${PROJECT_NAME}_C_STRONG_COMPILE_WARNING_FLAGS) - SET(C_STRONG_COMPILE_WARNING_FLAGS ${${PROJECT_NAME}_C_STRONG_COMPILE_WARNING_FLAGS}) - ELSE() - IF ("${${PROJECT_NAME}_C_Standard}" STREQUAL "") - SET(${PROJECT_NAME}_C_Standard_USED c99) - ELSE() - SET(${PROJECT_NAME}_C_Standard_USED ${${PROJECT_NAME}_C_Standard}) - ENDIF() - MULTILINE_SET(C_STRONG_COMPILE_WARNING_FLAGS + endif() + + if (${PROJECT_NAME}_C_STRONG_COMPILE_WARNING_FLAGS) + set(C_STRONG_COMPILE_WARNING_FLAGS ${${PROJECT_NAME}_C_STRONG_COMPILE_WARNING_FLAGS}) + else() + if ("${${PROJECT_NAME}_C_Standard}" STREQUAL "") + set(${PROJECT_NAME}_C_Standard_USED c99) + else() + set(${PROJECT_NAME}_C_Standard_USED ${${PROJECT_NAME}_C_Standard}) + endif() + multiline_set(C_STRONG_COMPILE_WARNING_FLAGS ${COMMON_STRONG_COMPILE_WARNING_FLAGS} " -std=${${PROJECT_NAME}_C_Standard_USED}" ) - ENDIF() + endif() - IF (${PROJECT_NAME}_CXX_STRONG_COMPILE_WARNING_FLAGS) - SET(CXX_STRONG_COMPILE_WARNING_FLAGS ${${PROJECT_NAME}_CXX_STRONG_COMPILE_WARNING_FLAGS}) - ELSE() - MULTILINE_SET(CXX_STRONG_COMPILE_WARNING_FLAGS + if (${PROJECT_NAME}_CXX_STRONG_COMPILE_WARNING_FLAGS) + set(CXX_STRONG_COMPILE_WARNING_FLAGS ${${PROJECT_NAME}_CXX_STRONG_COMPILE_WARNING_FLAGS}) + else() + multiline_set(CXX_STRONG_COMPILE_WARNING_FLAGS ${COMMON_STRONG_COMPILE_WARNING_FLAGS} " -Wwrite-strings" # Checks for non-const char * copy of string constants ) - ENDIF() - - IF (${PROJECT_NAME}_ENABLE_SHADOW_WARNINGS) - SET(LOCAL_ENABLE_SHADOWING_WARNINGS ON) - ELSEIF (${PROJECT_NAME}_ENABLE_SHADOW_WARNINGS STREQUAL "OFF") - SET(LOCAL_ENABLE_SHADOWING_WARNINGS OFF) - ELSE() - SET(LOCAL_ENABLE_SHADOWING_WARNINGS ${ENABLE_SHADOWING_WARNINGS}) - ENDIF() - - IF (LOCAL_ENABLE_SHADOWING_WARNINGS) - MULTILINE_SET(CXX_STRONG_COMPILE_WARNING_FLAGS + endif() + + if (${PROJECT_NAME}_ENABLE_SHADOW_WARNINGS) + set(LOCAL_ENABLE_SHADOWING_WARNINGS ON) + elseif (${PROJECT_NAME}_ENABLE_SHADOW_WARNINGS STREQUAL "OFF") + set(LOCAL_ENABLE_SHADOWING_WARNINGS OFF) + else() + set(LOCAL_ENABLE_SHADOWING_WARNINGS ${ENABLE_SHADOWING_WARNINGS}) + endif() + + if (LOCAL_ENABLE_SHADOWING_WARNINGS) + multiline_set(CXX_STRONG_COMPILE_WARNING_FLAGS ${CXX_STRONG_COMPILE_WARNING_FLAGS} " -Wshadow" # Warn about general shadowing issues " -Woverloaded-virtual" # Warn about hiding virtual functions ) - ENDIF() + endif() -ENDMACRO() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsETISupport.cmake b/cmake/tribits/core/package_arch/TribitsETISupport.cmake index 8b164749f011..e751d44f0ed4 100644 --- a/cmake/tribits/core/package_arch/TribitsETISupport.cmake +++ b/cmake/tribits/core/package_arch/TribitsETISupport.cmake @@ -44,269 +44,269 @@ include(Join) include(PrintVar) # this macro expands produces a list of all combinations of a variable number of lists: -# called like TRIBITS_ETI_TYPE_EXPANSION(setvar "T=t1|t2|t3" "S=s1|s2" "V=v1") +# called like tribits_eti_type_expansion(setvar "T=t1|t2|t3" "S=s1|s2" "V=v1") # returns setvar="T=T1 S=s1 V=v1;T=T1 S=s2 V=v1; # T=T2 S=s1 V=v1;T=T2 S=s2 V=v1; # T=T3 S=s1 V=v1;T=T3 S=s2 V=v1" -FUNCTION(TRIBITS_ETI_TYPE_EXPANSION outvar first_list) +function(tribits_eti_type_expansion outvar first_list) # extract the field name and the list of types - IF (NOT "${first_list}" MATCHES "([^=]*)=(.*)") - SET(${outvar} "TRIBITS_ETI_BAD_ARGUMENTS" PARENT_SCOPE) - RETURN() - ELSE() - SET(label "${CMAKE_MATCH_1}") - SET(tlist "${CMAKE_MATCH_2}") - ENDIF() - SET(eti_result "") - SPLIT("${tlist}" "\\|" tlist) - IF ("${${outvar}}" STREQUAL "") - SET(accumulate OFF) - ELSE() - SET(accumulate ON) - ENDIF() - LIST(LENGTH tlist tlist_len) - IF (${ARGC} GREATER 2) - TRIBITS_ETI_TYPE_EXPANSION(sub ${ARGN}) - FOREACH(t ${tlist}) - STRING(STRIP "${t}" t) - SET(t "{${t}}") - FOREACH(s ${sub}) - LIST(APPEND eti_result "${label}=${t} ${s}") - ENDFOREACH() - ENDFOREACH() - ELSE() - FOREACH(t ${tlist}) - STRING(STRIP "${t}" t) - SET(t "{${t}}") - LIST(APPEND eti_result "${label}=${t}") - ENDFOREACH() - ENDIF() - IF (accumulate) - SET(${outvar} "${${outvar}};${eti_result}" PARENT_SCOPE) - ELSE() - SET(${outvar} "${eti_result}" PARENT_SCOPE) - ENDIF() -ENDFUNCTION() + if (NOT "${first_list}" MATCHES "([^=]*)=(.*)") + set(${outvar} "TRIBITS_ETI_BAD_ARGUMENTS" PARENT_SCOPE) + return() + else() + set(label "${CMAKE_MATCH_1}") + set(tlist "${CMAKE_MATCH_2}") + endif() + set(eti_result "") + split("${tlist}" "\\|" tlist) + if ("${${outvar}}" STREQUAL "") + set(accumulate OFF) + else() + set(accumulate ON) + endif() + list(LENGTH tlist tlist_len) + if (${ARGC} GREATER 2) + tribits_eti_type_expansion(sub ${ARGN}) + foreach(t ${tlist}) + string(STRIP "${t}" t) + set(t "{${t}}") + foreach(s ${sub}) + list(APPEND eti_result "${label}=${t} ${s}") + endforeach() + endforeach() + else() + foreach(t ${tlist}) + string(STRIP "${t}" t) + set(t "{${t}}") + list(APPEND eti_result "${label}=${t}") + endforeach() + endif() + if (accumulate) + set(${outvar} "${${outvar}};${eti_result}" PARENT_SCOPE) + else() + set(${outvar} "${eti_result}" PARENT_SCOPE) + endif() +endfunction() # Explode an ETI set into a variable number of named component fields -FUNCTION(TRIBITS_ETI_EXPLODE fields inst outvar) +function(tribits_eti_explode fields inst outvar) foreach (field ${fields}) - IF( "${inst}" MATCHES "( |^)${field}={([^{}$=]*)}( |$)") - LIST(APPEND eti_result "${CMAKE_MATCH_2}") - ELSEIF("${inst}" MATCHES "( |^)${field}=([^{} $=]*)( |$)") - LIST(APPEND eti_result "${CMAKE_MATCH_2}") - ELSEIF(NOT "${inst}" MATCHES "( |^)${field}=") - LIST(APPEND eti_result "TYPE-MISSING") - ELSE() - SET(eti_result "TRIBITS_ETI_BAD_PARSE") - BREAK() - ENDIF() + if( "${inst}" MATCHES "( |^)${field}={([^{}$=]*)}( |$)") + list(APPEND eti_result "${CMAKE_MATCH_2}") + elseif("${inst}" MATCHES "( |^)${field}=([^{} $=]*)( |$)") + list(APPEND eti_result "${CMAKE_MATCH_2}") + elseif(NOT "${inst}" MATCHES "( |^)${field}=") + list(APPEND eti_result "TYPE-MISSING") + else() + set(eti_result "TRIBITS_ETI_BAD_PARSE") + break() + endif() endforeach() - JOIN(eti_result "|" FALSE ${eti_result}) - SET(${outvar} "${eti_result}" PARENT_SCOPE) -ENDFUNCTION() + join(eti_result "|" FALSE ${eti_result}) + set(${outvar} "${eti_result}" PARENT_SCOPE) +endfunction() # effectively, a tupled regex, wrapped in a for loop # given a list of processed excludes (a list of pipe-separated, bracket-delimited tuples of type/regexes), # determine whether processed_inst (a pipe-separated, bracket tuple of types) is matched # if the instantiation matches one of the exclusions, result is set true -FUNCTION(TRIBITS_ETI_CHECK_EXCLUSION processed_excludes processed_inst excluded) - SPLIT("${processed_inst}" "\\|" processed_inst) - LIST(LENGTH processed_inst numfields) - MATH(EXPR NFm1 "${numfields}-1") - SET(${excluded} OFF PARENT_SCOPE) +function(tribits_eti_check_exclusion processed_excludes processed_inst excluded) + split("${processed_inst}" "\\|" processed_inst) + list(LENGTH processed_inst numfields) + math(EXPR NFm1 "${numfields}-1") + set(${excluded} OFF PARENT_SCOPE) # check to see whether this is excluded or not list(LENGTH processed_excludes numexcl) - FOREACH(excl ${processed_excludes}) - SPLIT(${excl} "\\|" excl) - LIST(LENGTH excl excp_len) - IF(${excp_len} EQUAL ${numfields}) - SET(lcltest ON) - FOREACH(i RANGE 0 ${NFm1}) - LIST(GET processed_inst ${i} f) - LIST(GET excl ${i} e) - IF (NOT "${f}" STREQUAL "TYPE-MISSING" AND NOT "${f}" MATCHES "${e}") - SET(lcltest OFF) - BREAK() - ENDIF() - ENDFOREACH() - IF(lcltest) - SET(${excluded} ON PARENT_SCOPE) - IF (${PROJECT}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "-- Instantiation excluded by ${excl}") - ENDIF() - RETURN() - ENDIF() - ENDIF() - ENDFOREACH() -ENDFUNCTION() + foreach(excl ${processed_excludes}) + split(${excl} "\\|" excl) + list(LENGTH excl excp_len) + if(${excp_len} EQUAL ${numfields}) + set(lcltest ON) + foreach(i RANGE 0 ${NFm1}) + list(GET processed_inst ${i} f) + list(GET excl ${i} e) + if (NOT "${f}" STREQUAL "TYPE-MISSING" AND NOT "${f}" MATCHES "${e}") + set(lcltest OFF) + break() + endif() + endforeach() + if(lcltest) + set(${excluded} ON PARENT_SCOPE) + if (${PROJECT}_VERBOSE_CONFIGURE) + message(STATUS "-- Instantiation excluded by ${excl}") + endif() + return() + endif() + endif() + endforeach() +endfunction() # given a list of field names and list of macrofields, translate the # field names in macrofields into indices corresponding to the position in # the list of field names -FUNCTION(TRIBITS_ETI_INDEX_MACRO_FIELDS etifields macrofields indexvar) - FOREACH(mf ${macrofields}) - STRING(STRIP "${mf}" mf) - LIST(FIND etifields ${mf} ind) - IF(${ind} EQUAL -1) - MESSAGE(FATAL_ERROR "Macro variable ${mf} not found in list of fields: ${etifields}") - ENDIF() - LIST(APPEND inds ${ind}) - ENDFOREACH() - SET(${indexvar} ${inds} PARENT_SCOPE) -ENDFUNCTION() +function(tribits_eti_index_macro_fields etifields macrofields indexvar) + foreach(mf ${macrofields}) + string(STRIP "${mf}" mf) + list(FIND etifields ${mf} ind) + if(${ind} EQUAL -1) + message(FATAL_ERROR "Macro variable ${mf} not found in list of fields: ${etifields}") + endif() + list(APPEND inds ${ind}) + endforeach() + set(${indexvar} ${inds} PARENT_SCOPE) +endfunction() # given a macro name and a list of tuples, generate a macro string -FUNCTION(TRIBITS_ETI_BUILD_MACRO_STRING macroname tuplelist outvar) - SET(str "#define ${macroname}(INSTMACRO)") - FOREACH(tuple ${tuplelist}) - STRING(REPLACE "|" " , " tuple "${tuple}") - SET(str "${str}\\\n\tINSTMACRO( ${tuple} )") - ENDFOREACH() - SET(str "${str}\n") - SET(${outvar} ${str} PARENT_SCOPE) -ENDFUNCTION() +function(tribits_eti_build_macro_string macroname tuplelist outvar) + set(str "#define ${macroname}(INSTMACRO)") + foreach(tuple ${tuplelist}) + string(REPLACE "|" " , " tuple "${tuple}") + set(str "${str}\\\n\tINSTMACRO( ${tuple} )") + endforeach() + set(str "${str}\n") + set(${outvar} ${str} PARENT_SCOPE) +endfunction() # utility for adding eti support to another package's library set -FUNCTION(TRIBITS_ADD_ETI_INSTANTIATIONS PACKAGE) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Adding instantiations to ${PACKAGE} library set...") - ENDIF() - APPEND_GLOBAL_SET(${PACKAGE}_ETI_LIBRARYSET ${ARGN}) -ENDFUNCTION() +function(tribits_add_eti_instantiations PACKAGE) + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Adding instantiations to ${PACKAGE} library set...") + endif() + append_global_set(${PACKAGE}_ETI_LIBRARYSET ${ARGN}) +endfunction() # utility for mangling type names to make them safe for the C preprocessor -FUNCTION(TRIBITS_ETI_MANGLE_SYMBOL +function(tribits_eti_mangle_symbol mangledvar input) - SET(newvar "${input}") - STRING(REPLACE "::" "_" newvar "${newvar}") - STRING(REPLACE "," "_" newvar "${newvar}") - SET(num_brackets 0) - WHILE("${newvar}" MATCHES "(.*)<([^<>]*)>(.*)") - SET(newvar "${CMAKE_MATCH_1}${num_brackets}${CMAKE_MATCH_2}${num_brackets}${CMAKE_MATCH_3}") - MATH(EXPR num_brackets "${num_brackets}+1") - ENDWHILE() - STRING(REPLACE " " "" newvar "${newvar}") - SET(${mangledvar} "${newvar}" PARENT_SCOPE) -ENDFUNCTION() + set(newvar "${input}") + string(REPLACE "::" "_" newvar "${newvar}") + string(REPLACE "," "_" newvar "${newvar}") + set(num_brackets 0) + while("${newvar}" MATCHES "(.*)<([^<>]*)>(.*)") + set(newvar "${CMAKE_MATCH_1}${num_brackets}${CMAKE_MATCH_2}${num_brackets}${CMAKE_MATCH_3}") + math(EXPR num_brackets "${num_brackets}+1") + endwhile() + string(REPLACE " " "" newvar "${newvar}") + set(${mangledvar} "${newvar}" PARENT_SCOPE) +endfunction() # utility for mangling type names to make them safe for the C preprocessor # upon mangling, it automatically inserts an ifdef into the mangling macro -FUNCTION(TRIBITS_ETI_MANGLE_SYMBOL_AUGMENT_MACRO +function(tribits_eti_mangle_symbol_augment_macro typedefvar symbolvar manglistvar) - SET(oldsymbol "${${symbolvar}}") - IF(NOT "${oldsymbol}" MATCHES "::|[<>, ]") - RETURN() - ENDIF() - TRIBITS_ETI_MANGLE_SYMBOL(newsymbol "${oldsymbol}") - SET(${symbolvar} "${newsymbol}" PARENT_SCOPE) - LIST(FIND ${manglistvar} ${newsymbol} already_mangled) - IF(${already_mangled} EQUAL -1) - LIST(APPEND ${manglistvar} ${newsymbol}) - SET(${manglistvar} ${${manglistvar}} PARENT_SCOPE) - LIST(APPEND ${typedefvar} "typedef ${oldsymbol} ${newsymbol}") - SET(${typedefvar} ${${typedefvar}} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() + set(oldsymbol "${${symbolvar}}") + if(NOT "${oldsymbol}" MATCHES "::|[<>, ]") + return() + endif() + tribits_eti_mangle_symbol(newsymbol "${oldsymbol}") + set(${symbolvar} "${newsymbol}" PARENT_SCOPE) + list(FIND ${manglistvar} ${newsymbol} already_mangled) + if(${already_mangled} EQUAL -1) + list(APPEND ${manglistvar} ${newsymbol}) + set(${manglistvar} ${${manglistvar}} PARENT_SCOPE) + list(APPEND ${typedefvar} "typedef ${oldsymbol} ${newsymbol}") + set(${typedefvar} ${${typedefvar}} PARENT_SCOPE) + endif() +endfunction() # generate the macros -FUNCTION(TRIBITS_ETI_GENERATE_MACROS etifields etisetvar etiexcludelist manglinglistvar typedeflistvar) - SET(manglinglist "${${manglinglistvar}}") - SET(typedeflist "${${typedeflistvar}}") - SPLIT("${etifields}" "\\|" etifields) - IF(${PROJECT}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "ETI fields: ${etifields}") - MESSAGE(STATUS "ETI set: ${etisetvar}") - MESSAGE(STATUS "ETI excludes: ${etiexcludelist}") - ENDIF() +function(tribits_eti_generate_macros etifields etisetvar etiexcludelist manglinglistvar typedeflistvar) + set(manglinglist "${${manglinglistvar}}") + set(typedeflist "${${typedeflistvar}}") + split("${etifields}" "\\|" etifields) + if(${PROJECT}_VERBOSE_CONFIGURE) + message(STATUS "ETI fields: ${etifields}") + message(STATUS "ETI set: ${etisetvar}") + message(STATUS "ETI excludes: ${etiexcludelist}") + endif() # we make lists of tuples first, because we want to make sure they don't have duplicates - # this algorithm is O(N^2) in the number of instantiations in etisetvar - MATH(EXPR num_macros "(${ARGC}-5)/2") - IF(${num_macros} EQUAL 0) - RETURN() - ENDIF() + # this algorithm is o(N^2) in the number of instantiations in etisetvar + math(EXPR num_macros "(${ARGC}-5)/2") + if(${num_macros} EQUAL 0) + return() + endif() # process macro fields into a list of indices - FOREACH(m RANGE 1 ${num_macros}) - MATH(EXPR m2 "(${m}-1)*2") - MATH(EXPR m2p1 "${m2}+1") - LIST(GET ARGN ${m2} macroarg) - LIST(GET ARGN ${m2p1} macrovar${m}) - STRING(REGEX REPLACE "^(.*)\\(.*" "\\1" macroname${m} ${macroarg}) - STRING(REGEX REPLACE "^.*\\((.*)\\)$" "\\1" macrofields${m} ${macroarg}) - SPLIT("${macrofields${m}}" "," macrofields) - TRIBITS_ETI_INDEX_MACRO_FIELDS("${etifields}" "${macrofields}" macroindex${m}) - IF(${PROJECT}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Parsed macro ${macroname${m}}(${macrofields${m}}) into variable ${macrovar${m}} (index list ${macroindex${m}})") - ENDIF() - ENDFOREACH() + foreach(m RANGE 1 ${num_macros}) + math(EXPR m2 "(${m}-1)*2") + math(EXPR m2p1 "${m2}+1") + list(GET ARGN ${m2} macroarg) + list(GET ARGN ${m2p1} macrovar${m}) + string(REGEX REPLACE "^(.*)\\(.*" "\\1" macroname${m} ${macroarg}) + string(REGEX REPLACE "^.*\\((.*)\\)$" "\\1" macrofields${m} ${macroarg}) + split("${macrofields${m}}" "," macrofields) + tribits_eti_index_macro_fields("${etifields}" "${macrofields}" macroindex${m}) + if(${PROJECT}_VERBOSE_CONFIGURE) + message(STATUS "Parsed macro ${macroname${m}}(${macrofields${m}}) into variable ${macrovar${m}} (index list ${macroindex${m}})") + endif() + endforeach() # process the exclusions once - FOREACH(excl ${etiexcludelist}) - TRIBITS_ETI_EXPLODE("${etifields}" "${excl}" e_excl) - IF("${e_excl}" STREQUAL "TRIBITS_ETI_BAD_PARSE") - MESSAGE(FATAL_ERROR "TRIBITS_GENERATE_ETI_MACROS: exclusion did not parse: ${excl}") - ENDIF() - LIST(APPEND processed_excludes "${e_excl}") - ENDFOREACH() - LIST(LENGTH etifields numfields) - MATH(EXPR NFm1 "${numfields}-1") - FOREACH(inst ${etisetvar}) - IF (${PROJECT}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Processing instantiation: ${inst}") # comment - ENDIF() - TRIBITS_ETI_EXPLODE("${etifields}" "${inst}" tmp) - IF("${tmp}" STREQUAL "TRIBITS_ETI_BAD_PARSE") - MESSAGE(FATAL_ERROR "TRIBITS_GENERATE_ETI_MACROS: instantiation did not parse: ${inst}") - ELSE() - SET(inst "${tmp}") - ENDIF() + foreach(excl ${etiexcludelist}) + tribits_eti_explode("${etifields}" "${excl}" e_excl) + if("${e_excl}" STREQUAL "TRIBITS_ETI_BAD_PARSE") + message(FATAL_ERROR "TRIBITS_GENERATE_ETI_MACROS: exclusion did not parse: ${excl}") + endif() + list(APPEND processed_excludes "${e_excl}") + endforeach() + list(LENGTH etifields numfields) + math(EXPR NFm1 "${numfields}-1") + foreach(inst ${etisetvar}) + if (${PROJECT}_VERBOSE_CONFIGURE) + message(STATUS "Processing instantiation: ${inst}") # comment + endif() + tribits_eti_explode("${etifields}" "${inst}" tmp) + if("${tmp}" STREQUAL "TRIBITS_ETI_BAD_PARSE") + message(FATAL_ERROR "TRIBITS_GENERATE_ETI_MACROS: instantiation did not parse: ${inst}") + else() + set(inst "${tmp}") + endif() # check whether it is on the exclude list - TRIBITS_ETI_CHECK_EXCLUSION("${processed_excludes}" "${inst}" excluded) - IF(NOT excluded) - SPLIT("${inst}" "\\|" inst) + tribits_eti_check_exclusion("${processed_excludes}" "${inst}" excluded) + if(NOT excluded) + split("${inst}" "\\|" inst) # append tuple to list - FOREACH(m RANGE 1 ${num_macros}) - SET(tuple "") - FOREACH(ind ${macroindex${m}}) - LIST(GET inst ${ind} t) - IF("${t}" STREQUAL "TYPE-MISSING") - SET(tuple "SKIP-TUPLE") - BREAK() - ENDIF() + foreach(m RANGE 1 ${num_macros}) + set(tuple "") + foreach(ind ${macroindex${m}}) + list(GET inst ${ind} t) + if("${t}" STREQUAL "TYPE-MISSING") + set(tuple "SKIP-TUPLE") + break() + endif() # mangle the types in the instantiation - TRIBITS_ETI_MANGLE_SYMBOL_AUGMENT_MACRO(typedeflist t manglinglist) - LIST(APPEND tuple ${t}) - ENDFOREACH() - IF(NOT "${tuple}" STREQUAL "SKIP-TUPLE") - JOIN(tuple "|" FALSE "${tuple}") - LIST(APPEND macrotuples${m} ${tuple}) - ENDIF() - ENDFOREACH() - ENDIF() - ENDFOREACH() + tribits_eti_mangle_symbol_augment_macro(typedeflist t manglinglist) + list(APPEND tuple ${t}) + endforeach() + if(NOT "${tuple}" STREQUAL "SKIP-TUPLE") + join(tuple "|" FALSE "${tuple}") + list(APPEND macrotuples${m} ${tuple}) + endif() + endforeach() + endif() + endforeach() # remove duplicates from lists - FOREACH(m RANGE 1 ${num_macros}) - IF(DEFINED macrotuples${m}) - LIST(REMOVE_DUPLICATES macrotuples${m}) - ENDIF() - ENDFOREACH() + foreach(m RANGE 1 ${num_macros}) + if(DEFINED macrotuples${m}) + list(REMOVE_DUPLICATES macrotuples${m}) + endif() + endforeach() # build the macro strings - FOREACH(m RANGE 1 ${num_macros}) - TRIBITS_ETI_BUILD_MACRO_STRING("${macroname${m}}" "${macrotuples${m}}" mac) - SET(${macrovar${m}} "${mac}" PARENT_SCOPE) - ENDFOREACH() + foreach(m RANGE 1 ${num_macros}) + tribits_eti_build_macro_string("${macroname${m}}" "${macrotuples${m}}" mac) + set(${macrovar${m}} "${mac}" PARENT_SCOPE) + endforeach() # build the typedef string - SET(${manglinglistvar} ${manglinglist} PARENT_SCOPE) - SET(${typedeflistvar} ${typedeflist} PARENT_SCOPE) -ENDFUNCTION() + set(${manglinglistvar} ${manglinglist} PARENT_SCOPE) + set(${typedeflistvar} ${typedeflist} PARENT_SCOPE) +endfunction() # generate the typedef macro -FUNCTION(TRIBITS_ETI_GENERATE_TYPEDEF_MACRO outputvar macroname typedeflist) - SET(mac "#define ${macroname}() ") - FOREACH(td ${typedeflist}) - SET(mac "${mac} \\\n\t${td};") - ENDFOREACH() - SET(${outputvar} "${mac}" PARENT_SCOPE) -ENDFUNCTION() +function(tribits_eti_generate_typedef_macro outputvar macroname typedeflist) + set(mac "#define ${macroname}() ") + foreach(td ${typedeflist}) + set(mac "${mac} \\\n\t${td};") + endforeach() + set(${outputvar} "${mac}" PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake b/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake index c8655183849b..be6881ab1623 100644 --- a/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake +++ b/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake @@ -37,18 +37,18 @@ # ************************************************************************ # @HEADER -INCLUDE(CMakeParseArguments) +include(CMakeParseArguments) # -# @FUNCTION: TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP() +# @FUNCTION: tribits_find_most_recent_file_timestamp() # # Find the most modified file in a set of base directories and return its # timestamp. # # Usage:: # -# TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP( +# tribits_find_most_recent_file_timestamp( # BASE_DIRS ... # [BASE_BASE_DIR ] # [EXCLUDE_REGEXES "" "" ... @@ -121,17 +121,17 @@ INCLUDE(CMakeParseArguments) # ````, ````, and # ````. # -FUNCTION(TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP) +function(tribits_find_most_recent_file_timestamp) - IF (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) - MESSAGE("\nSearching for most modified files in base dirs:") - ENDIF() + if (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) + message("\nSearching for most modified files in base dirs:") + endif() # # A) Parse the input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -143,39 +143,39 @@ FUNCTION(TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - IF (PARSE_SHOW_MOST_RECENT_FILES) - SET(PARSE_SHOW_OVERALL_MOST_RECENT_FILE ON) - ENDIF() + if (PARSE_SHOW_MOST_RECENT_FILES) + set(PARSE_SHOW_OVERALL_MOST_RECENT_FILE ON) + endif() # # B) Loop over each directory and find the most modified file # - SET(OVERALL_MOST_RECENT_TIMESTAMP "0000000000.0000000000") - SET(OVERALL_MOST_RECENT_FILEPATH "") - SET(OVERALL_MOST_RECENT_FILEPATH_DIR "") - SET(OVERALL_MOST_RECENT_RELATEIVE_FILEPATH_DIR "") - SET(OVERALL_MOST_RECENT_FILEPATH_TIMESTAMP_HUMAN_READABLE "") + set(OVERALL_MOST_RECENT_TIMESTAMP "0000000000.0000000000") + set(OVERALL_MOST_RECENT_FILEPATH "") + set(OVERALL_MOST_RECENT_FILEPATH_DIR "") + set(OVERALL_MOST_RECENT_RELATEIVE_FILEPATH_DIR "") + set(OVERALL_MOST_RECENT_FILEPATH_TIMESTAMP_HUMAN_READABLE "") - FOREACH(BASE_DIR ${PARSE_BASE_DIRS}) + foreach(BASE_DIR ${PARSE_BASE_DIRS}) - IF (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) - MESSAGE("\nSearching '${BASE_DIR}' ...") - ENDIF() + if (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) + message("\nSearching '${BASE_DIR}' ...") + endif() - IF (IS_DIRECTORY "${BASE_DIR}") + if (IS_DIRECTORY "${BASE_DIR}") # Build up commands for grep -v - SET(GREP_V_COMMANDS) - FOREACH(EXCLUDE_REGEX ${PARSE_EXCLUDE_REGEXES}) - APPEND_SET(GREP_V_COMMANDS COMMAND grep -v "${EXCLUDE_REGEX}") - ENDFOREACH() + set(GREP_V_COMMANDS) + foreach(EXCLUDE_REGEX ${PARSE_EXCLUDE_REGEXES}) + append_set(GREP_V_COMMANDS COMMAND grep -v "${EXCLUDE_REGEX}") + endforeach() # Get the time stamp and the file name of the most recently modified file - # in currnet directory. - EXECUTE_PROCESS( + # in current directory. + execute_process( WORKING_DIRECTORY "${BASE_DIR}" COMMAND find . -type f -printf "%T@ %p\n" ${GREP_V_COMMANDS} @@ -191,118 +191,118 @@ FUNCTION(TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP) # # 1407353359.5651538200 .// - IF (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) - PRINT_VAR(MOST_RECENT_TIMESTAMP_AND_FILE) - ENDIF() + if (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) + print_var(MOST_RECENT_TIMESTAMP_AND_FILE) + endif() - IF (MOST_RECENT_TIMESTAMP_AND_FILE) + if (MOST_RECENT_TIMESTAMP_AND_FILE) - SPLIT("${MOST_RECENT_TIMESTAMP_AND_FILE}" " " + split("${MOST_RECENT_TIMESTAMP_AND_FILE}" " " MOST_RECENT_TIMESTAMP_AND_FILE_SPLIT) # Get the time stamp part - LIST(GET MOST_RECENT_TIMESTAMP_AND_FILE_SPLIT 0 + list(GET MOST_RECENT_TIMESTAMP_AND_FILE_SPLIT 0 CURRENT_TIMESTAMP) # Get the relative file path - LIST(GET MOST_RECENT_TIMESTAMP_AND_FILE_SPLIT 1 + list(GET MOST_RECENT_TIMESTAMP_AND_FILE_SPLIT 1 CURRENT_FILEPATH) # Get the directory relative to the base base dir - STRING(REPLACE "${PARSE_BASE_BASE_DIR}/" "./" RELATIVE_FILEPATH_DIR + string(REPLACE "${PARSE_BASE_BASE_DIR}/" "./" RELATIVE_FILEPATH_DIR "${BASE_DIR}") - IF (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) - PRINT_VAR(CURRENT_TIMESTAMP) - PRINT_VAR(CURRENT_FILEPATH) - ENDIF() + if (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) + print_var(CURRENT_TIMESTAMP) + print_var(CURRENT_FILEPATH) + endif() - IF (PARSE_SHOW_MOST_RECENT_FILES) - TRIBITS_GET_HUMAN_READABLE_FILE_AND_TIMESTAMP( + if (PARSE_SHOW_MOST_RECENT_FILES) + tribits_get_human_readable_file_and_timestamp( "${BASE_DIR}" "${CURRENT_FILEPATH}" HUMAN_READABLE_FILE_AND_TIMESTAMP ) - MESSAGE("-- " "Most recent file in ${RELATIVE_FILEPATH_DIR}/" + message("-- " "Most recent file in ${RELATIVE_FILEPATH_DIR}/" " is ${CURRENT_FILEPATH}\n" " ${HUMAN_READABLE_FILE_AND_TIMESTAMP}") - ENDIF() - - IF ("${CURRENT_TIMESTAMP}" GREATER "${OVERALL_MOST_RECENT_TIMESTAMP}") - IF (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) - MESSAGE(" New most recent file path!") - ENDIF() - SET(OVERALL_MOST_RECENT_TIMESTAMP "${CURRENT_TIMESTAMP}") - SET(OVERALL_MOST_RECENT_RELATIVE_FILEPATH "${CURRENT_FILEPATH}") - SET(OVERALL_MOST_RECENT_FILEPATH_DIR "${BASE_DIR}") - SET(OVERALL_MOST_RECENT_RELATEIVE_FILEPATH_DIR "${RELATIVE_FILEPATH_DIR}") - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - SET(OVERALL_MOST_RECENT_FILEPATH_TIMESTAMP_HUMAN_READABLE + endif() + + if ("${CURRENT_TIMESTAMP}" GREATER "${OVERALL_MOST_RECENT_TIMESTAMP}") + if (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) + message(" New most recent file path!") + endif() + set(OVERALL_MOST_RECENT_TIMESTAMP "${CURRENT_TIMESTAMP}") + set(OVERALL_MOST_RECENT_RELATIVE_FILEPATH "${CURRENT_FILEPATH}") + set(OVERALL_MOST_RECENT_FILEPATH_DIR "${BASE_DIR}") + set(OVERALL_MOST_RECENT_RELATEIVE_FILEPATH_DIR "${RELATIVE_FILEPATH_DIR}") + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + set(OVERALL_MOST_RECENT_FILEPATH_TIMESTAMP_HUMAN_READABLE "${HUMAN_READABLE_FILE_AND_TIMESTAMP}") - ENDIF() - ENDIF() + endif() + endif() - ENDIF() + endif() - ELSE() + else() - IF (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) - MESSAGE("Directory does not exist, skipping ...") - ENDIF() + if (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) + message("Directory does not exist, skipping ...") + endif() - ENDIF() + endif() - ENDFOREACH() + endforeach() - IF (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) - PRINT_VAR(OVERALL_MOST_RECENT_TIMESTAMP) - PRINT_VAR(OVERALL_MOST_RECENT_RELATIVE_FILEPATH) - ENDIF() + if (TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP_DEBUG_DUMP) + print_var(OVERALL_MOST_RECENT_TIMESTAMP) + print_var(OVERALL_MOST_RECENT_RELATIVE_FILEPATH) + endif() - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - IF (OVERALL_MOST_RECENT_FILEPATH_DIR) - IF (NOT OVERALL_MOST_RECENT_FILEPATH_TIMESTAMP_HUMAN_READABLE) - TRIBITS_GET_HUMAN_READABLE_FILE_AND_TIMESTAMP( + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + if (OVERALL_MOST_RECENT_FILEPATH_DIR) + if (NOT OVERALL_MOST_RECENT_FILEPATH_TIMESTAMP_HUMAN_READABLE) + tribits_get_human_readable_file_and_timestamp( "${OVERALL_MOST_RECENT_FILEPATH_DIR}" "${OVERALL_MOST_RECENT_RELATIVE_FILEPATH}" OVERALL_MOST_RECENT_FILEPATH_TIMESTAMP_HUMAN_READABLE ) - ENDIF() - MESSAGE("-- " "Overall most recent modified file is in" + endif() + message("-- " "Overall most recent modified file is in" " ${OVERALL_MOST_RECENT_RELATEIVE_FILEPATH_DIR}/ and is ${OVERALL_MOST_RECENT_RELATIVE_FILEPATH}\n" " ${OVERALL_MOST_RECENT_FILEPATH_TIMESTAMP_HUMAN_READABLE}") - ELSE() - MESSAGE("-- There are no unfiltered files!") - ENDIF() - ENDIF() + else() + message("-- There are no unfiltered files!") + endif() + endif() - SET(${PARSE_MOST_RECENT_TIMESTAMP_OUT} + set(${PARSE_MOST_RECENT_TIMESTAMP_OUT} ${OVERALL_MOST_RECENT_TIMESTAMP} PARENT_SCOPE) - IF (PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT) - SET(${PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT} + if (PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT) + set(${PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT} ${OVERALL_MOST_RECENT_FILEPATH_DIR} PARENT_SCOPE) - ENDIF() + endif() - IF (PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT) - SET(${PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT} + if (PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT) + set(${PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT} ${OVERALL_MOST_RECENT_RELATIVE_FILEPATH} PARENT_SCOPE ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # -# @FUNCTION: TRIBITS_FIND_MOST_RECENT_SOURCE_FILE_TIMESTAMP() +# @FUNCTION: tribits_find_most_recent_source_file_timestamp() # # Find the most modified source file in a set of base directories and return # its timestamp. # # Usage:: # -# TRIBITS_FIND_MOST_RECENT_SOURCE_FILE_TIMESTAMP( +# tribits_find_most_recent_source_file_timestamp( # SOURCE_BASE_DIRS ... # [SOURCE_BASE_BASE_DIR ] # [SHOW_MOST_RECENT_FILES] @@ -312,18 +312,18 @@ ENDFUNCTION() # [MOST_RECENT_RELATIVE_FILEPATH_OUT ] # ) # -# This function just calls `TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP()`_ +# This function just calls `tribits_find_most_recent_file_timestamp()`_ # passing in a set of basic exclude regexes like ``[.]git/``, ``[.]svn/``, # etc. These types of version control files can not possibly directly impact # the source code. # -FUNCTION(TRIBITS_FIND_MOST_RECENT_SOURCE_FILE_TIMESTAMP) +function(tribits_find_most_recent_source_file_timestamp) # # A) Parse the input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -335,26 +335,26 @@ FUNCTION(TRIBITS_FIND_MOST_RECENT_SOURCE_FILE_TIMESTAMP) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() # - # B) Call the function TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP() + # B) Call the function tribits_find_most_recent_file_timestamp() # - SET(FILTER_OUT_SOURCE_FILE_REGEXS + set(FILTER_OUT_SOURCE_FILE_REGEXS "/[.]git/" ) - SET(VARIABLE_ARGS) - IF (PARSE_SHOW_MOST_RECENT_FILES) - APPEND_SET(VARIABLE_ARGS SHOW_MOST_RECENT_FILES) - ENDIF() - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - APPEND_SET(VARIABLE_ARGS SHOW_OVERALL_MOST_RECENT_FILES) - ENDIF() + set(VARIABLE_ARGS) + if (PARSE_SHOW_MOST_RECENT_FILES) + append_set(VARIABLE_ARGS SHOW_MOST_RECENT_FILES) + endif() + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + append_set(VARIABLE_ARGS SHOW_OVERALL_MOST_RECENT_FILES) + endif() - #PRINT_VAR(VARIABLE_ARGS) - TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP( + #print_var(VARIABLE_ARGS) + tribits_find_most_recent_file_timestamp( BASE_DIRS ${PARSE_SOURCE_BASE_DIRS} BASE_BASE_DIR ${PARSE_SOURCE_BASE_BASE_DIR} EXCLUDE_REGEXES ${FILTER_OUT_SOURCE_FILE_REGEXS} @@ -363,33 +363,33 @@ FUNCTION(TRIBITS_FIND_MOST_RECENT_SOURCE_FILE_TIMESTAMP) MOST_RECENT_RELATIVE_FILEPATH_OUT MOST_RECENT_RELATIVE_FILEPATH ${VARIABLE_ARGS} ) - #PRINT_VAR(MOST_RECENT_TIMESTAMP) + #print_var(MOST_RECENT_TIMESTAMP) - SET(${PARSE_MOST_RECENT_TIMESTAMP_OUT} ${MOST_RECENT_TIMESTAMP} + set(${PARSE_MOST_RECENT_TIMESTAMP_OUT} ${MOST_RECENT_TIMESTAMP} PARENT_SCOPE) - IF (PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT) - SET(${PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT} ${MOST_RECENT_UPSTREAM_SOURCE_TIMESTAMP} + if (PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT) + set(${PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT} ${MOST_RECENT_UPSTREAM_SOURCE_TIMESTAMP} PARENT_SCOPE) - ENDIF() + endif() - IF (PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT) - SET(${PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT} ${MOST_RECENT_RELATIVE_FILEPATH} + if (PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT) + set(${PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT} ${MOST_RECENT_RELATIVE_FILEPATH} PARENT_SCOPE ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # -# @FUNCTION: TRIBITS_FIND_MOST_RECENT_BINARY_FILE_TIMESTAMP() +# @FUNCTION: tribits_find_most_recent_binary_file_timestamp() # # Find the most modified binary file in a set of base directories and return # its timestamp. # # Usage:: # -# TRIBITS_FIND_MOST_RECENT_BINARY_FILE_TIMESTAMP( +# tribits_find_most_recent_binary_file_timestamp( # BINARY_BASE_DIRS ... # [BINARY_BASE_BASE_DIR ] # [MOST_RECENT_TIMESTAMP_OUT ] @@ -399,18 +399,18 @@ ENDFUNCTION() # [SHOW_OVERALL_MOST_RECENT_FILE] # ) # -# This function just calls `TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP()`_ +# This function just calls `tribits_find_most_recent_file_timestamp()`_ # passing in a set of basic exclude regexes like ``CMakeFiles/``, # ``[.]cmake$``, and ``/Makefile$``, etc. These types of files usually don't # impact the build of downstream software in CMake projects. # -FUNCTION(TRIBITS_FIND_MOST_RECENT_BINARY_FILE_TIMESTAMP) +function(tribits_find_most_recent_binary_file_timestamp) # # A) Parse the input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -422,30 +422,30 @@ FUNCTION(TRIBITS_FIND_MOST_RECENT_BINARY_FILE_TIMESTAMP) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() # # B) Define filters for binary files we know are not significant # - SET(FILTER_OUT_BINARY_FILE_REGEXS + set(FILTER_OUT_BINARY_FILE_REGEXS "CMakeFiles/" "[.]cmake$" "/Makefile$" ) # - # C) Call the function TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP() + # C) Call the function tribits_find_most_recent_file_timestamp() # - SET(VARIABLE_ARGS) - IF (PARSE_SHOW_MOST_RECENT_FILES) - APPEND_SET(VARIABLE_ARGS SHOW_MOST_RECENT_FILES) - ENDIF() - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - APPEND_SET(VARIABLE_ARGS SHOW_OVERALL_MOST_RECENT_FILES) - ENDIF() + set(VARIABLE_ARGS) + if (PARSE_SHOW_MOST_RECENT_FILES) + append_set(VARIABLE_ARGS SHOW_MOST_RECENT_FILES) + endif() + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + append_set(VARIABLE_ARGS SHOW_OVERALL_MOST_RECENT_FILES) + endif() - #PRINT_VAR(VARIABLE_ARGS) - TRIBITS_FIND_MOST_RECENT_FILE_TIMESTAMP( + #print_var(VARIABLE_ARGS) + tribits_find_most_recent_file_timestamp( BASE_DIRS ${PARSE_BINARY_BASE_DIRS} BASE_BASE_DIR ${PARSE_BINARY_BASE_BASE_DIR} EXCLUDE_REGEXES ${FILTER_OUT_BINARY_FILE_REGEXS} @@ -453,33 +453,33 @@ FUNCTION(TRIBITS_FIND_MOST_RECENT_BINARY_FILE_TIMESTAMP) MOST_RECENT_RELATIVE_FILEPATH_OUT MOST_RECENT_RELATIVE_FILEPATH ${VARIABLE_ARGS} ) - #PRINT_VAR(MOST_RECENT_TIMESTAMP) + #print_var(MOST_RECENT_TIMESTAMP) - SET(${PARSE_MOST_RECENT_TIMESTAMP_OUT} ${MOST_RECENT_TIMESTAMP} + set(${PARSE_MOST_RECENT_TIMESTAMP_OUT} ${MOST_RECENT_TIMESTAMP} PARENT_SCOPE) - IF (PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT) - SET(${PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT} ${MOST_RECENT_UPSTREAM_SOURCE_TIMESTAMP} + if (PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT) + set(${PARSE_MOST_RECENT_FILEPATH_BASE_DIR_OUT} ${MOST_RECENT_UPSTREAM_SOURCE_TIMESTAMP} PARENT_SCOPE) - ENDIF() + endif() - IF (PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT) - SET(${PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT} ${MOST_RECENT_RELATIVE_FILEPATH} + if (PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT) + set(${PARSE_MOST_RECENT_RELATIVE_FILEPATH_OUT} ${MOST_RECENT_RELATIVE_FILEPATH} PARENT_SCOPE ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # -# @FUNCTION: TRIBITS_DETERMINE_IF_CURRENT_PACKAGE_NEEDS_REBUILT() +# @FUNCTION: tribits_determine_if_current_package_needs_rebuilt() # # Determine at configure time if any of the upstream dependencies for a # package require the current package to be rebuilt. # # Usage:: # -# TRIBITS_DETERMINE_IF_CURRENT_PACKAGE_NEEDS_REBUILT( +# tribits_determine_if_current_package_needs_rebuilt( # [SHOW_MOST_RECENT_FILES] # [SHOW_OVERALL_MOST_RECENT_FILES] # CURRENT_PACKAGE_OUT_OF_DATE_OUT @@ -514,8 +514,8 @@ ENDFUNCTION() # piece of software (that generates libraries) and wrap it as a TriBITS # package or subpackage. This function uses the lower-level functions: # -# * `TRIBITS_FIND_MOST_RECENT_SOURCE_FILE_TIMESTAMP()`_ -# * `TRIBITS_FIND_MOST_RECENT_BINARY_FILE_TIMESTAMP()`_ +# * `tribits_find_most_recent_source_file_timestamp()`_ +# * `tribits_find_most_recent_binary_file_timestamp()`_ # # to determine the most recent modified files in the upstream TriBITS SE # packages' source and binary directories as well as the most recent source @@ -533,15 +533,15 @@ ENDFUNCTION() # See the demonstration of the usage of this function in the ``WrapExternal`` # package in `TribitsExampleProject`_. # -FUNCTION(TRIBITS_DETERMINE_IF_CURRENT_PACKAGE_NEEDS_REBUILT) +function(tribits_determine_if_current_package_needs_rebuilt) - TRIBITS_CONFIG_CODE_START_TIMER(TIMER_START_SECONDS) + tribits_config_code_start_timer(TIMER_START_SECONDS) # # A) Parse the input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -553,90 +553,90 @@ FUNCTION(TRIBITS_DETERMINE_IF_CURRENT_PACKAGE_NEEDS_REBUILT) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() # Get pass through print level options - SET(SHOW_MOST_RECENT_FILES_ARGS) - IF (PARSE_SHOW_MOST_RECENT_FILES) - APPEND_SET(SHOW_MOST_RECENT_FILES_ARGS SHOW_MOST_RECENT_FILES) - ENDIF() - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - APPEND_SET(SHOW_MOST_RECENT_FILES_ARGS SHOW_OVERALL_MOST_RECENT_FILES) - ENDIF() - #PRINT_VAR(SHOW_MOST_RECENT_FILES_ARGS) - - IF (PARSE_SHOW_MOST_RECENT_FILES) - SET(PARSE_SHOW_OVERALL_MOST_RECENT_FILES TRUE) - ENDIF() + set(SHOW_MOST_RECENT_FILES_ARGS) + if (PARSE_SHOW_MOST_RECENT_FILES) + append_set(SHOW_MOST_RECENT_FILES_ARGS SHOW_MOST_RECENT_FILES) + endif() + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + append_set(SHOW_MOST_RECENT_FILES_ARGS SHOW_OVERALL_MOST_RECENT_FILES) + endif() + #print_var(SHOW_MOST_RECENT_FILES_ARGS) + + if (PARSE_SHOW_MOST_RECENT_FILES) + set(PARSE_SHOW_OVERALL_MOST_RECENT_FILES TRUE) + endif() # # B) Get the list of enabled upstream packages # # Only search parent packages to cut down on dirs searched - SET(ENABLED_UPSTREAM_PACKAGES) - SET(CURRENT_PARENT_PACKAGE) - FOREACH(UPSTREAM_SE_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) + set(ENABLED_UPSTREAM_PACKAGES) + set(CURRENT_PARENT_PACKAGE) + foreach(UPSTREAM_SE_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) # Assume we will append - SET(APPEND_PACKAGE ${UPSTREAM_SE_PACKAGE}) + set(APPEND_PACKAGE ${UPSTREAM_SE_PACKAGE}) # If is a subpackage we only append the parent packages - SET(PARENT_PACKAGE ${${UPSTREAM_SE_PACKAGE}_PARENT_PACKAGE}) - IF (PARENT_PACKAGE) - SET(APPEND_PACKAGE ${PARENT_PACKAGE}) - ENDIF() + set(PARENT_PACKAGE ${${UPSTREAM_SE_PACKAGE}_PARENT_PACKAGE}) + if (PARENT_PACKAGE) + set(APPEND_PACKAGE ${PARENT_PACKAGE}) + endif() # Append - APPEND_SET(ENABLED_UPSTREAM_PACKAGES ${APPEND_PACKAGE}) - ENDFOREACH() - LIST(REMOVE_DUPLICATES ENABLED_UPSTREAM_PACKAGES) - #PRINT_VAR(ENABLED_UPSTREAM_PACKAGES) + append_set(ENABLED_UPSTREAM_PACKAGES ${APPEND_PACKAGE}) + endforeach() + list(REMOVE_DUPLICATES ENABLED_UPSTREAM_PACKAGES) + #print_var(ENABLED_UPSTREAM_PACKAGES) # # C) Determine the most recent files on the upstream SE packages # - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - MESSAGE("\nDetermining most recent source file in upstream SE packages" + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + message("\nDetermining most recent source file in upstream SE packages" " from ${PACKAGE_NAME}:") - ENDIF() - SET(UPSTREAM_SOURCE_BASE_DIRS) - FOREACH(UPSTREAM_PACKAGE ${ENABLED_UPSTREAM_PACKAGES}) - APPEND_SET(UPSTREAM_SOURCE_BASE_DIRS "${${UPSTREAM_PACKAGE}_SOURCE_DIR}") - ENDFOREACH() - TRIBITS_FIND_MOST_RECENT_SOURCE_FILE_TIMESTAMP( + endif() + set(UPSTREAM_SOURCE_BASE_DIRS) + foreach(UPSTREAM_PACKAGE ${ENABLED_UPSTREAM_PACKAGES}) + append_set(UPSTREAM_SOURCE_BASE_DIRS "${${UPSTREAM_PACKAGE}_SOURCE_DIR}") + endforeach() + tribits_find_most_recent_source_file_timestamp( SOURCE_BASE_DIRS ${UPSTREAM_SOURCE_BASE_DIRS} SOURCE_BASE_BASE_DIR "${PROJECT_SOURCE_DIR}" ${SHOW_MOST_RECENT_FILES_ARGS} MOST_RECENT_TIMESTAMP_OUT MOST_RECENT_UPSTREAM_SOURCE_TIMESTAMP MOST_RECENT_RELATIVE_FILEPATH_OUT MOST_RECENT_UPSTREAM_SOURCE_FILEPATH ) - #PRINT_VAR(MOST_RECENT_UPSTREAM_SOURCE_FILEPATH) + #print_var(MOST_RECENT_UPSTREAM_SOURCE_FILEPATH) - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - MESSAGE("\nDetermining most recent binary file in upstream SE packages" + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + message("\nDetermining most recent binary file in upstream SE packages" " from ${PACKAGE_NAME}:") - ENDIF() - SET(UPSTREAM_BINARY_BASE_DIRS) - FOREACH(UPSTREAM_PACKAGE ${ENABLED_UPSTREAM_PACKAGES}) - APPEND_SET(UPSTREAM_BINARY_BASE_DIRS "${${UPSTREAM_PACKAGE}_BINARY_DIR}") - ENDFOREACH() - TRIBITS_FIND_MOST_RECENT_BINARY_FILE_TIMESTAMP( + endif() + set(UPSTREAM_BINARY_BASE_DIRS) + foreach(UPSTREAM_PACKAGE ${ENABLED_UPSTREAM_PACKAGES}) + append_set(UPSTREAM_BINARY_BASE_DIRS "${${UPSTREAM_PACKAGE}_BINARY_DIR}") + endforeach() + tribits_find_most_recent_binary_file_timestamp( BINARY_BASE_DIRS ${UPSTREAM_BINARY_BASE_DIRS} BINARY_BASE_BASE_DIR "${PROJECT_BINARY_DIR}" ${SHOW_MOST_RECENT_FILES_ARGS} MOST_RECENT_TIMESTAMP_OUT MOST_RECENT_UPSTREAM_BINARY_TIMESTAMP MOST_RECENT_RELATIVE_FILEPATH_OUT MOST_RECENT_UPSTREAM_BINARY_FILEPATH ) - #PRINT_VAR(MOST_RECENT_UPSTREAM_BINARY_FILEPATH) + #print_var(MOST_RECENT_UPSTREAM_BINARY_FILEPATH) # # D) Determine the most recent files for the current package # - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - MESSAGE("\nDetermining most recent source file for current" + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + message("\nDetermining most recent source file for current" " package ${PACKAGE_NAME}:") - ENDIF() - TRIBITS_FIND_MOST_RECENT_SOURCE_FILE_TIMESTAMP( + endif() + tribits_find_most_recent_source_file_timestamp( SOURCE_BASE_DIRS ${${PACKAGE_NAME}_SOURCE_DIR} SOURCE_BASE_BASE_DIR "${PROJECT_SOURCE_DIR}" ${SHOW_MOST_RECENT_FILES_ARGS} @@ -644,11 +644,11 @@ FUNCTION(TRIBITS_DETERMINE_IF_CURRENT_PACKAGE_NEEDS_REBUILT) MOST_RECENT_RELATIVE_FILEPATH_OUT MOST_RECENT_THIS_SOURCE_FILEPATH ) - IF (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) - MESSAGE("\nDetermining most recent binary file for current" + if (PARSE_SHOW_OVERALL_MOST_RECENT_FILES) + message("\nDetermining most recent binary file for current" " package ${PACKAGE_NAME}:") - ENDIF() - TRIBITS_FIND_MOST_RECENT_BINARY_FILE_TIMESTAMP( + endif() + tribits_find_most_recent_binary_file_timestamp( BINARY_BASE_DIRS ${${PACKAGE_NAME}_BINARY_DIR} BINARY_BASE_BASE_DIR "${PROJECT_BINARY_DIR}" ${SHOW_MOST_RECENT_FILES_ARGS} @@ -660,50 +660,50 @@ FUNCTION(TRIBITS_DETERMINE_IF_CURRENT_PACKAGE_NEEDS_REBUILT) # E) Compare most recent file time stamps to determine if a rebuild is needed # - SET(CURRENT_PACKAGE_OUT_OF_DATE_OUT FALSE) + set(CURRENT_PACKAGE_OUT_OF_DATE_OUT FALSE) - MESSAGE("\nComparing timestamps of recently updated files:") + message("\nComparing timestamps of recently updated files:") - IF (MOST_RECENT_THIS_BINARY_FILEPATH) + if (MOST_RECENT_THIS_BINARY_FILEPATH) - TRIBITS_UPDATE_PACKAGE_OUT_OF_DATE( + tribits_update_package_out_of_date( "upstream SE package source" ${MOST_RECENT_UPSTREAM_SOURCE_TIMESTAMP} "${MOST_RECENT_UPSTREAM_SOURCE_FILEPATH}" ${MOST_RECENT_THIS_PACKAGE_BINARY_TIMESTAMP} "${MOST_RECENT_THIS_BINARY_FILEPATH}" CURRENT_PACKAGE_OUT_OF_DATE_OUT ) - TRIBITS_UPDATE_PACKAGE_OUT_OF_DATE( + tribits_update_package_out_of_date( "upstream SE package binary" ${MOST_RECENT_UPSTREAM_BINARY_TIMESTAMP} "${MOST_RECENT_UPSTREAM_BINARY_FILEPATH}" ${MOST_RECENT_THIS_PACKAGE_BINARY_TIMESTAMP} "${MOST_RECENT_THIS_BINARY_FILEPATH}" CURRENT_PACKAGE_OUT_OF_DATE_OUT ) - TRIBITS_UPDATE_PACKAGE_OUT_OF_DATE( + tribits_update_package_out_of_date( "this package's source" ${MOST_RECENT_THIS_PACKAGE_SOURCE_TIMESTAMP} "${MOST_RECENT_THIS_SOURCE_FILEPATH}" ${MOST_RECENT_THIS_PACKAGE_BINARY_TIMESTAMP} "${MOST_RECENT_THIS_BINARY_FILEPATH}" CURRENT_PACKAGE_OUT_OF_DATE_OUT ) - IF (NOT CURRENT_PACKAGE_OUT_OF_DATE_OUT) - MESSAGE("-- This package's most recent binary file" + if (NOT CURRENT_PACKAGE_OUT_OF_DATE_OUT) + message("-- This package's most recent binary file" " ${MOST_RECENT_THIS_BINARY_FILEPATH}" " is more recent than its upstream SE package source or binary files" " or this package's source files!") - ENDIF() + endif() - ELSE() + else() - MESSAGE("-- This package has no unfiltered binary files so consider out of date!") + message("-- This package has no unfiltered binary files so consider out of date!") - ENDIF() + endif() - SET(${PARSE_CURRENT_PACKAGE_OUT_OF_DATE_OUT} ${CURRENT_PACKAGE_OUT_OF_DATE_OUT} + set(${PARSE_CURRENT_PACKAGE_OUT_OF_DATE_OUT} ${CURRENT_PACKAGE_OUT_OF_DATE_OUT} PARENT_SCOPE) - TRIBITS_CONFIG_CODE_STOP_TIMER(TIMER_START_SECONDS + tribits_config_code_stop_timer(TIMER_START_SECONDS "\nTotal time to check for most recent modified files") -ENDFUNCTION() +endfunction() # @@ -711,33 +711,33 @@ ENDFUNCTION() # -FUNCTION(TRIBITS_UPDATE_PACKAGE_OUT_OF_DATE +function(tribits_update_package_out_of_date DEPENDENCY_TYPE_STRING DEP_FILE_TIMESTAMP DEP_FILEPATH THIS_BINARY_FILE_TIMESTAMP THIS_BINARY_FILEPATH CURRENT_PACKAGE_IS_OUT_OF_DATE_INOUT ) - IF ("${DEP_FILE_TIMESTAMP}" GREATER "${THIS_BINARY_FILE_TIMESTAMP}") - MESSAGE("-- The ${DEPENDENCY_TYPE_STRING} file ${DEP_FILEPATH} is more recent than" + if ("${DEP_FILE_TIMESTAMP}" GREATER "${THIS_BINARY_FILE_TIMESTAMP}") + message("-- The ${DEPENDENCY_TYPE_STRING} file ${DEP_FILEPATH} is more recent than" " this package's binary file ${THIS_BINARY_FILEPATH}!") - SET(${CURRENT_PACKAGE_IS_OUT_OF_DATE_INOUT} TRUE PARENT_SCOPE) - ENDIF() -ENDFUNCTION() + set(${CURRENT_PACKAGE_IS_OUT_OF_DATE_INOUT} TRUE PARENT_SCOPE) + endif() +endfunction() -FUNCTION(TRIBITS_GET_HUMAN_READABLE_FILE_AND_TIMESTAMP +function(tribits_get_human_readable_file_and_timestamp BASE_DIR CURRENT_FILEPATH HUMAN_READABLE_FILE_AND_TIMESTAMP_OUT ) - EXECUTE_PROCESS( + execute_process( WORKING_DIRECTORY "${BASE_DIR}" COMMAND ls --full-time "${CURRENT_FILEPATH}" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE HUMAN_READABLE_FILE_AND_TIMESTAMP ) - SET(${HUMAN_READABLE_FILE_AND_TIMESTAMP_OUT} + set(${HUMAN_READABLE_FILE_AND_TIMESTAMP_OUT} ${HUMAN_READABLE_FILE_AND_TIMESTAMP} PARENT_SCOPE) -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsFindPythonInterp.cmake b/cmake/tribits/core/package_arch/TribitsFindPythonInterp.cmake index 00a880c21be7..907d15156805 100644 --- a/cmake/tribits/core/package_arch/TribitsFindPythonInterp.cmake +++ b/cmake/tribits/core/package_arch/TribitsFindPythonInterp.cmake @@ -38,53 +38,53 @@ # @HEADER # Find Python executable which is needed for dependency file building -MACRO(TRIBITS_FIND_PYTHON) - SET(PythonInterp_FIND_VERSION_MIN "2.6") - IF ("${PythonInterp_FIND_VERSION_DEFAULT}" STREQUAL "") - SET(PythonInterp_FIND_VERSION_DEFAULT "${PythonInterp_FIND_VERSION_MIN}") - ENDIF() - ADVANCED_SET(PythonInterp_FIND_VERSION ${PythonInterp_FIND_VERSION_DEFAULT} +macro(tribits_find_python) + set(PythonInterp_FIND_VERSION_MIN "2.6") + if ("${PythonInterp_FIND_VERSION_DEFAULT}" STREQUAL "") + set(PythonInterp_FIND_VERSION_DEFAULT "${PythonInterp_FIND_VERSION_MIN}") + endif() + advanced_set(PythonInterp_FIND_VERSION ${PythonInterp_FIND_VERSION_DEFAULT} CACHE STRING "Default version of Python to find (must be ${PythonInterp_FIND_VERSION_DEFAULT} or greater") - IF (PythonInterp_FIND_VERSION VERSION_LESS "${PythonInterp_FIND_VERSION_MIN}") - MESSAGE_WRAPPER(FATAL_ERROR "Error," + if (PythonInterp_FIND_VERSION VERSION_LESS "${PythonInterp_FIND_VERSION_MIN}") + message_wrapper(FATAL_ERROR "Error," " PythonInterp_FIND_VERSION=${PythonInterp_FIND_VERSION} < ${PythonInterp_FIND_VERSION_MIN}" " is not allowed!" ) - ENDIF() - ADVANCED_SET(PythonInterp_MUST_BE_FOUND FALSE CACHE BOOL "Require Python to be found or not.") - IF (${PROJECT_NAME}_REQUIRES_PYTHON) - SET(PythonInterp_REQUIRED_ARG "REQUIRED") - ELSE() - SET(PythonInterp_REQUIRED_ARG "") - ENDIF() - SET(FIND_PythonInterp_ARGS PythonInterp ${PythonInterp_REQUIRED_ARG}) - IF (TRIBITS_FIND_PYTHON_UNITTEST) - SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE_UNITTEST_VAL}) - ELSE() - FIND_PACKAGE(${FIND_PythonInterp_ARGS}) - ENDIF() -ENDMACRO() + endif() + advanced_set(PythonInterp_MUST_BE_FOUND FALSE CACHE BOOL "Require Python to be found or not.") + if (${PROJECT_NAME}_REQUIRES_PYTHON) + set(PythonInterp_REQUIRED_ARG "REQUIRED") + else() + set(PythonInterp_REQUIRED_ARG "") + endif() + set(FIND_PythonInterp_ARGS PythonInterp ${PythonInterp_REQUIRED_ARG}) + if (TRIBITS_FIND_PYTHON_UNITTEST) + set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE_UNITTEST_VAL}) + else() + find_package(${FIND_PythonInterp_ARGS}) + endif() +endmacro() # TriBITS Wrapper for finding Python (or not) for a TriBITS project. -MACRO(TRIBITS_FIND_PYTHON_INTERP) - IF (${PROJECT_NAME}_REQUIRES_PYTHON) - SET(${PROJECT_NAME}_USES_PYTHON TRUE) - ENDIF() - IF ("${${PROJECT_NAME}_USES_PYTHON}" STREQUAL "") +macro(tribits_find_python_interp) + if (${PROJECT_NAME}_REQUIRES_PYTHON) + set(${PROJECT_NAME}_USES_PYTHON TRUE) + endif() + if ("${${PROJECT_NAME}_USES_PYTHON}" STREQUAL "") # Unless the project tells us they can use Python or not, let's go ahead # and look for Python in case some packages want to use it. - SET(${PROJECT_NAME}_USES_PYTHON TRUE) - ENDIF() - IF (${PROJECT_NAME}_USES_PYTHON) - TRIBITS_FIND_PYTHON() - PRINT_VAR(PYTHON_EXECUTABLE) - IF (${PROJECT_NAME}_REQUIRES_PYTHON AND PYTHON_EXECUTABLE STREQUAL "") - MESSAGE_WRAPPER(FATAL_ERROR "Error, PYTHON_EXECUTABLE='' but" + set(${PROJECT_NAME}_USES_PYTHON TRUE) + endif() + if (${PROJECT_NAME}_USES_PYTHON) + tribits_find_python() + print_var(PYTHON_EXECUTABLE) + if (${PROJECT_NAME}_REQUIRES_PYTHON AND PYTHON_EXECUTABLE STREQUAL "") + message_wrapper(FATAL_ERROR "Error, PYTHON_EXECUTABLE='' but" " ${PROJECT_NAME}_REQUIRES_PYTHON=${${PROJECT_NAME}_REQUIRES_PYTHON}!" ) - ENDIF() - ELSE() - MESSAGE_WRAPPER("-- " "NOTE: Skipping check for Python because" + endif() + else() + message_wrapper("-- " "NOTE: Skipping check for Python because" " ${PROJECT_NAME}_USES_PYTHON='${${PROJECT_NAME}_USES_PYTHON}'") - ENDIF() -ENDMACRO() + endif() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsFortranMangling.cmake b/cmake/tribits/core/package_arch/TribitsFortranMangling.cmake index 2ac850542890..b5f250d40b0b 100644 --- a/cmake/tribits/core/package_arch/TribitsFortranMangling.cmake +++ b/cmake/tribits/core/package_arch/TribitsFortranMangling.cmake @@ -40,54 +40,54 @@ # This file gets included in the base-level CMakeLists.txt file to define # Fortran name mangling. -IF (${PROJECT_NAME}_ENABLE_CXX AND ${PROJECT_NAME}_ENABLE_Fortran) - INCLUDE(FortranMangling) - FORTRAN_MANGLING() +if (${PROJECT_NAME}_ENABLE_CXX AND ${PROJECT_NAME}_ENABLE_Fortran) + include(FortranMangling) + fortran_mangling() # Verify the selected combination of Fortran and C++ compilers. - IF(NOT ${PROJECT_NAME}_SKIP_FORTRANCINTERFACE_VERIFY_TEST) - INCLUDE(FortranCInterface) - FortranCInterface_VERIFY(CXX) - ENDIF() -ENDIF() + if(NOT ${PROJECT_NAME}_SKIP_FORTRANCINTERFACE_VERIFY_TEST) + include(FortranCInterface) + fortrancinterface_verify(CXX) + endif() +endif() -IF (FC_FUNC_DEFAULT) +if (FC_FUNC_DEFAULT) - SET(F77_FUNC_DEFAULT ${FC_FUNC_DEFAULT}) - SET(F77_FUNC__DEFAULT ${FC_FUNC__DEFAULT}) + set(F77_FUNC_DEFAULT ${FC_FUNC_DEFAULT}) + set(F77_FUNC__DEFAULT ${FC_FUNC__DEFAULT}) # 2008/10/26: rabartl: ToDo: Above, we need to write # a different function to find out the right BLAS # name mangling automatically. Given what the above - # FORTRAN_MANGLING() function does, this should not + # fortran_mangling() function does, this should not # be too hard. -ELSE() +else() - IF(CYGWIN) - SET(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) - SET(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) - ELSEIF(WIN32) - SET(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) - SET(F77_FUNC__DEFAULT "(name,NAME) NAME") - ELSEIF(UNIX AND NOT APPLE) - SET(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) - #SET(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) - SET(F77_FUNC__DEFAULT "(name,NAME) name ## _" ) - ELSEIF(APPLE) - SET(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) - SET(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) - ELSE() - MESSAGE(FATAL_ERROR "Error, could not determine fortran name mangling!") - ENDIF() + if(CYGWIN) + set(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) + set(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) + elseif(WIN32) + set(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) + set(F77_FUNC__DEFAULT "(name,NAME) NAME") + elseif(UNIX AND NOT APPLE) + set(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) + #set(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) + set(F77_FUNC__DEFAULT "(name,NAME) name ## _" ) + elseif(APPLE) + set(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) + set(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) + else() + message(FATAL_ERROR "Error, could not determine fortran name mangling!") + endif() -ENDIF() +endif() # Set options so that users can change these! -SET(F77_FUNC ${F77_FUNC_DEFAULT} CACHE STRING +set(F77_FUNC ${F77_FUNC_DEFAULT} CACHE STRING "Name mangling used to call Fortran 77 functions with no underscores in the name") -SET(F77_FUNC_ ${F77_FUNC__DEFAULT} CACHE STRING +set(F77_FUNC_ ${F77_FUNC__DEFAULT} CACHE STRING "Name mangling used to call Fortran 77 functions with at least one underscore in the name") -MARK_AS_ADVANCED(F77_FUNC) -MARK_AS_ADVANCED(F77_FUNC_) +mark_as_advanced(F77_FUNC) +mark_as_advanced(F77_FUNC_) diff --git a/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake b/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake index 219ff4016f6b..3c83d5d108c9 100644 --- a/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake @@ -37,142 +37,142 @@ # ************************************************************************ # @HEADER -INCLUDE(AppendSet) -INCLUDE(AssertDefined) -INCLUDE(MessageWrapper) -INCLUDE(TribitsSortListAccordingToMasterList) +include(AppendSet) +include(AssertDefined) +include(MessageWrapper) +include(TribitsSortListAccordingToMasterList) # Optionally start CMake code configure timing # -FUNCTION(TRIBITS_CONFIG_CODE_START_TIMER START_TIMER_SECONDS_VAR_OUT) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(START_TIMER_SECONDS) - SET(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() +function(tribits_config_code_start_timer START_TIMER_SECONDS_VAR_OUT) + if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) + timer_get_raw_seconds(START_TIMER_SECONDS) + set(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) + endif() +endfunction() # Optionally stop CMake code configure timing # -FUNCTION(TRIBITS_CONFIG_CODE_STOP_TIMER START_TIMER_SECONDS_VAR_IN +function(tribits_config_code_stop_timer START_TIMER_SECONDS_VAR_IN TIMER_STR ) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - TIMER_GET_RAW_SECONDS(TIMER_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${${START_TIMER_SECONDS_VAR_IN}} + if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) + timer_get_raw_seconds(TIMER_STOP_SECONDS) + timer_print_rel_time(${${START_TIMER_SECONDS_VAR_IN}} ${TIMER_STOP_SECONDS} "${TIMER_STR}") - ENDIF() -ENDFUNCTION() + endif() +endfunction() # Optionally start CMake code **package** configure timing # -FUNCTION(TRIBITS_PACKAGE_CONFIG_CODE_START_TIMER START_TIMER_SECONDS_VAR_OUT) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING +function(tribits_package_config_code_start_timer START_TIMER_SECONDS_VAR_OUT) + if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING AND ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) ) - TIMER_GET_RAW_SECONDS(START_TIMER_SECONDS) - SET(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() + timer_get_raw_seconds(START_TIMER_SECONDS) + set(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) + endif() +endfunction() # Optionally stop CMake code **package** configure timing # -FUNCTION(TRIBITS_PACKAGE_CONFIG_CODE_STOP_TIMER START_TIMER_SECONDS_VAR_IN +function(tribits_package_config_code_stop_timer START_TIMER_SECONDS_VAR_IN TIMER_STR ) - IF (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING + if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING AND ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) ) - TIMER_GET_RAW_SECONDS(TIMER_STOP_SECONDS) - TIMER_PRINT_REL_TIME(${${START_TIMER_SECONDS_VAR_IN}} + timer_get_raw_seconds(TIMER_STOP_SECONDS) + timer_print_rel_time(${${START_TIMER_SECONDS_VAR_IN}} ${TIMER_STOP_SECONDS} "${TIMER_STR}") - ENDIF() -ENDFUNCTION() + endif() +endfunction() # Set the combined directory name taking into account '.' repos. # -FUNCTION(TRIBITS_GET_REPO_NAME REPO_DIR REPO_NAME_OUT) - IF (REPO_DIR STREQUAL ".") - SET(REPO_NAME ${PROJECT_NAME}) - ELSE() - SET(REPO_NAME ${REPO_DIR}) - ENDIF() - SET(${REPO_NAME_OUT} "${REPO_NAME}" PARENT_SCOPE) -ENDFUNCTION() +function(tribits_get_repo_name REPO_DIR REPO_NAME_OUT) + if (REPO_DIR STREQUAL ".") + set(REPO_NAME ${PROJECT_NAME}) + else() + set(REPO_NAME ${REPO_DIR}) + endif() + set(${REPO_NAME_OUT} "${REPO_NAME}" PARENT_SCOPE) +endfunction() # Get the REPO_NAME and REPO_DIR given the REPO # -FUNCTION(TRIBITS_GET_REPO_NAME_DIR REPO_IN REPO_NAME_OUT REPO_DIR_OUT) - #MESSAGE("TRIBITS_GET_REPO_NAME_DIR: '${REPO_IN}' '${REPO_NAME_OUT}' '${REPO_DIR_OUT}'") +function(tribits_get_repo_name_dir REPO_IN REPO_NAME_OUT REPO_DIR_OUT) + #message("TRIBITS_GET_REPO_NAME_DIR: '${REPO_IN}' '${REPO_NAME_OUT}' '${REPO_DIR_OUT}'") # This list of repositories is the list of directories! - SET(REPO_DIR ${REPO_IN}) + set(REPO_DIR ${REPO_IN}) # Get the Repository name - IF (REPO_IN STREQUAL ".") + if (REPO_IN STREQUAL ".") # The Project and the Reposiotry are one and the same - SET(REPO_NAME ${PROJECT_NAME}) - ELSE() + set(REPO_NAME ${PROJECT_NAME}) + else() # The Repository name is the same as the repository directory - SET(REPO_NAME ${REPO_IN}) - ENDIF() - SET(${REPO_NAME_OUT} ${REPO_NAME} PARENT_SCOPE) - SET(${REPO_DIR_OUT} ${REPO_DIR} PARENT_SCOPE) -ENDFUNCTION() + set(REPO_NAME ${REPO_IN}) + endif() + set(${REPO_NAME_OUT} ${REPO_NAME} PARENT_SCOPE) + set(${REPO_DIR_OUT} ${REPO_DIR} PARENT_SCOPE) +endfunction() # Set the combined directory name taking into account '.' repos. # -FUNCTION(TRIBITS_SET_BASE_REPO_DIR BASE_DIR REPO_DIR BASE_REPO_DIR_OUT) - IF (REPO_DIR STREQUAL ".") - SET(REPO_DIR_STR "") - ELSE() - SET(REPO_DIR_STR "/${REPO_DIR}") - ENDIF() - SET(${BASE_REPO_DIR_OUT} "${BASE_DIR}${REPO_DIR_STR}" PARENT_SCOPE) -ENDFUNCTION() +function(tribits_set_base_repo_dir BASE_DIR REPO_DIR BASE_REPO_DIR_OUT) + if (REPO_DIR STREQUAL ".") + set(REPO_DIR_STR "") + else() + set(REPO_DIR_STR "/${REPO_DIR}") + endif() + set(${BASE_REPO_DIR_OUT} "${BASE_DIR}${REPO_DIR_STR}" PARENT_SCOPE) +endfunction() # Get the list of explicitly enabled entries # -# These is the list of entires in ${LISTVAR} for which: +# These is the list of entries in ${LISTVAR} for which: # -# IF (${ENABLED_PREFIX}_ENABLE_{ENTRY}) +# if (${ENABLED_PREFIX}_ENABLE_{ENTRY}) # # evaluates to true. # -FUNCTION(TRIBITS_GET_ENABLED_LIST LISTVAR ENABLED_PREFIX +function(tribits_get_enabled_list LISTVAR ENABLED_PREFIX ENABLED_LIST_OUT_OUT NUM_ENABLED_OUT_OUT ) - SET(ENABLED_LIST_OUT) - FOREACH(ENTITY ${${LISTVAR}}) - SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) - ASSERT_DEFINED(${ENTITY_NAME}) - SET(INCLUDE_ENTITY FALSE) - IF (${ENTITY_NAME}) - LIST(APPEND ENABLED_LIST_OUT ${ENTITY}) - ENDIF() - ENDFOREACH() - LIST(LENGTH ENABLED_LIST_OUT NUM_ENABLED_OUT) - SET(${ENABLED_LIST_OUT_OUT} ${ENABLED_LIST_OUT} PARENT_SCOPE) - IF (NUM_ENABLED_OUT_OUT) - SET(${NUM_ENABLED_OUT_OUT} ${NUM_ENABLED_OUT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() + set(ENABLED_LIST_OUT) + foreach(ENTITY ${${LISTVAR}}) + set(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) + assert_defined(${ENTITY_NAME}) + set(INCLUDE_ENTITY FALSE) + if (${ENTITY_NAME}) + list(APPEND ENABLED_LIST_OUT ${ENTITY}) + endif() + endforeach() + list(LENGTH ENABLED_LIST_OUT NUM_ENABLED_OUT) + set(${ENABLED_LIST_OUT_OUT} ${ENABLED_LIST_OUT} PARENT_SCOPE) + if (NUM_ENABLED_OUT_OUT) + set(${NUM_ENABLED_OUT_OUT} ${NUM_ENABLED_OUT} PARENT_SCOPE) + endif() +endfunction() # Get the list non-disabled entries # -# These is the list of entires in ${LISTVAR} for which: +# These is the list of entries in ${LISTVAR} for which: # -# IF ( +# if ( # (${ENABLED_PREFIX}_ENABLE_{ENTRY}) # OR # (${ENABLED_PREFIX}_ENABLE_{ENTRY} STREQUAL "" ) @@ -180,31 +180,31 @@ ENDFUNCTION() # # evaluates to true. # -FUNCTION(TRIBITS_GET_NONDISABLED_LIST LISTVAR ENABLED_PREFIX +function(tribits_get_nondisabled_list LISTVAR ENABLED_PREFIX NONDISABLED_LIST_OUT_OUT NUM_NONDISABLED_OUT_OUT ) - SET(NONDISABLED_LIST_OUT) - FOREACH(ENTITY ${${LISTVAR}}) - SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) - ASSERT_DEFINED(${ENTITY_NAME}) - SET(INCLUDE_ENTITY FALSE) - IF (${ENTITY_NAME} OR ${ENTITY_NAME} STREQUAL "") - LIST(APPEND NONDISABLED_LIST_OUT ${ENTITY}) - ENDIF() - ENDFOREACH() - LIST(LENGTH NONDISABLED_LIST_OUT NUM_NONDISABLED_OUT) - SET(${NONDISABLED_LIST_OUT_OUT} ${NONDISABLED_LIST_OUT} PARENT_SCOPE) - IF (NUM_NONDISABLED_OUT_OUT) - SET(${NUM_NONDISABLED_OUT_OUT} ${NUM_NONDISABLED_OUT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() + set(NONDISABLED_LIST_OUT) + foreach(ENTITY ${${LISTVAR}}) + set(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) + assert_defined(${ENTITY_NAME}) + set(INCLUDE_ENTITY FALSE) + if (${ENTITY_NAME} OR ${ENTITY_NAME} STREQUAL "") + list(APPEND NONDISABLED_LIST_OUT ${ENTITY}) + endif() + endforeach() + list(LENGTH NONDISABLED_LIST_OUT NUM_NONDISABLED_OUT) + set(${NONDISABLED_LIST_OUT_OUT} ${NONDISABLED_LIST_OUT} PARENT_SCOPE) + if (NUM_NONDISABLED_OUT_OUT) + set(${NUM_NONDISABLED_OUT_OUT} ${NUM_NONDISABLED_OUT} PARENT_SCOPE) + endif() +endfunction() # Get the list of explicitly disabled entries # -# These is the list of entires in ${LISTVAR} for which: +# These is the list of entries in ${LISTVAR} for which: # -# IF ( +# if ( # (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY}) # AND # (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY} STREQUAL "" ) @@ -212,98 +212,98 @@ ENDFUNCTION() # # evaluates to true. # -FUNCTION(TRIBITS_GET_DISABLED_LIST LISTVAR ENABLED_PREFIX +function(tribits_get_disabled_list LISTVAR ENABLED_PREFIX DISABLED_LIST_OUT_OUT NUM_DISABLED_OUT_OUT ) - SET(DISABLED_LIST_OUT) - FOREACH(ENTITY ${${LISTVAR}}) - SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) - ASSERT_DEFINED(${ENTITY_NAME}) - SET(INCLUDE_ENTITY FALSE) - IF ( (NOT ${ENTITY_NAME}) AND (NOT ${ENTITY_NAME} STREQUAL "") ) - LIST(APPEND DISABLED_LIST_OUT ${ENTITY}) - ENDIF() - ENDFOREACH() - LIST(LENGTH DISABLED_LIST_OUT NUM_DISABLED_OUT) - SET(${DISABLED_LIST_OUT_OUT} ${DISABLED_LIST_OUT} PARENT_SCOPE) - IF (NUM_DISABLED_OUT_OUT) - SET(${NUM_DISABLED_OUT_OUT} ${NUM_DISABLED_OUT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() + set(DISABLED_LIST_OUT) + foreach(ENTITY ${${LISTVAR}}) + set(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) + assert_defined(${ENTITY_NAME}) + set(INCLUDE_ENTITY FALSE) + if ( (NOT ${ENTITY_NAME}) AND (NOT ${ENTITY_NAME} STREQUAL "") ) + list(APPEND DISABLED_LIST_OUT ${ENTITY}) + endif() + endforeach() + list(LENGTH DISABLED_LIST_OUT NUM_DISABLED_OUT) + set(${DISABLED_LIST_OUT_OUT} ${DISABLED_LIST_OUT} PARENT_SCOPE) + if (NUM_DISABLED_OUT_OUT) + set(${NUM_DISABLED_OUT_OUT} ${NUM_DISABLED_OUT} PARENT_SCOPE) + endif() +endfunction() # Get the list of non-enabled entries # -# These is the list of entires in ${LISTVAR} for which: +# These is the list of entries in ${LISTVAR} for which: # -# IF (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY}) +# if (NOT ${ENABLED_PREFIX}_ENABLE_{ENTRY}) # # evaluates to true. # -FUNCTION(TRIBITS_GET_NONENABLED_LIST LISTVAR ENABLED_PREFIX +function(tribits_get_nonenabled_list LISTVAR ENABLED_PREFIX NONENABLED_LIST_OUT_OUT NUM_NONENABLED_OUT_OUT ) - SET(NONENABLED_LIST_OUT) - FOREACH(ENTITY ${${LISTVAR}}) - SET(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) - ASSERT_DEFINED(${ENTITY_NAME}) - SET(INCLUDE_ENTITY FALSE) - IF (NOT ${ENTITY_NAME}) # Note that empty "" is also false! - LIST(APPEND NONENABLED_LIST_OUT ${ENTITY}) - ENDIF() - ENDFOREACH() - LIST(LENGTH NONENABLED_LIST_OUT NUM_NONENABLED_OUT) - SET(${NONENABLED_LIST_OUT_OUT} ${NONENABLED_LIST_OUT} PARENT_SCOPE) - IF (NUM_NONENABLED_OUT_OUT) - SET(${NUM_NONENABLED_OUT_OUT} ${NUM_NONENABLED_OUT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() + set(NONENABLED_LIST_OUT) + foreach(ENTITY ${${LISTVAR}}) + set(ENTITY_NAME ${ENABLED_PREFIX}_ENABLE_${ENTITY}) + assert_defined(${ENTITY_NAME}) + set(INCLUDE_ENTITY FALSE) + if (NOT ${ENTITY_NAME}) # Note that empty "" is also false! + list(APPEND NONENABLED_LIST_OUT ${ENTITY}) + endif() + endforeach() + list(LENGTH NONENABLED_LIST_OUT NUM_NONENABLED_OUT) + set(${NONENABLED_LIST_OUT_OUT} ${NONENABLED_LIST_OUT} PARENT_SCOPE) + if (NUM_NONENABLED_OUT_OUT) + set(${NUM_NONENABLED_OUT_OUT} ${NUM_NONENABLED_OUT} PARENT_SCOPE) + endif() +endfunction() # Macro that sets up the basic lists of enabled packages and SE packages. # -MACRO(TRIBITS_SET_UP_ENABLED_LISTS_AND_SE_PKG_IDX) +macro(tribits_set_up_enabled_lists_and_se_pkg_idx) # ${PROJECT_NAME}_ENABLED_PACKAGES - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} + tribits_get_enabled_list( ${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} ${PROJECT_NAME}_ENABLED_PACKAGES ${PROJECT_NAME}_NUM_ENABLED_PACKAGES) # ${PROJECT_NAME}_ENABLED_SE_PACKAGES - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} + tribits_get_enabled_list( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} ${PROJECT_NAME}_ENABLED_SE_PACKAGES ${PROJECT_NAME}_NUM_ENABLED_SE_PACKAGES) # ${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES - SET(${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES + set(${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES "${${PROJECT_NAME}_ENABLED_SE_PACKAGES}") - LIST(REVERSE ${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES) + list(REVERSE ${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES) # ${PACKAGE_NAME}_SE_PKG_IDX - SET(SE_PKG_IDX 0) - FOREACH(TRIBITS_SE_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - SET(${TRIBITS_SE_PACKAGE}_SE_PKG_IDX ${SE_PKG_IDX}) - MATH(EXPR SE_PKG_IDX "${SE_PKG_IDX} + 1") - ENDFOREACH() + set(SE_PKG_IDX 0) + foreach(TRIBITS_SE_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + set(${TRIBITS_SE_PACKAGE}_SE_PKG_IDX ${SE_PKG_IDX}) + math(EXPR SE_PKG_IDX "${SE_PKG_IDX} + 1") + endforeach() # ${PROJECT_NAME}_ENABLED_TPLS - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_TPLS TPL + tribits_get_enabled_list( ${PROJECT_NAME}_TPLS TPL ${PROJECT_NAME}_ENABLED_TPLS ${PROJECT_NAME}_NUM_ENABLED_TPLS) # ${PROJECT_NAME}_REVERSE_ENABLED_TPLS - SET(${PROJECT_NAME}_REVERSE_ENABLED_TPLS + set(${PROJECT_NAME}_REVERSE_ENABLED_TPLS "${${PROJECT_NAME}_ENABLED_TPLS}") - LIST(REVERSE ${PROJECT_NAME}_REVERSE_ENABLED_TPLS) + list(REVERSE ${PROJECT_NAME}_REVERSE_ENABLED_TPLS) -ENDMACRO() +endmacro() -# @FUNCTION: TRIBITS_SET_ST_FOR_DEV_MODE() +# @FUNCTION: tribits_set_st_for_dev_mode() # # Function that allows packages to easily make a feature ``ST`` for # development builds and ``PT`` for release builds by default. # # Usage:: # -# TRIBITS_SET_ST_FOR_DEV_MODE() +# tribits_set_st_for_dev_mode() # # This function is typically called in a package's top-level # `/CMakeLists.txt`_ file before defining other options for the @@ -319,81 +319,81 @@ ENDMACRO() # enabling the dependent features/tests), while still having important # functionality available to users by default in a release of the package. # -FUNCTION(TRIBITS_SET_ST_FOR_DEV_MODE OUTPUT_VAR) - IF(${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE) - SET(OUTPUT_VAL ${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}) - ELSE() - SET(OUTPUT_VAL ON) - ENDIF() - SET(${OUTPUT_VAR} ${OUTPUT_VAL} PARENT_SCOPE) -ENDFUNCTION() +function(tribits_set_st_for_dev_mode OUTPUT_VAR) + if(${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE) + set(OUTPUT_VAL ${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}) + else() + set(OUTPUT_VAL ON) + endif() + set(${OUTPUT_VAR} ${OUTPUT_VAL} PARENT_SCOPE) +endfunction() # For backward compatibility -MACRO(TRIBITS_SET_SS_FOR_DEV_MODE OUTPUT_VAR) - MESSAGE(WARNING - "WARNING: TRIBITS_SET_SS_FOR_DEV_MODE() is deprecated," - " use TRIBITS_SET_ST_FOR_DEV_MODE() instead!") - TRIBITS_SET_ST_FOR_DEV_MODE(${OUTPUT_VAR}) -ENDMACRO() +macro(tribits_set_ss_for_dev_mode OUTPUT_VAR) + message(WARNING + "WARNING: tribits_set_ss_for_dev_mode() is deprecated," + " use tribits_set_st_for_dev_mode() instead!") + tribits_set_st_for_dev_mode(${OUTPUT_VAR}) +endmacro() # Function that extracts all of the required and optional # items for a given class of package lists # -FUNCTION( TRIBITS_GATHER_ENABLED_ITEMS PACKAGE_NAME LISTTYPE_PREFIX +function( tribits_gather_enabled_items PACKAGE_NAME LISTTYPE_PREFIX LISTTYPE_POSTFIX GATHERED_ITEMS_LIST_OUT ) - #MESSAGE("TRIBITS_GATHER_ENABLED_ITEMS: '${PACKAGE_NAME}' '${LISTTYPE_PREFIX}'" + #message("TRIBITS_GATHER_ENABLED_ITEMS: '${PACKAGE_NAME}' '${LISTTYPE_PREFIX}'" # " '${LISTTYPE_POSTFIX}' '${GATHERED_ITEMS_LIST_OUT}'") - SET(GATHERED_ITEMS_LIST_TMP + set(GATHERED_ITEMS_LIST_TMP ${${PACKAGE_NAME}_${LISTTYPE_PREFIX}_REQUIRED_DEP_${LISTTYPE_POSTFIX}} ) - #MESSAGE("TRIBITS_GATHER_ENABLED_ITEMS:" + #message("TRIBITS_GATHER_ENABLED_ITEMS:" # " ${PACKAGE_NAME}_${LISTTYPE_PREFIX}_REQUIRED_DEP_${LISTTYPE_POSTFIX} = ${GATHERED_ITEMS_LIST_TMP}") - FOREACH(ITEM + foreach(ITEM ${${PACKAGE_NAME}_${LISTTYPE_PREFIX}_OPTIONAL_DEP_${LISTTYPE_POSTFIX}} ) - ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_${ITEM}) - IF (${PACKAGE_NAME}_ENABLE_${ITEM}) - APPEND_SET(GATHERED_ITEMS_LIST_TMP ${ITEM}) - ENDIF() - ENDFOREACH() + assert_defined(${PACKAGE_NAME}_ENABLE_${ITEM}) + if (${PACKAGE_NAME}_ENABLE_${ITEM}) + append_set(GATHERED_ITEMS_LIST_TMP ${ITEM}) + endif() + endforeach() - #MESSAGE("TRIBITS_GATHER_ENABLED_ITEMS:" + #message("TRIBITS_GATHER_ENABLED_ITEMS:" # " ${GATHERED_ITEMS_LIST_OUT} = ${GATHERED_ITEMS_LIST_TMP}") - SET(${GATHERED_ITEMS_LIST_OUT} ${GATHERED_ITEMS_LIST_TMP} PARENT_SCOPE) + set(${GATHERED_ITEMS_LIST_OUT} ${GATHERED_ITEMS_LIST_TMP} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # Function that appends the Package/TPL include and library paths for given # list of enabled Packages/TPLs # -# As a side effect of calling this function, INCLUDE_DIRECTORIES(...) to set +# As a side effect of calling this function, include_directories(...) to set # all of the include directories for a given set of enabled Packages/TPLs. # -# NOTE: The Packages/TPLs should be sorted in decending dependency order +# NOTE: The Packages/TPLs should be sorted in descending dependency order # before calling this function. # # NOTE: Because this function may be called in cases where a package's # required subpackages are not actually enabled (e.g. SEACAS subpackages) # -FUNCTION( TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS TPL_OR_PACKAGE PREFIX +function( tribits_append_include_and_link_dirs TPL_OR_PACKAGE PREFIX LIST EXTRA_DEP_LIBS_INOUT ) - IF (TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS_DEBUG_DUMP) - MESSAGE("\nTRIBITS_APPEND_INCLUDE_AND_LINK_DIRS: '${TPL_OR_PACKAGE}'" + if (TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS_DEBUG_DUMP) + message("\nTRIBITS_APPEND_INCLUDE_AND_LINK_DIRS: '${TPL_OR_PACKAGE}'" " '${PREFIX}' '${LIST}' '${EXTRA_DEP_LIBS_INOUT}'") - ENDIF() - SET(EXTRA_DEP_LIBS_INOUT_TMP ${${EXTRA_DEP_LIBS_INOUT}}) - CMAKE_POLICY(SET CMP0054 NEW) - IF ( + endif() + set(EXTRA_DEP_LIBS_INOUT_TMP ${${EXTRA_DEP_LIBS_INOUT}}) + cmake_policy(SET CMP0054 NEW) + if ( "${TPL_OR_PACKAGE}" STREQUAL "TPL" AND ( @@ -403,198 +403,198 @@ FUNCTION( TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS TPL_OR_PACKAGE PREFIX OR ${PACKAGE_NAME}_SKIP_TPL_SYSTEM_INCLUDE_DIRS) ) ) - SET(SYSTEM_ARG "SYSTEM") - ELSE() - SET(SYSTEM_ARG) - ENDIF() - FOREACH(ITEM ${LIST}) - IF (${PREFIX}${ITEM}_LIBRARIES) - APPEND_SET(EXTRA_DEP_LIBS_ARG_TMP ${${PREFIX}${ITEM}_LIBRARIES}) - ENDIF() - IF (${PREFIX}${ITEM}_INCLUDE_DIRS) - IF (TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS_DEBUG_DUMP) - MESSAGE("-- " "INCLUDE_DIRECTORIES(${SYSTEM_ARG} ${${PREFIX}${ITEM}_INCLUDE_DIRS})") - ENDIF() - INCLUDE_DIRECTORIES(${SYSTEM_ARG} ${${PREFIX}${ITEM}_INCLUDE_DIRS}) - ENDIF() - IF (${PREFIX}${ITEM}_LIBRARY_DIRS) - IF (PREFIX) + set(SYSTEM_ARG "SYSTEM") + else() + set(SYSTEM_ARG) + endif() + foreach(ITEM ${LIST}) + if (${PREFIX}${ITEM}_LIBRARIES) + append_set(EXTRA_DEP_LIBS_ARG_TMP ${${PREFIX}${ITEM}_LIBRARIES}) + endif() + if (${PREFIX}${ITEM}_INCLUDE_DIRS) + if (TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS_DEBUG_DUMP) + message("-- " "include_directories(${SYSTEM_ARG} ${${PREFIX}${ITEM}_INCLUDE_DIRS})") + endif() + include_directories(${SYSTEM_ARG} ${${PREFIX}${ITEM}_INCLUDE_DIRS}) + endif() + if (${PREFIX}${ITEM}_LIBRARY_DIRS) + if (PREFIX) # TODO: Is there a better way to know if we need this? # We want LINK_DIRECTORIES for TPLs but not packages. - LINK_DIRECTORIES(${${PREFIX}${ITEM}_LIBRARY_DIRS}) - ENDIF() - SET_PROPERTY(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS + link_directories(${${PREFIX}${ITEM}_LIBRARY_DIRS}) + endif() + set_property(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS ${${PREFIX}${ITEM}_LIBRARY_DIRS}) - ENDIF() - IF (TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS_DEBUG_DUMP) - PRINT_VAR(${PREFIX}${ITEM}_LIBRARIES) - PRINT_VAR(${PREFIX}${ITEM}_INCLUDE_DIRS) - PRINT_VAR(${PREFIX}${ITEM}_LIBRARY_DIRS) - ENDIF() - ENDFOREACH() - SET(${EXTRA_DEP_LIBS_INOUT} ${EXTRA_DEP_LIBS_ARG_TMP} PARENT_SCOPE) -ENDFUNCTION() + endif() + if (TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS_DEBUG_DUMP) + print_var(${PREFIX}${ITEM}_LIBRARIES) + print_var(${PREFIX}${ITEM}_INCLUDE_DIRS) + print_var(${PREFIX}${ITEM}_LIBRARY_DIRS) + endif() + endforeach() + set(${EXTRA_DEP_LIBS_INOUT} ${EXTRA_DEP_LIBS_ARG_TMP} PARENT_SCOPE) +endfunction() # Function that sorts and appends all the items in a dependency list for # packages or TPLs. # -FUNCTION( TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS +function( tribits_sort_and_append_include_and_link_dirs_and_libs TPL_OR_PACKAGE MASTER_SORT_LIST LIST PREFIX EXTRA_DEP_LIBS_INOUT ) - IF (TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS_DEBUG_DUMP) - MESSAGE("TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS:") - PRINT_VAR(MASTER_SORT_LIST) - PRINT_VAR(LIST) - PRINT_VAR(PREFIX) - PRINT_VAR(EXTRA_DEP_LIBS_INOUT) - ENDIF() + if (TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS_DEBUG_DUMP) + message("TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS:") + print_var(MASTER_SORT_LIST) + print_var(LIST) + print_var(PREFIX) + print_var(EXTRA_DEP_LIBS_INOUT) + endif() - SET(LOCAL_LIST ${LIST}) - IF (TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS_DEBUG_DUMP) - PRINT_VAR(LOCAL_LIST) - ENDIF() + set(LOCAL_LIST ${LIST}) + if (TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS_DEBUG_DUMP) + print_var(LOCAL_LIST) + endif() - IF (LOCAL_LIST) + if (LOCAL_LIST) - TRIBITS_SORT_LIST_ACCORDING_TO_MASTER_LIST("${MASTER_SORT_LIST}" LOCAL_LIST) - IF (TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS_DEBUG_DUMP) - PRINT_VAR(LOCAL_LIST) - ENDIF() + tribits_sort_list_according_to_master_list("${MASTER_SORT_LIST}" LOCAL_LIST) + if (TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS_DEBUG_DUMP) + print_var(LOCAL_LIST) + endif() - SET(EXTRA_DEP_LIBS_ARG_TMP ${${EXTRA_DEP_LIBS_INOUT}}) - TRIBITS_APPEND_INCLUDE_AND_LINK_DIRS("${TPL_OR_PACKAGE}" "${PREFIX}" + set(EXTRA_DEP_LIBS_ARG_TMP ${${EXTRA_DEP_LIBS_INOUT}}) + tribits_append_include_and_link_dirs("${TPL_OR_PACKAGE}" "${PREFIX}" "${LOCAL_LIST}" EXTRA_DEP_LIBS_ARG_TMP) - SET(${EXTRA_DEP_LIBS_INOUT} ${EXTRA_DEP_LIBS_ARG_TMP} PARENT_SCOPE) + set(${EXTRA_DEP_LIBS_INOUT} ${EXTRA_DEP_LIBS_ARG_TMP} PARENT_SCOPE) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # Fully process the include and link directories and list of libraries for a # package's list of dependent packages for use in creating a library or an # executable # -FUNCTION( TRIBITS_SORT_AND_APPEND_PACKAGE_INCLUDE_AND_LINK_DIRS_AND_LIBS +function( tribits_sort_and_append_package_include_and_link_dirs_and_libs PACKAGE_NAME LIB_OR_TEST_ARG EXTRA_DEP_LIBS_INOUT ) - TRIBITS_GATHER_ENABLED_ITEMS(${PACKAGE_NAME} ${LIB_OR_TEST_ARG} + tribits_gather_enabled_items(${PACKAGE_NAME} ${LIB_OR_TEST_ARG} PACKAGES ALL_DEP_PACKAGES) - SET(EXTRA_DEP_LIBS_TMP ${${EXTRA_DEP_LIBS_INOUT}}) - TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS( + set(EXTRA_DEP_LIBS_TMP ${${EXTRA_DEP_LIBS_INOUT}}) + tribits_sort_and_append_include_and_link_dirs_and_libs( "PACKAGE" "${${PROJECT_NAME}_REVERSE_ENABLED_SE_PACKAGES}" "${ALL_DEP_PACKAGES}" "" EXTRA_DEP_LIBS_TMP) - SET(${EXTRA_DEP_LIBS_INOUT} ${EXTRA_DEP_LIBS_TMP} PARENT_SCOPE) + set(${EXTRA_DEP_LIBS_INOUT} ${EXTRA_DEP_LIBS_TMP} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # Fully process the include and link directories and list of libraries for a # package's list of dependent TPLs for use in creating a library or an # executable # -FUNCTION( TRIBITS_SORT_AND_APPEND_TPL_INCLUDE_AND_LINK_DIRS_AND_LIBS +function( tribits_sort_and_append_tpl_include_and_link_dirs_and_libs PACKAGE_NAME LIB_OR_TEST_ARG EXTRA_DEP_LIBS_INOUT ) - TRIBITS_GATHER_ENABLED_ITEMS(${PACKAGE_NAME} ${LIB_OR_TEST_ARG} + tribits_gather_enabled_items(${PACKAGE_NAME} ${LIB_OR_TEST_ARG} TPLS ALL_TPLS) - SET(EXTRA_DEP_LIBS_TMP ${${EXTRA_DEP_LIBS_INOUT}}) - TRIBITS_SORT_AND_APPEND_INCLUDE_AND_LINK_DIRS_AND_LIBS( + set(EXTRA_DEP_LIBS_TMP ${${EXTRA_DEP_LIBS_INOUT}}) + tribits_sort_and_append_include_and_link_dirs_and_libs( "TPL" "${${PROJECT_NAME}_REVERSE_ENABLED_TPLS}" "${ALL_TPLS}" TPL_ EXTRA_DEP_LIBS_TMP) - SET(${EXTRA_DEP_LIBS_INOUT} ${EXTRA_DEP_LIBS_TMP} PARENT_SCOPE) + set(${EXTRA_DEP_LIBS_INOUT} ${EXTRA_DEP_LIBS_TMP} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # Print trace of file processing # -FUNCTION(TRIBITS_TRACE_FILE_PROCESSING TYPE_IN PROCESSING_TYPE_IN FILE_PATH) +function(tribits_trace_file_processing TYPE_IN PROCESSING_TYPE_IN FILE_PATH) - IF (${PROJECT_NAME}_TRACE_FILE_PROCESSING) + if (${PROJECT_NAME}_TRACE_FILE_PROCESSING) - IF (TYPE_IN STREQUAL "PROJECT") - SET(TYPE_STR "PROJECT ") - ELSEIF (TYPE_IN STREQUAL "REPOSITORY") - SET(TYPE_STR "REPOSITORY") - ELSEIF (TYPE_IN STREQUAL "PACKAGE") - SET(TYPE_STR "PACKAGE ") - ELSEIF ("${TYPE_IN}" STREQUAL "TPL") - SET(TYPE_STR "TPL ") - ELSE() - MESSAGE(FATAL_ERROR + if (TYPE_IN STREQUAL "PROJECT") + set(TYPE_STR "PROJECT ") + elseif (TYPE_IN STREQUAL "REPOSITORY") + set(TYPE_STR "REPOSITORY") + elseif (TYPE_IN STREQUAL "PACKAGE") + set(TYPE_STR "PACKAGE ") + elseif ("${TYPE_IN}" STREQUAL "TPL") + set(TYPE_STR "TPL ") + else() + message(FATAL_ERROR "Error: TYPE_IN='${TYPE_IN}' is invalid!") - ENDIF() - - IF (PROCESSING_TYPE_IN STREQUAL "INCLUDE") - SET(PROCESSING_TYPE_STR "INCLUDE ") - ELSEIF (PROCESSING_TYPE_IN STREQUAL "ADD_SUBDIR") - SET(PROCESSING_TYPE_STR "ADD_SUBDIR") - ELSEIF (PROCESSING_TYPE_IN STREQUAL "READ") - SET(PROCESSING_TYPE_STR "READ ") - ELSEIF (PROCESSING_TYPE_IN STREQUAL "CONFIGURE") - SET(PROCESSING_TYPE_STR "CONFIGURE ") - ELSE() - MESSAGE(FATAL_ERROR + endif() + + if (PROCESSING_TYPE_IN STREQUAL "INCLUDE") + set(PROCESSING_TYPE_STR "INCLUDE ") + elseif (PROCESSING_TYPE_IN STREQUAL "ADD_SUBDIR") + set(PROCESSING_TYPE_STR "ADD_SUBDIR") + elseif (PROCESSING_TYPE_IN STREQUAL "READ") + set(PROCESSING_TYPE_STR "READ ") + elseif (PROCESSING_TYPE_IN STREQUAL "CONFIGURE") + set(PROCESSING_TYPE_STR "CONFIGURE ") + else() + message(FATAL_ERROR "Error: PROCESSING_TYPE_IN='${PROCESSING_TYPE_IN}' is invalid!") - ENDIF() + endif() - MESSAGE("-- " "File Trace: ${TYPE_STR} ${PROCESSING_TYPE_STR} ${FILE_PATH}") + message("-- " "File Trace: ${TYPE_STR} ${PROCESSING_TYPE_STR} ${FILE_PATH}") - ENDIF() + endif() -ENDFUNCTION() +endfunction() # Check to see if there are unparsed arguments after calling CMAKE_PARSE_ARGUMENTS # -MACRO(TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS) +macro(tribits_check_for_unparsed_arguments) - IF( NOT "${PARSE_UNPARSED_ARGUMENTS}" STREQUAL "") - MESSAGE( + if( NOT "${PARSE_UNPARSED_ARGUMENTS}" STREQUAL "") + message( ${${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS} "Arguments are being passed in but not used. UNPARSED_ARGUMENTS =" " ${PARSE_UNPARSED_ARGUMENTS}" ) - ENDIF() + endif() -ENDMACRO() +endmacro() # Check that a parase argument has at least one value # -MACRO(TRIBITS_ASSERT_PARSE_ARG_ONE_OR_MORE_VALUES PREFIX ARGNAME) - SET(PREFIX_ARGNAME "${PREFIX}_${ARGNAME}") - LIST( LENGTH ${PREFIX_ARGNAME} ARG_NUM_VALS ) - IF (ARG_NUM_VALS LESS 1) - MESSAGE_WRAPPER(FATAL_ERROR +macro(tribits_assert_parse_arg_one_or_more_values PREFIX ARGNAME) + set(PREFIX_ARGNAME "${PREFIX}_${ARGNAME}") + list( LENGTH ${PREFIX_ARGNAME} ARG_NUM_VALS ) + if (ARG_NUM_VALS LESS 1) + message_wrapper(FATAL_ERROR "ERROR: ${ARGNAME} must have at least one value!" ) - RETURN() + return() # NOTE: The return is needed in unit testing mode - ENDIF() -ENDMACRO() + endif() +endmacro() # Check that a parase argument has zero or one value # -MACRO(TRIBITS_ASSERT_PARSE_ARG_ZERO_OR_ONE_VALUE PREFIX ARGNAME) - SET(PREFIX_ARGNAME "${PREFIX}_${ARGNAME}") - IF (NOT "${${PREFIX_ARGNAME}}" STREQUAL "") - LIST( LENGTH ${PREFIX_ARGNAME} ARG_NUM_VALS ) - IF (ARG_NUM_VALS GREATER 1) - MESSAGE_WRAPPER(FATAL_ERROR +macro(tribits_assert_parse_arg_zero_or_one_value PREFIX ARGNAME) + set(PREFIX_ARGNAME "${PREFIX}_${ARGNAME}") + if (NOT "${${PREFIX_ARGNAME}}" STREQUAL "") + list( LENGTH ${PREFIX_ARGNAME} ARG_NUM_VALS ) + if (ARG_NUM_VALS GREATER 1) + message_wrapper(FATAL_ERROR "ERROR: ${ARGNAME}='${${PREFIX_ARGNAME}}' can not have more than one value!" ) - RETURN() + return() # NOTE: The return is needed in unit testing mode - ENDIF() - ENDIF() -ENDMACRO() + endif() + endif() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsGenerateResourceSpecFile.cmake b/cmake/tribits/core/package_arch/TribitsGenerateResourceSpecFile.cmake index c50ffab31936..88622f369114 100644 --- a/cmake/tribits/core/package_arch/TribitsGenerateResourceSpecFile.cmake +++ b/cmake/tribits/core/package_arch/TribitsGenerateResourceSpecFile.cmake @@ -41,12 +41,12 @@ # # Top-level project logic to generate resources spec file # -FUNCTION(TRIBITS_GENERATE_CTEST_RESOURCE_SPEC_FILE_PROJECT_LOGIC) - IF (${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE) - IF (CTEST_RESOURCE_SPEC_FILE STREQUAL CTEST_RESOURCE_SPEC_FILE_DEFAULT) - TRIBITS_GENERATE_CTEST_RESOURCE_SPEC_FILE() - ELSE() - MESSAGE("NOTE: The test resource file CTEST_RESOURCE_SPEC_FILE='${CTEST_RESOURCE_SPEC_FILE}'" +function(tribits_generate_ctest_resource_spec_file_project_logic) + if (${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE) + if (CTEST_RESOURCE_SPEC_FILE STREQUAL CTEST_RESOURCE_SPEC_FILE_DEFAULT) + tribits_generate_ctest_resource_spec_file() + else() + message("NOTE: The test resource file CTEST_RESOURCE_SPEC_FILE='${CTEST_RESOURCE_SPEC_FILE}'" " will not be auto-generated even through" " ${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE=${${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE}" " because its location does not match the default" @@ -55,29 +55,29 @@ FUNCTION(TRIBITS_GENERATE_CTEST_RESOURCE_SPEC_FILE_PROJECT_LOGIC) " reconfigure or create that file on your own and clear" " ${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE." ) - ENDIF() - ENDIF() -ENDFUNCTION() + endif() + endif() +endfunction() # # Generate resource spec file # -FUNCTION(TRIBITS_GENERATE_CTEST_RESOURCE_SPEC_FILE) - SET(GPUS_JSON) - MATH(EXPR LAST_GPU "${${PROJECT_NAME}_CUDA_NUM_GPUS} - 1") - SET(FIRST 1) - FOREACH(GPU RANGE 0 ${LAST_GPU}) - IF(NOT FIRST) - STRING(APPEND GPUS_JSON ",\n") - ENDIF() - SET(FIRST 0) - STRING(APPEND GPUS_JSON " { +function(tribits_generate_ctest_resource_spec_file) + set(GPUS_JSON) + math(EXPR LAST_GPU "${${PROJECT_NAME}_CUDA_NUM_GPUS} - 1") + set(FIRST 1) + foreach(GPU RANGE 0 ${LAST_GPU}) + if(NOT FIRST) + string(APPEND GPUS_JSON ",\n") + endif() + set(FIRST 0) + string(APPEND GPUS_JSON " { \"id\": \"${GPU}\", \"slots\": ${${PROJECT_NAME}_CUDA_SLOTS_PER_GPU} }") - ENDFOREACH() - FILE(WRITE "${CMAKE_BINARY_DIR}/ctest_resources.json" "{ + endforeach() + file(WRITE "${CMAKE_BINARY_DIR}/ctest_resources.json" "{ \"version\": { \"major\": 1, \"minor\": 0 @@ -91,4 +91,4 @@ ${GPUS_JSON} ] } ") -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsGetVersionDate.cmake b/cmake/tribits/core/package_arch/TribitsGetVersionDate.cmake index 679ee0bbfa95..32a40b3eadf3 100644 --- a/cmake/tribits/core/package_arch/TribitsGetVersionDate.cmake +++ b/cmake/tribits/core/package_arch/TribitsGetVersionDate.cmake @@ -3,21 +3,21 @@ include("${${PROJECT_NAME}_TRIBITS_DIR}/core/utils/TribitsStripQuotesFromStr.cma # -# @FUNCTION: TRIBITS_GET_RAW_GIT_COMMIT_UTC_TIME() +# @FUNCTION: tribits_get_raw_git_commit_utc_time() # # Get the git commit date of a repo at a given commit in UTC in the format # "2019-03-22 15:34:43 +0000" # # Usage:: # -# TRIBITS_GET_RAW_GIT_COMMIT_UTC_TIME( +# tribits_get_raw_git_commit_utc_time( # ) # # This requires find_package(Git) to have been called before calling this # function and it requires a vesrion of git of 2.10.0 or greater (because # ``git log`` must support the argument ``--date=iso-local``). # -FUNCTION(TRIBITS_GET_RAW_GIT_COMMIT_UTC_TIME repo_base_dir commit_ref +function(tribits_get_raw_git_commit_utc_time repo_base_dir commit_ref git_commit_utc_time_out ) if ("${GIT_EXECUTABLE}" STREQUAL "") @@ -59,7 +59,7 @@ endfunction() # -# @FUNCTION: TRIBITS_GET_VERSION_DATE_FROM_RAW_GIT_COMMIT_UTC_TIME() +# @FUNCTION: tribits_get_version_date_from_raw_git_commit_utc_time() # # Takes input of the form "YYYY-MM-DD hh:mm:ss +0000" from the git command:: # @@ -69,7 +69,7 @@ endfunction() # # Usage:: # -# TRIBITS_GET_VERSION_DATE_FROM_RAW_GIT_COMMIT_UTC_TIME( +# tribits_get_version_date_from_raw_git_commit_utc_time( # ""YYYY-MM-DD hh:mm:ss +0000" ) # # This returns a 10-digit integer ``YYYYMMDDhh`` that should fit in a 32-bit @@ -77,7 +77,7 @@ endfunction() # should be good until the last hour of of the last day of the last month of # the year 2147 (i.e. `2147 12 31 23` = `2147123123`). # -FUNCTION(TRIBITS_GET_VERSION_DATE_FROM_RAW_GIT_COMMIT_UTC_TIME +function(tribits_get_version_date_from_raw_git_commit_utc_time git_raw_commit_time_utc version_date_out ) # Split by spaces first " " @@ -94,12 +94,12 @@ FUNCTION(TRIBITS_GET_VERSION_DATE_FROM_RAW_GIT_COMMIT_UTC_TIME message_wrapper(FATAL_ERROR "ERROR, '${git_raw_commit_time_utc}' is NOT" " in UTC which would have offset '+0000'!") endif() - # Split YYYY-MM-DD into its componets + # Split YYYY-MM-DD into its components string(REPLACE "-" ";" YYYY_MM_DD_array "${YYYY_MM_DD}") list(GET YYYY_MM_DD_array 0 YYYY) list(GET YYYY_MM_DD_array 1 MM) list(GET YYYY_MM_DD_array 2 DD) - # Split hh:mm:ss into its componets + # Split hh:mm:ss into its components string(REPLACE ":" ";" hh_mm_ss_array "${hh_mm_ss}") list(GET hh_mm_ss_array 0 hh) # Form the full YYYYMMDDhhmm integer and return diff --git a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake index 2bf5969da123..567ce40546da 100644 --- a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -38,54 +38,53 @@ # @HEADER # Standard TriBITS system includes -INCLUDE(TribitsConstants) -INCLUDE(TribitsSetupMPI) -INCLUDE(TribitsTestCategories) -INCLUDE(TribitsGeneralMacros) -INCLUDE(TribitsAddTestHelpers) -INCLUDE(TribitsVerbosePrintVar) -INCLUDE(TribitsProcessEnabledTpl) -INCLUDE(TribitsInstallHeaders) -INCLUDE(TribitsGetVersionDate) -INCLUDE(TribitsReportInvalidTribitsUsage) -INCLUDE(TribitsReadAllProjectDepsFilesCreateDepsGraph) -INCLUDE(TribitsAdjustPackageEnables) +include(TribitsConstants) +include(TribitsSetupMPI) +include(TribitsTestCategories) +include(TribitsGeneralMacros) +include(TribitsAddTestHelpers) +include(TribitsVerbosePrintVar) +include(TribitsProcessEnabledTpl) +include(TribitsInstallHeaders) +include(TribitsGetVersionDate) +include(TribitsReportInvalidTribitsUsage) +include(TribitsReadAllProjectDepsFilesCreateDepsGraph) +include(TribitsAdjustPackageEnables) # Standard TriBITS utilities includes -INCLUDE(TribitsAddOptionAndDefine) -INCLUDE(AdvancedOption) -INCLUDE(AdvancedSet) -INCLUDE(AppendStringVar) -INCLUDE(AppendStringVarWithSep) -INCLUDE(AssertAndTouchDefined) -INCLUDE(CMakeBuildTypesList) -INCLUDE(FindListElement) -INCLUDE(GlobalNullSet) -INCLUDE(PrintNonemptyVar) -INCLUDE(PrintVar) -INCLUDE(RemoveGlobalDuplicates) -INCLUDE(Split) -INCLUDE(TimingUtils) -INCLUDE(SetDefaultAndFromEnv) # Used by some call-back files -INCLUDE(TribitsFilepathHelpers) +include(TribitsAddOptionAndDefine) +include(AdvancedOption) +include(AdvancedSet) +include(AppendStringVar) +include(AppendStringVarWithSep) +include(AssertAndTouchDefined) +include(CMakeBuildTypesList) +include(FindListElement) +include(GlobalNullSet) +include(PrintNonemptyVar) +include(PrintVar) +include(RemoveGlobalDuplicates) +include(Split) +include(TimingUtils) +include(SetDefaultAndFromEnv) # Used by some call-back files +include(TribitsFilepathHelpers) # Standard CMake includes -INCLUDE(CheckIncludeFileCXX) +include(CheckIncludeFileCXX) # Include here so it does not need to be included in each individual # FindTPL.cmake file over and over. -INCLUDE(TribitsTplFindIncludeDirsAndLibraries) -INCLUDE(TribitsTplDeclareLibraries) # Deprecated +include(TribitsTplFindIncludeDirsAndLibraries) +include(TribitsTplDeclareLibraries) # Deprecated # ABOVE: We need to include TribitsTplDeclareLibraries.cmake until all client # projects stop using it. +# Assert and setup project binary directory and other project variables # -# Assert and setup project binary directory and other project variables. -# -MACRO(TRIBITS_ASSERT_AND_SETUP_PROJECT_AND_STATIC_SYSTEM_VARS) +macro(tribits_assert_and_setup_project_and_static_system_vars) - APPEND_STRING_VAR(IN_SOURCE_ERROR_COMMON_MSG + append_string_var(IN_SOURCE_ERROR_COMMON_MSG "\nYou must now run something like:\n" " $ cd ${CMAKE_CURRENT_SOURCE_DIR}/\n" " $ rm -r CMakeCache.txt CMakeFiles/" @@ -98,16 +97,16 @@ MACRO(TRIBITS_ASSERT_AND_SETUP_PROJECT_AND_STATIC_SYSTEM_VARS) " $ cmake [OPTIONS] .." ) - IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt") - MESSAGE(FATAL_ERROR "ERROR! " + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt") + message(FATAL_ERROR "ERROR! " "The file ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt exists from a" " likely prior attempt to do an in-source build." "${IN_SOURCE_ERROR_COMMON_MSG}" ) - ENDIF() + endif() - IF ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") - MESSAGE(FATAL_ERROR "ERROR! " + if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + message(FATAL_ERROR "ERROR! " "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" " == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}" "\n${PROJECT_NAME} does not support in source builds!\n" @@ -115,96 +114,91 @@ MACRO(TRIBITS_ASSERT_AND_SETUP_PROJECT_AND_STATIC_SYSTEM_VARS) " the source directory for ${PROJECT_NAME} or you will not be able to configure ${PROJECT_NAME} correctly!" "${IN_SOURCE_ERROR_COMMON_MSG}" ) - ENDIF() - - STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) - SET(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "") - SET(PROJECT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") - PRINT_VAR(PROJECT_SOURCE_DIR) - PRINT_VAR(PROJECT_BINARY_DIR) - PRINT_VAR(${PROJECT_NAME}_TRIBITS_DIR) - PRINT_VAR(TriBITS_VERSION_STRING) + endif() + + string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) + set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "") + set(PROJECT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") + print_var(PROJECT_SOURCE_DIR) + print_var(PROJECT_BINARY_DIR) + print_var(${PROJECT_NAME}_TRIBITS_DIR) + print_var(TriBITS_VERSION_STRING) # Above, we put these in the cache so we can grep them out of the cache file # # Print some basic static info provided by CMake automatically # - PRINT_VAR(CMAKE_VERSION) - PRINT_VAR(CMAKE_GENERATOR) + print_var(CMAKE_VERSION) + print_var(CMAKE_GENERATOR) -ENDMACRO() +endmacro() -# -# Set up some really basic system variables. +# Set up some really basic system variables # # This macro needs to be called *before* the user *.cmake option files are # read in so that there is an opportunity to override these. # -MACRO(TRIBITS_SETUP_BASIC_SYSTEM_VARS) +macro(tribits_setup_basic_system_vars) # CMAKE_HOST_SYSTEM_NAME is provided by CMake automatically but can actually # be overridden in the cache. - PRINT_VAR(CMAKE_HOST_SYSTEM_NAME) + print_var(CMAKE_HOST_SYSTEM_NAME) - SITE_NAME(${PROJECT_NAME}_HOSTNAME) - MARK_AS_ADVANCED(${PROJECT_NAME}_HOSTNAME) - PRINT_VAR(${PROJECT_NAME}_HOSTNAME) + site_name(${PROJECT_NAME}_HOSTNAME) + mark_as_advanced(${PROJECT_NAME}_HOSTNAME) + print_var(${PROJECT_NAME}_HOSTNAME) # NOTE: CMAKE_HOST_SYSTEM_NAME and ${PROJECT_NAME}_HOSTNAME are used by - # TRIBITS_ADD[_ADVANCED]_TEST() to include/exclude tests based in the + # TRIBITS_ADD[_ADVANCED]_test() to include/exclude tests based in the # arguments HOSTS, XHOSTS, HOSTTYPES, AND XHOSTTYPES. -ENDMACRO() +endmacro() +# Define an option to include a file that reads in a bunch of options and read +# those files # -# Define an option to include a file that reads in a bunch of options -# -# - -MACRO(TRIBITS_READ_IN_OPTIONS_FROM_FILE) +macro(tribits_read_in_options_from_file) - SET( ${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE "" CACHE FILEPATH - "Name of an optional file that is included first to define any cmake options with SET( ... CACHE ...) calls. NOTE: paths can be separated by commas instead of semicolons but paths cannot contain commas." + set( ${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE "" CACHE FILEPATH + "Name of an optional file that is included first to define any cmake options with set( ... CACHE ...) calls. NOTE: paths can be separated by commas instead of semicolons but paths cannot contain commas." ) - SPLIT("${${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE}" "," + split("${${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE}" "," ${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE) - SET( ${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_ALL + set( ${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_ALL ${${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE} ${${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_APPEND}) - FOREACH (CONFIG_OPTS_FILE ${${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_ALL}) - MESSAGE("-- " "Reading in configuration options from ${CONFIG_OPTS_FILE} ...") - TRIBITS_TRACE_FILE_PROCESSING(PROJECT INCLUDE "${CONFIG_OPTS_FILE}") - INCLUDE(${CONFIG_OPTS_FILE}) - ENDFOREACH() + foreach (CONFIG_OPTS_FILE ${${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_ALL}) + message("-- " "Reading in configuration options from ${CONFIG_OPTS_FILE} ...") + tribits_trace_file_processing(PROJECT INCLUDE "${CONFIG_OPTS_FILE}") + include(${CONFIG_OPTS_FILE}) + endforeach() -ENDMACRO() +endmacro() -# # Assert ${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR set # correctly # +function(assert_project_set_group_and_permissions_on_install_base_dir) -FUNCTION(ASSERT_PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR) - - IF ( + if ( (NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "") AND (NOT "${${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR}" STREQUAL "") ) - TRIBITS_DIR_IS_BASEDIR( + tribits_dir_is_basedir( "${${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR}" "${CMAKE_INSTALL_PREFIX}" isBaseDir) - IF (NOT isBaseDir) - MESSAGE(FATAL_ERROR + if (NOT isBaseDir) + message(FATAL_ERROR "\n" "***\n" "*** ERROR in ${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR!\n" @@ -219,163 +213,161 @@ FUNCTION(ASSERT_PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR) "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" ) - ENDIF() - ENDIF() + endif() + endif() -ENDFUNCTION() +endfunction() -# # Define all of the standard global package architecture options. # +macro(tribits_define_global_options_and_define_extra_repos) -MACRO(TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS) - - SET( ${PROJECT_NAME}_ENABLE_ALL_PACKAGES OFF CACHE BOOL + set( ${PROJECT_NAME}_ENABLE_ALL_PACKAGES OFF CACHE BOOL "Enable all packages PT packages (ST packages as well if ${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE is true)." ) - SET(${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES ON CACHE BOOL + set(${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES ON CACHE BOOL "Recursively enable all optional packages for set of enabled packages." ) - SET( ${PROJECT_NAME}_INSTALL_EXECUTABLES ON CACHE BOOL + set( ${PROJECT_NAME}_INSTALL_EXECUTABLES ON CACHE BOOL "Enable the installation of executables provided by the ${PROJECT_NAME} packages." ) - ADVANCED_SET(${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES OFF CACHE BOOL + advanced_set(${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES OFF CACHE BOOL "Recursively enable all packages that have required or optional dependencies for set of enabled packages." ) - IF (${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES_DEFAULT STREQUAL "") - SET(${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES_DEFAULT OFF) - ENDIF() - SET(${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES + if (${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES_DEFAULT STREQUAL "") + set(${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES_DEFAULT OFF) + endif() + set(${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES ${${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES_DEFAULT} CACHE BOOL "Disable (and printing warning) for enabled packages that have hard-disabled upstream dependencies. Otherwise, is to raises a fatal configure failure." ) - SET_CACHE_ON_OFF_EMPTY( ${PROJECT_NAME}_ENABLE_TESTS "" + set_cache_on_off_empty( ${PROJECT_NAME}_ENABLE_TESTS "" "Enable tests (execs and ctest add_test()) in all packages (set to ON, OFF, or leave empty)." ) - SET_CACHE_ON_OFF_EMPTY(${PROJECT_NAME}_ENABLE_EXAMPLES "" + set_cache_on_off_empty(${PROJECT_NAME}_ENABLE_EXAMPLES "" "Enable examples (exec and ctest add_test()) in all packages (set to ON, OFF, or leave empty). If left empty, then this will be set to ON if ${PROJECT_NAME}_ENABLE_TESTS=ON" ) - SET(${PROJECT_NAME}_SKIP_CTEST_ADD_TEST OFF CACHE BOOL - "Skipp ctest add_test() for all defined tests (but still build any enabled test or example executable targets)." ) + set(${PROJECT_NAME}_SKIP_CTEST_ADD_TEST OFF CACHE BOOL + "Skip ctest add_test() for all defined tests (but still build any enabled test or example executable targets)." ) - IF (${PROJECT_NAME}_ENABLE_TESTS AND ${PROJECT_NAME}_ENABLE_EXAMPLES STREQUAL "") - MESSAGE(STATUS "Setting ${PROJECT_NAME}_ENABLE_EXAMPLES=ON because ${PROJECT_NAME}_ENABLE_TESTS=ON") - SET(${PROJECT_NAME}_ENABLE_EXAMPLES ON) - ENDIF() + if (${PROJECT_NAME}_ENABLE_TESTS AND ${PROJECT_NAME}_ENABLE_EXAMPLES STREQUAL "") + message(STATUS "Setting ${PROJECT_NAME}_ENABLE_EXAMPLES=ON because ${PROJECT_NAME}_ENABLE_TESTS=ON") + set(${PROJECT_NAME}_ENABLE_EXAMPLES ON) + endif() - ADVANCED_SET( ${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES OFF CACHE BOOL + advanced_set( ${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES OFF CACHE BOOL "Set to empty all package enables (set to OFF at end)." ) - ADVANCED_OPTION(${PROJECT_NAME}_REMOVE_DEFAULT_PACKAGE_DISABLES + advanced_option(${PROJECT_NAME}_REMOVE_DEFAULT_PACKAGE_DISABLES "Removes all default disables from the packages list. Used for testing etc." OFF ) - IF ("${${PROJECT_NAME}_ENABLE_C_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_ENABLE_C_DEFAULT ON) - ENDIF() - ADVANCED_OPTION(${PROJECT_NAME}_ENABLE_C + if ("${${PROJECT_NAME}_ENABLE_C_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_ENABLE_C_DEFAULT ON) + endif() + advanced_option(${PROJECT_NAME}_ENABLE_C "Enable the C compiler and related code" ${${PROJECT_NAME}_ENABLE_C_DEFAULT} ) - IF ("${${PROJECT_NAME}_C_Standard_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_C_Standard_DEFAULT c99) - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_C_Standard + if ("${${PROJECT_NAME}_C_Standard_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_C_Standard_DEFAULT c99) + endif() + advanced_set(${PROJECT_NAME}_C_Standard ${${PROJECT_NAME}_C_Standard_DEFAULT} CACHE STRING "The standard to use in --std= for GCC compilers." ) - IF ("${${PROJECT_NAME}_ENABLE_CXX_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_ENABLE_CXX_DEFAULT ON) - ENDIF() - ADVANCED_OPTION(${PROJECT_NAME}_ENABLE_CXX + if ("${${PROJECT_NAME}_ENABLE_CXX_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_ENABLE_CXX_DEFAULT ON) + endif() + advanced_option(${PROJECT_NAME}_ENABLE_CXX "Enable the C++ compiler and related code" ${${PROJECT_NAME}_ENABLE_CXX_DEFAULT} ) # Hard-code a variable with the same name as a now-removed option that is always enabled. # This can be removed after clients have been updated. - SET(${PROJECT_NAME}_ENABLE_CXX11 ON) + set(${PROJECT_NAME}_ENABLE_CXX11 ON) - IF ("${${PROJECT_NAME}_ENABLE_Fortran_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_ENABLE_Fortran_DEFAULT ON) - ENDIF() + if ("${${PROJECT_NAME}_ENABLE_Fortran_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_ENABLE_Fortran_DEFAULT ON) + endif() - OPTION(${PROJECT_NAME}_ENABLE_Fortran + option(${PROJECT_NAME}_ENABLE_Fortran "Enable the Fortran compiler and related code" ${${PROJECT_NAME}_ENABLE_Fortran_DEFAULT} ) - ADVANCED_OPTION(${PROJECT_NAME}_SKIP_FORTRANCINTERFACE_VERIFY_TEST + advanced_option(${PROJECT_NAME}_SKIP_FORTRANCINTERFACE_VERIFY_TEST "Skip the Fortran/C++ compatibility test" OFF ) - ADVANCED_SET( + advanced_set( ${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE "${${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE_DEFAULT}" CACHE BOOL "If TRUE, the directory and file permissions on the installed directories and files will be set to world readable. NOTE: Empty '' (the default) leaves default CMake permissions in place." ) - ADVANCED_SET( + advanced_set( ${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE "" CACHE BOOL "If TRUE, the directory and file permissions on the installed directories and files will be set to group-writable. Setting to TRUE also implies ${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE=TRUE. NOTE: Empty '' (the default) avoid adding the group write permission." ) - IF ("${${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE_DEFAULT}" STREQUAL "") - IF (${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE) - SET(${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE_DEFAULT TRUE) - ELSE() - SET(${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE_DEFAULT + if ("${${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE_DEFAULT}" STREQUAL "") + if (${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE) + set(${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE_DEFAULT TRUE) + else() + set(${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE_DEFAULT "${${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE}") - ENDIF() - ENDIF() - ADVANCED_SET( + endif() + endif() + advanced_set( ${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE "${${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE_DEFAULT}" CACHE BOOL "If TRUE, the directory and file permissions on the installed directories and files will be set to group readable. Setting ${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE=ON implies this is 'ON' as well. NOTE: Empty '' (the default) leaves default CMake permissions in place." ) - ADVANCED_SET( + advanced_set( ${PROJECT_NAME}_MAKE_INSTALL_GROUP "" CACHE STRING "If set, then the installed files and directories from ${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR on down will be given over to this owning group. The default is empty '' which means the default group will not be changed." ) - ADVANCED_SET( + advanced_set( ${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR "${CMAKE_INSTALL_PREFIX}" CACHE FILEPATH "Set the base path for which a recursive chmod and chgrp will be called to set the group and permissions after the install is complete. The default directory is give by CMAKE_INSTALL_PREFIX." ) - ASSERT_PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR() + assert_project_set_group_and_permissions_on_install_base_dir() - IF ("${${PROJECT_NAME}_SET_INSTALL_RPATH_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_SET_INSTALL_RPATH_DEFAULT TRUE) - ELSE() - SET(${PROJECT_NAME}_SET_INSTALL_RPATH_DEFAULT FALSE) - ENDIF() - ADVANCED_SET( + if ("${${PROJECT_NAME}_SET_INSTALL_RPATH_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_SET_INSTALL_RPATH_DEFAULT TRUE) + else() + set(${PROJECT_NAME}_SET_INSTALL_RPATH_DEFAULT FALSE) + endif() + advanced_set( ${PROJECT_NAME}_SET_INSTALL_RPATH ${${PROJECT_NAME}_SET_INSTALL_RPATH_DEFAULT} CACHE BOOL "If TRUE, then set RPATH on installed binaries will set to ${PROJECT_NAME}_INSTALL_LIB_DIR automatically" ) - IF ("${CMAKE_INSTALL_RPATH_USE_LINK_PATH_DEFAULT}" STREQUAL "") - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH_DEFAULT TRUE) - ELSE() - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH_DEFAULT FALSE) - ENDIF() - ADVANCED_SET( + if ("${CMAKE_INSTALL_RPATH_USE_LINK_PATH_DEFAULT}" STREQUAL "") + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH_DEFAULT TRUE) + else() + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH_DEFAULT FALSE) + endif() + advanced_set( CMAKE_INSTALL_RPATH_USE_LINK_PATH ${CMAKE_INSTALL_RPATH_USE_LINK_PATH_DEFAULT} CACHE BOOL "If set to TRUE, then the RPATH for external shared libs will be embedded in installed libs and execs." ) - ADVANCED_SET(${PROJECT_NAME}_EXTRA_LINK_FLAGS "" + advanced_set(${PROJECT_NAME}_EXTRA_LINK_FLAGS "" CACHE STRING "Extra flags added to the end of every linked executable" ) @@ -383,212 +375,212 @@ MACRO(TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS) # OpenMP is similar to a TPL in some respects, but requires only compiler # flags to enable - OPTION(${PROJECT_NAME}_ENABLE_OpenMP + option(${PROJECT_NAME}_ENABLE_OpenMP "Build with OpenMP support." OFF) - IF (CMAKE_GENERATOR STREQUAL "Ninja") - IF("${${PROJECT_NAME}_WRITE_NINJA_MAKEFILES_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_WRITE_NINJA_MAKEFILES_DEFAULT ON) - ENDIF() - SET(${PROJECT_NAME}_WRITE_NINJA_MAKEFILES + if (CMAKE_GENERATOR STREQUAL "Ninja") + if("${${PROJECT_NAME}_WRITE_NINJA_MAKEFILES_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_WRITE_NINJA_MAKEFILES_DEFAULT ON) + endif() + set(${PROJECT_NAME}_WRITE_NINJA_MAKEFILES ${${PROJECT_NAME}_WRITE_NINJA_MAKEFILES_DEFAULT} CACHE BOOL - "Generate dummy makefiles to call ninja in every bulid subdirectory (requires CMake 3.7.0 or newer)." ) - ENDIF() - IF ("${${PROJECT_NAME}_WRITE_NINJA_MAKEFILES}" STREQUAL "") - SET(${PROJECT_NAME}_WRITE_NINJA_MAKEFILES OFF) - ENDIF() + "Generate dummy makefiles to call ninja in every build subdirectory (requires CMake 3.7.0 or newer)." ) + endif() + if ("${${PROJECT_NAME}_WRITE_NINJA_MAKEFILES}" STREQUAL "") + set(${PROJECT_NAME}_WRITE_NINJA_MAKEFILES OFF) + endif() - ADVANCED_SET(${PROJECT_NAME}_PARALLEL_COMPILE_JOBS_LIMIT "" CACHE STRING + advanced_set(${PROJECT_NAME}_PARALLEL_COMPILE_JOBS_LIMIT "" CACHE STRING "If not empty '', gives an integer for the max number of object compile jobs for Ninja builds. (Default empty for no limit)") - ADVANCED_SET(${PROJECT_NAME}_PARALLEL_LINK_JOBS_LIMIT "" CACHE STRING + advanced_set(${PROJECT_NAME}_PARALLEL_LINK_JOBS_LIMIT "" CACHE STRING "If not empty '', gives an integer for the max number of lib and exe link jobs for Ninja builds. (Default empty for no limit)") - IF (CMAKE_BUILD_TYPE STREQUAL "DEBUG") - SET(${PROJECT_NAME}_ENABLE_DEBUG_DEFAULT ON) - ELSE() - SET(${PROJECT_NAME}_ENABLE_DEBUG_DEFAULT OFF) - ENDIF() - SET(${PROJECT_NAME}_ENABLE_DEBUG ${${PROJECT_NAME}_ENABLE_DEBUG_DEFAULT} CACHE BOOL + if (CMAKE_BUILD_TYPE STREQUAL "DEBUG") + set(${PROJECT_NAME}_ENABLE_DEBUG_DEFAULT ON) + else() + set(${PROJECT_NAME}_ENABLE_DEBUG_DEFAULT OFF) + endif() + set(${PROJECT_NAME}_ENABLE_DEBUG ${${PROJECT_NAME}_ENABLE_DEBUG_DEFAULT} CACHE BOOL "Enable debug checking for ${PROJECT_NAME} packages. Off by default unless CMAKE_BUILD_TYPE=\"DEBUG\"." ) - IF (${PROJECT_NAME}_ENABLE_DEBUG) - SET(${PROJECT_NAME}_ENABLE_CONFIGURE_DEBUG_DEFAULT ON) - ELSE() - SET(${PROJECT_NAME}_ENABLE_CONFIGURE_DEBUG_DEFAULT OFF) - ENDIF() - SET(${PROJECT_NAME}_ENABLE_CONFIGURE_DEBUG + if (${PROJECT_NAME}_ENABLE_DEBUG) + set(${PROJECT_NAME}_ENABLE_CONFIGURE_DEBUG_DEFAULT ON) + else() + set(${PROJECT_NAME}_ENABLE_CONFIGURE_DEBUG_DEFAULT OFF) + endif() + set(${PROJECT_NAME}_ENABLE_CONFIGURE_DEBUG ${${PROJECT_NAME}_ENABLE_CONFIGURE_DEBUG_DEFAULT} CACHE BOOL "Enable debug checking of the process which finds errors in the project's CMake files (off by default unless ${PROJECT_NAME}_ENABLE_DEBUG=ON)." ) - IF ("${${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS_DEFAULT "WARNING") - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS + if ("${${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS_DEFAULT "WARNING") + endif() + advanced_set(${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS ${${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS_DEFAULT} CACHE STRING - "Determins how unparsed arguments for TriBITS functions that use CMAKE_PARASE_ARUMENTS() internally are handled. Valid choices are 'WARNING', 'SEND_ERROR', and 'FATAL_ERROR'. The default is 'SEND_ERROR'." + "Determines how unparsed arguments for TriBITS functions that use cmake_parase_aruments() internally are handled. Valid choices are 'WARNING', 'SEND_ERROR', and 'FATAL_ERROR'. The default is 'SEND_ERROR'." ) - IF ( + if ( (NOT ${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS STREQUAL "WARNING") AND (NOT ${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS STREQUAL "SEND_ERROR") AND (NOT ${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS STREQUAL "FATAL_ERROR") ) - MESSAGE(FATAL_ERROR "Error, the value of" + message(FATAL_ERROR "Error, the value of" " ${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS =" " '${${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS}' is invalid!" " Valid valules include 'WANRING', 'SEND_ERROR', and 'FATAL_ERROR'" ) - ENDIF() + endif() - SET(${PROJECT_NAME}_ENABLE_TEUCHOS_TIME_MONITOR ON + set(${PROJECT_NAME}_ENABLE_TEUCHOS_TIME_MONITOR ON CACHE BOOL "Enable support for Teuchos Time Monitors in all Trilinos packages that support it." ) - ADVANCED_SET(${PROJECT_NAME}_SHOW_DEPRECATED_WARNINGS ON + advanced_set(${PROJECT_NAME}_SHOW_DEPRECATED_WARNINGS ON CACHE BOOL "Show warnings about deprecated code" ) - ADVANCED_SET(${PROJECT_NAME}_HIDE_DEPRECATED_CODE OFF + advanced_set(${PROJECT_NAME}_HIDE_DEPRECATED_CODE OFF CACHE BOOL "Show warnings about deprecated code" ) - ADVANCED_SET(${PROJECT_NAME}_VERBOSE_CONFIGURE OFF + advanced_set(${PROJECT_NAME}_VERBOSE_CONFIGURE OFF CACHE BOOL "Make the ${PROJECT_NAME} configure process verbose." ) - IF ("${${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT ${${PROJECT_NAME}_VERBOSE_CONFIGURE}) - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_TRACE_ADD_TEST ${${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT} + if ("${${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT ${${PROJECT_NAME}_VERBOSE_CONFIGURE}) + endif() + advanced_set(${PROJECT_NAME}_TRACE_ADD_TEST ${${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT} CACHE BOOL "Show a configure time trace of every test added or not added any why (one line)." ) - ADVANCED_OPTION(${PROJECT_NAME}_DUMP_LINK_LIBS + advanced_option(${PROJECT_NAME}_DUMP_LINK_LIBS "Dump the link libraries for every library and executable created." "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) - ADVANCED_SET(${PROJECT_NAME}_TRACE_FILE_PROCESSING + advanced_set(${PROJECT_NAME}_TRACE_FILE_PROCESSING ${${PROJECT_NAME}_VERBOSE_CONFIGURE} CACHE BOOL "Print out when all of the various files get processed." ) - ADVANCED_SET(${PROJECT_NAME}_ENABLE_EXPLICIT_INSTANTIATION ON + advanced_set(${PROJECT_NAME}_ENABLE_EXPLICIT_INSTANTIATION ON CACHE BOOL "Enable explicit template instantiation in all packages that support it" ) - ADVANCED_SET(${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE OFF + advanced_set(${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE OFF CACHE BOOL "Auto-generate a resource spec file for use with CTest." ) - ADVANCED_SET(${PROJECT_NAME}_CUDA_NUM_GPUS 1 + advanced_set(${PROJECT_NAME}_CUDA_NUM_GPUS 1 CACHE STRING "Number of GPUS to make available in the auto-generated resource spec file." ) - ADVANCED_SET(${PROJECT_NAME}_CUDA_SLOTS_PER_GPU 1 + advanced_set(${PROJECT_NAME}_CUDA_SLOTS_PER_GPU 1 CACHE STRING "Number of slots per GPU in the auto-generated resource spec file." ) - SET(CTEST_RESOURCE_SPEC_FILE_DOC_EXTRA "") - IF (${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE) - SET(CTEST_RESOURCE_SPEC_FILE_DEFAULT ${CMAKE_BINARY_DIR}/ctest_resources.json) - IF ("${CTEST_RESOURCE_SPEC_FILE}" STREQUAL "") - SET(CTEST_RESOURCE_SPEC_FILE_DOC_EXTRA + set(CTEST_RESOURCE_SPEC_FILE_DOC_EXTRA "") + if (${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE) + set(CTEST_RESOURCE_SPEC_FILE_DEFAULT ${CMAKE_BINARY_DIR}/ctest_resources.json) + if ("${CTEST_RESOURCE_SPEC_FILE}" STREQUAL "") + set(CTEST_RESOURCE_SPEC_FILE_DOC_EXTRA " This file is autogenerated by default since ${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE=${${PROJECT_NAME}_AUTOGENERATE_TEST_RESOURCE_FILE}!" ) - ENDIF() - ELSE() - SET(CTEST_RESOURCE_SPEC_FILE_DEFAULT "") - ENDIF() + endif() + else() + set(CTEST_RESOURCE_SPEC_FILE_DEFAULT "") + endif() - ADVANCED_SET(CTEST_RESOURCE_SPEC_FILE + advanced_set(CTEST_RESOURCE_SPEC_FILE "${CTEST_RESOURCE_SPEC_FILE_DEFAULT}" CACHE FILEPATH "Resource spec file for CTest.${CTEST_RESOURCE_SPEC_FILE_DOC_EXTRA}" ) - IF (USE_XSDK_DEFAULTS) + if (USE_XSDK_DEFAULTS) # Need to set BUILD_SHARED_LIBS default here based on USE_XSDK_DEFAULTS - # and not in TRIBITS_SETUP_ENV() in case there is logic in TriBITS or + # and not in tribits_setup_env() in case there is logic in TriBITS or # project-specific files that depends on this var getting set here! - SET(BUILD_SHARED_LIBS_DEFAULT TRUE) - IF ("${BUILD_SHARED_LIBS}" STREQUAL "") - MESSAGE("-- " "XSDK: Setting default BUILD_SHARED_LIBS=TRUE") - ENDIF() - ELSE() - SET(BUILD_SHARED_LIBS_DEFAULT FALSE) - ENDIF() - SET(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_DEFAULT} + set(BUILD_SHARED_LIBS_DEFAULT TRUE) + if ("${BUILD_SHARED_LIBS}" STREQUAL "") + message("-- " "XSDK: Setting default BUILD_SHARED_LIBS=TRUE") + endif() + else() + set(BUILD_SHARED_LIBS_DEFAULT FALSE) + endif() + set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_DEFAULT} CACHE BOOL "Build shared libraries or not.") - IF ("${${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS_DEFAULT FALSE) - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS + if ("${${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS_DEFAULT FALSE) + endif() + advanced_set(${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS ${${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS_DEFAULT} CACHE BOOL - "If set TRUE, then 'SYSTEM' will be passed into INCLUDE_DIRECTORIES() for TPL includes.") + "If set TRUE, then 'SYSTEM' will be passed into include_directories() for TPL includes.") - ADVANCED_SET(TPL_FIND_SHARED_LIBS ON CACHE BOOL + advanced_set(TPL_FIND_SHARED_LIBS ON CACHE BOOL "If ON, then the TPL system will find shared libs if they exist, otherwise will only find static libs." ) - ADVANCED_SET(${PROJECT_NAME}_LINK_SEARCH_START_STATIC OFF CACHE BOOL + advanced_set(${PROJECT_NAME}_LINK_SEARCH_START_STATIC OFF CACHE BOOL "If ON, then the property LINK_SEARCH_START_STATIC will be added to all executables." ) - ADVANCED_SET(${PROJECT_NAME}_LIBRARY_NAME_PREFIX "" + advanced_set(${PROJECT_NAME}_LIBRARY_NAME_PREFIX "" CACHE STRING "Prefix for all ${PROJECT_NAME} library names. If set to, for example, 'prefix_', libraries will be named and installed as 'prefix_.*'. Default is '' (no prefix)." ) - IF ("${${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS_DEFAULT FALSE) - ENDIF() - ADVANCED_SET( ${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS + if ("${${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS_DEFAULT FALSE) + endif() + advanced_set( ${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS ${${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS_DEFAULT} CACHE BOOL "If set to TRUE, then all of the TPL libs must be found for every enabled TPL." ) - IF ("${${PROJECT_NAME}_USE_GNUINSTALLDIRS_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_USE_GNUINSTALLDIRS_DEFAULT FALSE) # Maintain backward compatibility - ENDIF() - ADVANCED_SET( ${PROJECT_NAME}_USE_GNUINSTALLDIRS + if ("${${PROJECT_NAME}_USE_GNUINSTALLDIRS_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_USE_GNUINSTALLDIRS_DEFAULT FALSE) # Maintain backward compatibility + endif() + advanced_set( ${PROJECT_NAME}_USE_GNUINSTALLDIRS ${${PROJECT_NAME}_USE_GNUINSTALLDIRS_DEFAULT} CACHE BOOL "If set to TRUE, then CMake GNUInstallDris modules is used to pick standard install paths by default." ) - IF ("${${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS_DEFAULT}" STREQUAL "") + if ("${${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS_DEFAULT}" STREQUAL "") # Assume the TriBITS project wants to install headers and libraries by default - SET(${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS_DEFAULT ON) - ENDIF() + set(${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS_DEFAULT ON) + endif() - ADVANCED_SET(${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS + advanced_set(${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS ${${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS_DEFAULT} CACHE BOOL "Install libraries and headers (default is ${${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS_DEFAULT}). NOTE: Shared libraries are always installed since they are needed by executables." ) - IF ("${${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES_DEFAULT}" STREQUAL "") - IF(WIN32 AND NOT CYGWIN) - SET(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES_DEFAULT OFF) - ELSE() - SET(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES_DEFAULT ON) - ENDIF() - ENDIF() + if ("${${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES_DEFAULT}" STREQUAL "") + if(WIN32 AND NOT CYGWIN) + set(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES_DEFAULT OFF) + else() + set(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES_DEFAULT ON) + endif() + endif() - ADVANCED_SET(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES + advanced_set(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES ${${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES_DEFAULT} CACHE BOOL "Determines if export makefiles will be created and installed." @@ -596,227 +588,227 @@ MACRO(TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS) # Creating Config.cmake files is currently *very* expensive for large # TriBITS projects so we disable this by default for TriBITS. - IF ("${${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES_DEFAULT OFF) - ENDIF() + if ("${${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES_DEFAULT OFF) + endif() - ADVANCED_SET(${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES + advanced_set(${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES ${${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES_DEFAULT} CACHE BOOL "Determines if ${PROJECT_NAME}Config.cmake and Config.cmake files are created or not." ) - IF (NOT ${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT) + if (NOT ${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT) # We need to generate the dependency logic for export dependency files if # asked. - IF (${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES OR + if (${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES OR ${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES ) - SET(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT ON) - ELSE() - SET(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT OFF) - ENDIF() - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES + set(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT ON) + else() + set(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT OFF) + endif() + endif() + advanced_set(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES ${${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT} CACHE BOOL "Generate packages dependency data-structures needed for dependency export files." ) # ${PROJECT_NAME}_ELEVATE_SS_TO_PS is depreciated! - IF (${PROJECT_NAME}_ELEVATE_SS_TO_PS_DEFAULT) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "WARNING: ${PROJECT_NAME}_ELEVATE_SS_TO_PS_DEFAULT is deprecated." + if (${PROJECT_NAME}_ELEVATE_SS_TO_PS_DEFAULT) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "WARNING: ${PROJECT_NAME}_ELEVATE_SS_TO_PS_DEFAULT is deprecated." " Use ${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT instead!") - ENDIF() - SET(${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT ON) - ENDIF() - - IF ("${${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT OFF) - ENDIF() - ADVANCED_SET( ${PROJECT_NAME}_ELEVATE_ST_TO_PT + endif() + set(${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT ON) + endif() + + if ("${${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT OFF) + endif() + advanced_set( ${PROJECT_NAME}_ELEVATE_ST_TO_PT ${${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT} CACHE BOOL "Elevate all defined ST SE packages to PT packages." ) - IF ("${${PROJECT_NAME}_ENABLE_CPACK_PACKAGING_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_ENABLE_CPACK_PACKAGING_DEFAULT OFF) - ENDIF() - ADVANCED_SET( ${PROJECT_NAME}_ENABLE_CPACK_PACKAGING + if ("${${PROJECT_NAME}_ENABLE_CPACK_PACKAGING_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_ENABLE_CPACK_PACKAGING_DEFAULT OFF) + endif() + advanced_set( ${PROJECT_NAME}_ENABLE_CPACK_PACKAGING ${${PROJECT_NAME}_ENABLE_CPACK_PACKAGING_DEFAULT} CACHE BOOL "Enable support for creating a distribution using CPack" ) - IF ("${${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION_DEFAULT TRUE) - ENDIF() - ADVANCED_SET( ${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION + if ("${${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION_DEFAULT TRUE) + endif() + advanced_set( ${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION ${${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION_DEFAULT} CACHE BOOL "Excluded disabled packages from the CPack-generated distribution.") - IF ("${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE_DEFAULT OFF) - ENDIF() - ADVANCED_SET( + if ("${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE_DEFAULT OFF) + endif() + advanced_set( ${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE ${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE_DEFAULT} CACHE BOOL "Allow Secondary Tested (ST) packages and code to be implicitly enabled." ) - IF ("${${PROJECT_NAME}_TEST_CATEGORIES_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_TEST_CATEGORIES_DEFAULT NIGHTLY) - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_TEST_CATEGORIES + if ("${${PROJECT_NAME}_TEST_CATEGORIES_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_TEST_CATEGORIES_DEFAULT NIGHTLY) + endif() + advanced_set(${PROJECT_NAME}_TEST_CATEGORIES ${${PROJECT_NAME}_TEST_CATEGORIES_DEFAULT} CACHE STRING "List of categories of tests to enable: '${${PROJECT_NAME}_VALID_CATEGORIES_STR}' (default `${${PROJECT_NAME}_TEST_CATEGORIES_DEFAULT}`)." ) - TRIBITS_GET_INVALID_CATEGORIES(${PROJECT_NAME}_TEST_CATEGORIES) + tribits_get_invalid_categories(${PROJECT_NAME}_TEST_CATEGORIES) - IF ("${${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE_DEFAULT}" STREQUAL "" ) - SET(${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE_DEFAULT OFF) - ENDIF() - ADVANCED_SET( + if ("${${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE_DEFAULT}" STREQUAL "" ) + set(${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE_DEFAULT OFF) + endif() + advanced_set( ${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE ${${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE_DEFAULT} CACHE BOOL "Generate the ${PROJECT_NAME}RepoVersion.txt file.") - IF ("${${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT OFF) - ENDIF() - ADVANCED_SET( + if ("${${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT OFF) + endif() + advanced_set( ${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES ${${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT} CACHE BOOL "Generate VersionDate.cmake and _version_date.h files.") - IF ("${DART_TESTING_TIMEOUT_DEFAULT}" STREQUAL "") - SET(DART_TESTING_TIMEOUT_DEFAULT 1500) - ENDIF() - ADVANCED_SET( + if ("${DART_TESTING_TIMEOUT_DEFAULT}" STREQUAL "") + set(DART_TESTING_TIMEOUT_DEFAULT 1500) + endif() + advanced_set( DART_TESTING_TIMEOUT ${DART_TESTING_TIMEOUT_DEFAULT} CACHE STRING "Raw CMake/CTest global default test timeout (default 1500). (NOTE: Does not impact timeouts of tests that have the TIMEOUT property set on a test-by-test basis.)" ) # NOTE: 1500 is the CMake default set in Modules/CTest.cmake. We need to # set the default here because we need to be able to scale it correctly in - # case the user does not explicilty set this var in the cache. + # case the user does not explicitly set this var in the cache. - ADVANCED_SET(${PROJECT_NAME}_SCALE_TEST_TIMEOUT 1.0 CACHE STRING + advanced_set(${PROJECT_NAME}_SCALE_TEST_TIMEOUT 1.0 CACHE STRING "Scale factor for global DART_TESTING_TIMEOUT and individual test TIMEOUT (default 1.0)." ) - # NOTE: This value is 1.0, *NOT* 1! This is used in TRIBITS_SCALE_TIMEOUT() + # NOTE: This value is 1.0, *NOT* 1! This is used in tribits_scale_timeout() # and there are unit tests that rely on this default! - ADVANCED_SET(${PROJECT_NAME}_REL_CPU_SPEED 1.0 CACHE STRING + advanced_set(${PROJECT_NAME}_REL_CPU_SPEED 1.0 CACHE STRING "Relative CPU speed of the computer used to scale performance tests (default 1.0)." ) - IF ("${${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT ON) - ENDIF() - ADVANCED_SET( ${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE + if ("${${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT ON) + endif() + advanced_set( ${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE ${${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT} CACHE BOOL "Determines if a variety of development mode checks are turned on by default or not." ) - ADVANCED_SET( ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES + advanced_set( ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES ${${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE} CACHE BOOL "Determines if asserts are performed on missing packages or not." ) - IF ("${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT}" STREQUAL "") - IF (${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE) - SET(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT FATAL_ERROR) - ELSE() - SET(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT IGNORE) - ENDIF() - ENDIF() - ADVANCED_SET( ${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE + if ("${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT}" STREQUAL "") + if (${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE) + set(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT FATAL_ERROR) + else() + set(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT IGNORE) + endif() + endif() + advanced_set( ${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE "${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT}" CACHE BOOL "Assert correct usage of TriBITS. Value values include 'FATAL_ERROR', 'SEND_ERROR', 'WARNING', and 'IGNORE'. Default '${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT}' " ) - ADVANCED_SET( ${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES + advanced_set( ${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES FALSE CACHE BOOL "If set to TRUE, a 'NOTE' is printed for each missing package that is ignored." ) - ADVANCED_SET( ${PROJECT_NAME}_ENABLE_STRONG_C_COMPILE_WARNINGS + advanced_set( ${PROJECT_NAME}_ENABLE_STRONG_C_COMPILE_WARNINGS ${${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE} CACHE BOOL "Enable strong compiler warnings for C code for supported compilers." ) - ADVANCED_SET( ${PROJECT_NAME}_ENABLE_STRONG_CXX_COMPILE_WARNINGS + advanced_set( ${PROJECT_NAME}_ENABLE_STRONG_CXX_COMPILE_WARNINGS ${${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE} CACHE BOOL "Enable strong compiler warnings for C++ code for supported compilers." ) - MULTILINE_SET( ENABLE_SHADOW_WARNINGS_DOC + multiline_set( ENABLE_SHADOW_WARNINGS_DOC "Turn ON or OFF shadowing warnings for all packages where strong warnings have" " not been explicitly disabled. Setting the empty '' let's each package decide." ) - SET_CACHE_ON_OFF_EMPTY( ${PROJECT_NAME}_ENABLE_SHADOW_WARNINGS "" + set_cache_on_off_empty( ${PROJECT_NAME}_ENABLE_SHADOW_WARNINGS "" "${ENABLE_SHADOW_WARNINGS_DOC}" ) - MARK_AS_ADVANCED(${PROJECT_NAME}_ENABLE_SHADOW_WARNINGS) + mark_as_advanced(${PROJECT_NAME}_ENABLE_SHADOW_WARNINGS) - ADVANCED_SET( ${PROJECT_NAME}_ENABLE_COVERAGE_TESTING OFF + advanced_set( ${PROJECT_NAME}_ENABLE_COVERAGE_TESTING OFF CACHE BOOL "Enable support for coverage testing by setting needed compiler/linker options." ) - ADVANCED_SET( ${PROJECT_NAME}_ENABLE_CHECKED_STL OFF + advanced_set( ${PROJECT_NAME}_ENABLE_CHECKED_STL OFF CACHE BOOL "Turn on checked STL checking (e.g. -D_GLIBCXX_DEBUG) or not." ) - ADVANCED_SET( ${PROJECT_NAME}_ENABLE_DEBUG_SYMBOLS OFF + advanced_set( ${PROJECT_NAME}_ENABLE_DEBUG_SYMBOLS OFF CACHE BOOL "Turn on debugging symbols (e.g. -g) or not if not a full debug build." ) - IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - SET(${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS_DEFAULT "-Werror") - ELSE() - SET(${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS_DEFAULT "") - ENDIF() + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS_DEFAULT "-Werror") + else() + set(${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS_DEFAULT "") + endif() - ADVANCED_SET( ${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS + advanced_set( ${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS "${${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS_DEFAULT}" CACHE STRING "Flags for treating warnings as errors (for all compilers, -Werror by default for GNU). To turn off warnings as errors set to ''") - ADVANCED_SET(${PROJECT_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE OFF CACHE BOOL + advanced_set(${PROJECT_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE OFF CACHE BOOL "If test output complaining about circular references is found, then the test will fail." ) - ADVANCED_SET(${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR "" + advanced_set(${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR "" CACHE FILEPATH "If set to non-null, this is the default directory where package dependency files will be written.") - IF (${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR) - SET(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE_DEFAULT + if (${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR) + set(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE_DEFAULT "${${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR}/${${PROJECT_NAME}_PACKAGE_DEPS_XML_FILE_NAME}") - ELSE() - SET(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE_DEFAULT "") - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE + else() + set(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE_DEFAULT "") + endif() + advanced_set(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE "${${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE_DEFAULT}" CACHE STRING "Output XML file containing ${PROJECT_NAME} dependenices used by tools (if not empty)." ) - IF(${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR AND + if(${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR AND ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE AND PYTHON_EXECUTABLE ) - SET(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE_DEFAULT + set(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE_DEFAULT "${${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR}/${${PROJECT_NAME}_CDASH_SUBPROJECT_DEPS_XML_FILE_NAME}" ) - ELSE() - SET(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE_DEFAULT "") - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE + else() + set(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE_DEFAULT "") + endif() + advanced_set(${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE "${${PROJECT_NAME}_CDASH_DEPS_XML_OUTPUT_FILE_DEFAULT}" CACHE STRING "Output XML file used by CDash in ${PROJECT_NAME}-independent format (if not empty)." ) - IF(${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR AND + if(${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR AND ${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE AND PYTHON_EXECUTABLE ) - SET(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE_DEFAULT + set(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE_DEFAULT "${${PROJECT_NAME}_DEPS_DEFAULT_OUTPUT_DIR}/${${PROJECT_NAME}_PACKAGE_DEPS_TABLE_HTML_FILE_NAME}" ) - ELSE() - SET(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE_DEFAULT "") - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE + else() + set(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE_DEFAULT "") + endif() + advanced_set(${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE "${${PROJECT_NAME}_DEPS_HTML_OUTPUT_FILE_DEFAULT}" CACHE STRING "HTML ${PROJECT_NAME} dependenices file that will be written to (if not empty)." ) @@ -825,31 +817,31 @@ MACRO(TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS) # Extra repositories # - ASSERT_DEFINED(${PROJECT_NAME}_EXTRA_EXTERNAL_REPOS_FILE_NAME) + assert_defined(${PROJECT_NAME}_EXTRA_EXTERNAL_REPOS_FILE_NAME) - SET(DEFAULT_EXTRA_REPOS_FILE + set(DEFAULT_EXTRA_REPOS_FILE "${PROJECT_SOURCE_DIR}/cmake/${${PROJECT_NAME}_EXTRA_EXTERNAL_REPOS_FILE_NAME}") - IF (EXISTS ${DEFAULT_EXTRA_REPOS_FILE}) - #MESSAGE("${DEFAULT_EXTRA_REPOS_FILE} does exist!") - SET(${PROJECT_NAME}_EXTRAREPOS_FILE_DEFAULT ${DEFAULT_EXTRA_REPOS_FILE}) - ELSE() - #MESSAGE("${DEFAULT_EXTRA_REPOS_FILE} does *NOT* exist!") - SET(${PROJECT_NAME}_EXTRAREPOS_FILE_DEFAULT) - ENDIF() + if (EXISTS ${DEFAULT_EXTRA_REPOS_FILE}) + #message("${DEFAULT_EXTRA_REPOS_FILE} does exist!") + set(${PROJECT_NAME}_EXTRAREPOS_FILE_DEFAULT ${DEFAULT_EXTRA_REPOS_FILE}) + else() + #message("${DEFAULT_EXTRA_REPOS_FILE} does *NOT* exist!") + set(${PROJECT_NAME}_EXTRAREPOS_FILE_DEFAULT) + endif() - ADVANCED_SET(${PROJECT_NAME}_EXTRAREPOS_FILE + advanced_set(${PROJECT_NAME}_EXTRAREPOS_FILE "${${PROJECT_NAME}_EXTRAREPOS_FILE_DEFAULT}" CACHE STRING "File containing the list of extra repositories containing add-on packages to process") - #PRINT_VAR(${PROJECT_NAME}_EXTRAREPOS_FILE) + #print_var(${PROJECT_NAME}_EXTRAREPOS_FILE) - ADVANCED_SET(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE + advanced_set(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE "" CACHE STRING "Type of testing to pull in extra repositories (Continuous, or Nightly)" ) - ADVANCED_SET(${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES + advanced_set(${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES FALSE CACHE BOOL "Set if to ignore missing extra repositories (or fail hard)" ) @@ -857,27 +849,27 @@ MACRO(TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS) # support extra repositories defined by the user by the very nature of # Tribits. - ADVANCED_SET(${PROJECT_NAME}_PRE_REPOSITORIES + advanced_set(${PROJECT_NAME}_PRE_REPOSITORIES "" CACHE STRING "List of pre-extra repositories that contain extra ${PROJECT_NAME} packages." ) - SPLIT("${${PROJECT_NAME}_PRE_REPOSITORIES}" "," ${PROJECT_NAME}_PRE_REPOSITORIES) + split("${${PROJECT_NAME}_PRE_REPOSITORIES}" "," ${PROJECT_NAME}_PRE_REPOSITORIES) - ADVANCED_SET(${PROJECT_NAME}_EXTRA_REPOSITORIES + advanced_set(${PROJECT_NAME}_EXTRA_REPOSITORIES "" CACHE STRING "List of post-extra repositories that contain extra ${PROJECT_NAME} packages." ) - SPLIT("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" "," ${PROJECT_NAME}_EXTRA_REPOSITORIES) + split("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" "," ${PROJECT_NAME}_EXTRA_REPOSITORIES) - IF ("${${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST}" STREQUAL "") - SET(${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST TRUE) - ENDIF() + if ("${${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST}" STREQUAL "") + set(${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST TRUE) + endif() - TRIBITS_GET_AND_PROCESS_EXTRA_REPOSITORIES_LISTS() + tribits_get_and_process_extra_repositories_lists() - ADVANCED_SET(${PROJECT_NAME}_INSTALLATION_DIR + advanced_set(${PROJECT_NAME}_INSTALLATION_DIR "" CACHE STRING "Location of an installed version of ${PROJECT_NAME} that will be built against during installation testing" ) @@ -886,118 +878,118 @@ MACRO(TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS) # More options # - IF("${${PROJECT_NAME}_INSTALLATION_DIR}" STREQUAL "") - SET(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING_DEFAULT OFF) - ELSE() - SET(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING_DEFAULT ON) - ENDIF() + if("${${PROJECT_NAME}_INSTALLATION_DIR}" STREQUAL "") + set(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING_DEFAULT OFF) + else() + set(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING_DEFAULT ON) + endif() - ADVANCED_SET(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING + advanced_set(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING ${${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING_DEFAULT} CACHE STRING "Enable testing against an installed version of ${PROJECT_NAME}." ) - ADVANCED_OPTION(${PROJECT_NAME}_SHORTCIRCUIT_AFTER_DEPENDENCY_HANDLING + advanced_option(${PROJECT_NAME}_SHORTCIRCUIT_AFTER_DEPENDENCY_HANDLING "Short-circuit after dependency handling is complete" OFF ) - ADVANCED_OPTION(${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY + advanced_option(${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY "Only trace dependency handling. Don't configure to build anything!" OFF ) - ADVANCED_SET(${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING + advanced_set(${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING FALSE CACHE BOOL "Set to 'ON' to see configure times (Unix/Linux systems only)" ) - ADVANCED_SET(${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING + advanced_set(${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING FALSE CACHE BOOL "Set to 'ON' to see configure times for individual packages" ) - IF ("${${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME_DEFAULT}" + if ("${${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME_DEFAULT}" STREQUAL "" ) - SET(${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME_DEFAULT OFF) - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME + set(${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME_DEFAULT OFF) + endif() + advanced_set(${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME ${${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME_DEFAULT} CACHE BOOL "Set to 'ON' to see start and end date/time for advanced tests." ) - IF ("${${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST_DEFAULT}" + if ("${${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST_DEFAULT}" STREQUAL "" ) - SET(${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST_DEFAULT OFF) - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST + set(${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST_DEFAULT OFF) + endif() + advanced_set(${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST ${${PROJECT_NAME}_SHOW_MACHINE_LOAD_IN_TEST_DEFAULT} CACHE BOOL "Set to 'ON' to see the machine load for advanced tests." ) - MARK_AS_ADVANCED(BUILD_TESTING) - MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY) - MARK_AS_ADVANCED(DART_TESTING_TIMEOUT) - MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH) - MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH) - MARK_AS_ADVANCED(CMAKE_OSX_ARCHITECTURES) - MARK_AS_ADVANCED(CMAKE_OSX_SYSROOT) + mark_as_advanced(BUILD_TESTING) + mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY) + mark_as_advanced(DART_TESTING_TIMEOUT) + mark_as_advanced(EXECUTABLE_OUTPUT_PATH) + mark_as_advanced(LIBRARY_OUTPUT_PATH) + mark_as_advanced(CMAKE_OSX_ARCHITECTURES) + mark_as_advanced(CMAKE_OSX_SYSROOT) -ENDMACRO() +endmacro() -MACRO(TRIBITS_SETUP_INSTALLATION_PATHS) +macro(tribits_setup_installation_paths) # # A) Determine if we are going to be using default paths from GNUInstallDirs module # - SET(TRIBITS_USE_GNUINSTALLDIRS TRUE) + set(TRIBITS_USE_GNUINSTALLDIRS TRUE) - IF (NOT ${PROJECT_NAME}_USE_GNUINSTALLDIRS) + if (NOT ${PROJECT_NAME}_USE_GNUINSTALLDIRS) # For backward compatibility and unit testing - SET(TRIBITS_USE_GNUINSTALLDIRS FALSE) - ENDIF() + set(TRIBITS_USE_GNUINSTALLDIRS FALSE) + endif() # # B) Pick the defaults for the install dirs # - IF (TRIBITS_USE_GNUINSTALLDIRS) - INCLUDE(GNUInstallDirs) - SET(${PROJECT_NAME}_INSTALL_INCLUDE_DIR_DEFAULT ${CMAKE_INSTALL_INCLUDEDIR}) - SET(${PROJECT_NAME}_INSTALL_LIB_DIR_DEFAULT ${CMAKE_INSTALL_LIBDIR}) - SET(${PROJECT_NAME}_INSTALL_RUNTIME_DIR_DEFAULT ${CMAKE_INSTALL_BINDIR}) - SET(${PROJECT_NAME}_INSTALL_EXAMPLE_DIR_DEFAULT "example") - ELSE() - SET(${PROJECT_NAME}_INSTALL_INCLUDE_DIR_DEFAULT "include") - SET(${PROJECT_NAME}_INSTALL_LIB_DIR_DEFAULT "lib") - SET(${PROJECT_NAME}_INSTALL_RUNTIME_DIR_DEFAULT "bin") - SET(${PROJECT_NAME}_INSTALL_EXAMPLE_DIR_DEFAULT "example") - ENDIF() + if (TRIBITS_USE_GNUINSTALLDIRS) + include(GNUInstallDirs) + set(${PROJECT_NAME}_INSTALL_INCLUDE_DIR_DEFAULT ${CMAKE_INSTALL_INCLUDEDIR}) + set(${PROJECT_NAME}_INSTALL_LIB_DIR_DEFAULT ${CMAKE_INSTALL_LIBDIR}) + set(${PROJECT_NAME}_INSTALL_RUNTIME_DIR_DEFAULT ${CMAKE_INSTALL_BINDIR}) + set(${PROJECT_NAME}_INSTALL_EXAMPLE_DIR_DEFAULT "example") + else() + set(${PROJECT_NAME}_INSTALL_INCLUDE_DIR_DEFAULT "include") + set(${PROJECT_NAME}_INSTALL_LIB_DIR_DEFAULT "lib") + set(${PROJECT_NAME}_INSTALL_RUNTIME_DIR_DEFAULT "bin") + set(${PROJECT_NAME}_INSTALL_EXAMPLE_DIR_DEFAULT "example") + endif() # # C) Set the cache variables for the install dirs # - ADVANCED_SET( ${PROJECT_NAME}_INSTALL_INCLUDE_DIR + advanced_set( ${PROJECT_NAME}_INSTALL_INCLUDE_DIR ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR_DEFAULT} CACHE PATH "Location where the headers will be installed. If given as a STRING type and relative path, it will be relative to ${CMAKE_INSTALL_PREFIX}. If given as an absolute path, it will used as such. Default is 'include'" ) - ADVANCED_SET( ${PROJECT_NAME}_INSTALL_LIB_DIR + advanced_set( ${PROJECT_NAME}_INSTALL_LIB_DIR ${${PROJECT_NAME}_INSTALL_LIB_DIR_DEFAULT} CACHE PATH "Location where the libraries will be installed. If given as a STRING type relative path, it will be relative to ${CMAKE_INSTALL_PREFIX}. If given as an absolute path, it will used as such. Default is 'lib'" ) - ADVANCED_SET( ${PROJECT_NAME}_INSTALL_RUNTIME_DIR + advanced_set( ${PROJECT_NAME}_INSTALL_RUNTIME_DIR ${${PROJECT_NAME}_INSTALL_RUNTIME_DIR_DEFAULT} CACHE PATH "Location where the runtime DLLs and designated programs will be installed. If given as a STRING type relative path, it will be relative to ${CMAKE_INSTALL_PREFIX}. If given as an absolute path, it will used as such. Default is 'bin'" ) - ADVANCED_SET(${PROJECT_NAME}_INSTALL_EXAMPLE_DIR + advanced_set(${PROJECT_NAME}_INSTALL_EXAMPLE_DIR ${${PROJECT_NAME}_INSTALL_EXAMPLE_DIR_DEFAULT} CACHE PATH "Location where assorted examples will be installed. If given as a STRING type relative path, it will be relative to ${CMAKE_INSTALL_PREFIX}. If given as an absolute path, it will used as such. Default is 'example'" @@ -1007,84 +999,84 @@ MACRO(TRIBITS_SETUP_INSTALLATION_PATHS) # D) Setup RPATH handling # - PRINT_VAR(${PROJECT_NAME}_SET_INSTALL_RPATH) - PRINT_VAR(CMAKE_INSTALL_RPATH_USE_LINK_PATH) + print_var(${PROJECT_NAME}_SET_INSTALL_RPATH) + print_var(CMAKE_INSTALL_RPATH_USE_LINK_PATH) - IF (${PROJECT_NAME}_SET_INSTALL_RPATH) - IF ("${CMAKE_INSTALL_RPATH}" STREQUAL "") - MESSAGE("-- " "Setting default for CMAKE_INSTALL_RPATH pointing to ${PROJECT_NAME}_INSTALL_LIB_DIR") - ASSERT_DEFINED(CMAKE_INSTALL_PREFIX) - ASSERT_DEFINED(${PROJECT_NAME}_INSTALL_LIB_DIR) - IF (IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_LIB_DIR}) - SET(CMAKE_INSTALL_RPATH + if (${PROJECT_NAME}_SET_INSTALL_RPATH) + if ("${CMAKE_INSTALL_RPATH}" STREQUAL "") + message("-- " "Setting default for CMAKE_INSTALL_RPATH pointing to ${PROJECT_NAME}_INSTALL_LIB_DIR") + assert_defined(CMAKE_INSTALL_PREFIX) + assert_defined(${PROJECT_NAME}_INSTALL_LIB_DIR) + if (IS_ABSOLUTE ${${PROJECT_NAME}_INSTALL_LIB_DIR}) + set(CMAKE_INSTALL_RPATH "${PROJECT_NAME}_INSTALL_LIB_DIR}" ) - ELSE() - SET(CMAKE_INSTALL_RPATH + else() + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}" ) - ENDIF() - ENDIF() - IF (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") - IF ("${CMAKE_MACOSX_RPATH}" STREQUAL "") - MESSAGE("-- " "Setting default CMAKE_MACOSX_RPATH=TRUE") - SET(CMAKE_MACOSX_RPATH TRUE) - ENDIF() - PRINT_VAR(CMAKE_MACOSX_RPATH) - ENDIF() - ENDIF() - STRING(REPLACE ":" ";" CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}") - PRINT_VAR(CMAKE_INSTALL_RPATH) + endif() + endif() + if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + if ("${CMAKE_MACOSX_RPATH}" STREQUAL "") + message("-- " "Setting default CMAKE_MACOSX_RPATH=TRUE") + set(CMAKE_MACOSX_RPATH TRUE) + endif() + print_var(CMAKE_MACOSX_RPATH) + endif() + endif() + string(REPLACE ":" ";" CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}") + print_var(CMAKE_INSTALL_RPATH) # # E) Set permissions on created installation directories # - IF ( + if ( (NOT "${${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE}" STREQUAL "") OR (NOT "${${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE}" STREQUAL "") ) - PRINT_VAR(${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE) - PRINT_VAR(${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE) + print_var(${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE) + print_var(${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE) # Group permissions - IF (${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE + if (${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE OR ${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE ) - SET(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_GROUP + set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_GROUP GROUP_READ GROUP_EXECUTE) - ELSE() - SET(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_GROUP) # Empty - ENDIF() + else() + set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_GROUP) # Empty + endif() # World permissions - IF (${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE) - SET(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_WORLD + if (${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE) + set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_WORLD WORLD_READ WORLD_EXECUTE) - ELSE() - SET(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_WORLD) # Empty - ENDIF() + else() + set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_WORLD) # Empty + endif() # Directory permissions - SET(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE ${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_GROUP} ${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_WORLD} ) # Print the permissions in a way that allows for strong testing - STRING(REPLACE ";" " " CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_W_SPACES + string(REPLACE ";" " " CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_W_SPACES "${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}" ) - MESSAGE("-- " "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS = " + message("-- " "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS = " "(${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS_W_SPACES})") - ENDIF() + endif() -ENDMACRO() +endmacro() # -# Repository specializaiton call-back functions +# Macros to process repository specializaiton call-back functions # # NOTE: The Tribits system promises to only include these call-back files once # (in order) and to only the call call-back macros they provide once (in @@ -1092,119 +1084,119 @@ ENDMACRO() # -MACRO(CREATE_EMPTY_TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS) - MACRO(TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS) - ENDMACRO() -ENDMACRO() +macro(create_empty_tribits_repository_setup_extra_options) + macro(tribits_repository_setup_extra_options) + endmacro() +endmacro() -MACRO(TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS_RUNNER REPO_NAME) - SET(CALLBACK_SETUP_EXTRA_OPTIONS_FILE +macro(tribits_repository_setup_extra_options_runner REPO_NAME) + set(CALLBACK_SETUP_EXTRA_OPTIONS_FILE "${${REPO_NAME}_SOURCE_DIR}/cmake/CallbackSetupExtraOptions.cmake") - #PRINT_VAR(CALLBACK_SETUP_EXTRA_OPTIONS_FILE) - IF (EXISTS ${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Processing call-back file and macros in" + #print_var(CALLBACK_SETUP_EXTRA_OPTIONS_FILE) + if (EXISTS ${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing call-back file and macros in" " '${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}'") - ENDIF() + endif() # Define the callback macros as empty in case it is not defined # in this file. - CREATE_EMPTY_TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS() + create_empty_tribits_repository_setup_extra_options() # Include the file which will define the callback macros - SET(REPOSITORY_NAME ${REPO_NAME}) - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE + set(REPOSITORY_NAME ${REPO_NAME}) + tribits_trace_file_processing(REPOSITORY INCLUDE "${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}") - INCLUDE(${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}) + include(${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}) # Call the callback macros to inject repository-specific behavir - TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS() + tribits_repository_setup_extra_options() # Set back the callback macros to empty to ensure that nonone calls them - CREATE_EMPTY_TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS() - ENDIF() -ENDMACRO() + create_empty_tribits_repository_setup_extra_options() + endif() +endmacro() -MACRO(CREATE_EMPTY_TRIBITS_REPOSITORY_DEFINE_PACKAGING) - MACRO(TRIBITS_REPOSITORY_DEFINE_PACKAGING) - ENDMACRO() -ENDMACRO() +macro(create_empty_tribits_repository_define_packaging) + macro(tribits_repository_define_packaging) + endmacro() +endmacro() -MACRO(TRIBITS_REPOSITORY_DEFINE_PACKAGING_RUNNER REPO_NAME) - SET(CALLBACK_DEFINE_PACKAGING_FILE +macro(tribits_repository_define_packaging_runner REPO_NAME) + set(CALLBACK_DEFINE_PACKAGING_FILE "${${REPO_NAME}_SOURCE_DIR}/cmake/CallbackDefineRepositoryPackaging.cmake") - #PRINT_VAR(CALLBACK_DEFINE_PACKAGING_FILE) - IF (EXISTS ${CALLBACK_DEFINE_PACKAGING_FILE}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Processing call-back file and macros in" + #print_var(CALLBACK_DEFINE_PACKAGING_FILE) + if (EXISTS ${CALLBACK_DEFINE_PACKAGING_FILE}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing call-back file and macros in" " '${CALLBACK_DEFINE_PACKAGING_FILE}'") - ENDIF() + endif() # Define the callback macros as empty in case it is not defined # in this file. - CREATE_EMPTY_TRIBITS_REPOSITORY_DEFINE_PACKAGING() + create_empty_tribits_repository_define_packaging() # Include the file which will define the callback macros - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE + tribits_trace_file_processing(REPOSITORY INCLUDE "${CALLBACK_DEFINE_PACKAGING_FILE}") - INCLUDE(${CALLBACK_DEFINE_PACKAGING_FILE}) + include(${CALLBACK_DEFINE_PACKAGING_FILE}) # Call the callback macros to inject repository-specific behavir - TRIBITS_REPOSITORY_DEFINE_PACKAGING() + tribits_repository_define_packaging() # Set back the callback macros to empty to ensure that nonone calls them - CREATE_EMPTY_TRIBITS_REPOSITORY_DEFINE_PACKAGING() - ENDIF() -ENDMACRO() + create_empty_tribits_repository_define_packaging() + endif() +endmacro() -MACRO(CREATE_EMPTY_TRIBITS_PROJECT_DEFINE_PACKAGING) - MACRO(TRIBITS_PROJECT_DEFINE_PACKAGING) - ENDMACRO() -ENDMACRO() +macro(create_empty_tribits_project_define_packaging) + macro(tribits_project_define_packaging) + endmacro() +endmacro() -MACRO(TRIBITS_PROJECT_DEFINE_PACKAGING_RUNNER) - SET(CALLBACK_DEFINE_PACKAGING_FILE +macro(tribits_project_define_packaging_runner) + set(CALLBACK_DEFINE_PACKAGING_FILE "${PROJECT_SOURCE_DIR}/cmake/CallbackDefineProjectPackaging.cmake") - #PRINT_VAR(CALLBACK_DEFINE_PACKAGING_FILE) - IF (EXISTS ${CALLBACK_DEFINE_PACKAGING_FILE}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Processing call-back file and macros in" + #print_var(CALLBACK_DEFINE_PACKAGING_FILE) + if (EXISTS ${CALLBACK_DEFINE_PACKAGING_FILE}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing call-back file and macros in" " '${CALLBACK_DEFINE_PACKAGING_FILE}'") - ENDIF() + endif() # Define the callback macros as empty in case it is not defined # in this file. - CREATE_EMPTY_TRIBITS_PROJECT_DEFINE_PACKAGING() + create_empty_tribits_project_define_packaging() # Include the file which will define the callback macros - TRIBITS_TRACE_FILE_PROCESSING(PROJECT INCLUDE + tribits_trace_file_processing(PROJECT INCLUDE "${CALLBACK_DEFINE_PACKAGING_FILE}") - INCLUDE(${CALLBACK_DEFINE_PACKAGING_FILE}) + include(${CALLBACK_DEFINE_PACKAGING_FILE}) # Call the callback macros to inject project-specific behavir - TRIBITS_PROJECT_DEFINE_PACKAGING() + tribits_project_define_packaging() # Set back the callback macros to empty to ensure that nonone calls them - CREATE_EMPTY_TRIBITS_PROJECT_DEFINE_PACKAGING() - ENDIF() -ENDMACRO() + create_empty_tribits_project_define_packaging() + endif() +endmacro() # Read in the Project's native repositories. # # On output, the variable ${PRJOECT_NAME}_NATIVE_REPOSITORIES is set. # -MACRO(TRIBITS_READ_IN_NATIVE_REPOSITORIES) - IF (${PROJECT_NAME}_NATIVE_REPO_FILE_OVERRRIDE) - IF (IS_ABSOLUTE ${${PROJECT_NAME}_NATIVE_REPO_FILE_OVERRRIDE}) - SET(NATIVE_REPO_FILE ${${PROJECT_NAME}_NATIVE_REPO_FILE_OVERRRIDE}) - ELSE() - SET(NATIVE_REPO_FILE +macro(tribits_read_in_native_repositories) + if (${PROJECT_NAME}_NATIVE_REPO_FILE_OVERRRIDE) + if (IS_ABSOLUTE ${${PROJECT_NAME}_NATIVE_REPO_FILE_OVERRRIDE}) + set(NATIVE_REPO_FILE ${${PROJECT_NAME}_NATIVE_REPO_FILE_OVERRRIDE}) + else() + set(NATIVE_REPO_FILE ${PROJECT_SOURCE_DIR}/${${PROJECT_NAME}_NATIVE_REPO_FILE_OVERRRIDE}) - ENDIF() - ELSE() - SET(NATIVE_REPO_FILE ${PROJECT_SOURCE_DIR}/cmake/NativeRepositoriesList.cmake) - ENDIF() - IF (EXISTS ${NATIVE_REPO_FILE}) - TRIBITS_TRACE_FILE_PROCESSING(PROJECT INCLUDE "${NATIVE_REPO_FILE}") - INCLUDE(${NATIVE_REPO_FILE}) - ELSE() - SET(${PROJECT_NAME}_NATIVE_REPOSITORIES ".") - ENDIF() -ENDMACRO() + endif() + else() + set(NATIVE_REPO_FILE ${PROJECT_SOURCE_DIR}/cmake/NativeRepositoriesList.cmake) + endif() + if (EXISTS ${NATIVE_REPO_FILE}) + tribits_trace_file_processing(PROJECT INCLUDE "${NATIVE_REPO_FILE}") + include(${NATIVE_REPO_FILE}) + else() + set(${PROJECT_NAME}_NATIVE_REPOSITORIES ".") + endif() +endmacro() # Combine native and extra repos lists into a single list. @@ -1213,64 +1205,64 @@ ENDMACRO() # ${PROJECT_NAME}_NATIVE_REPOSITORIES and ${PROJECT_NAME}_EXTRA_REPOSITORIES # into a single list ${PROJECT_NAME}_ALL_REPOSITORIES. # -MACRO(TRIBITS_COMBINE_NATIVE_AND_EXTRA_REPOS) - ASSERT_DEFINED(${PROJECT_NAME}_PRE_REPOSITORIES) - ASSERT_DEFINED(${PROJECT_NAME}_NATIVE_REPOSITORIES) - ASSERT_DEFINED(${PROJECT_NAME}_EXTRA_REPOSITORIES) - SET( ${PROJECT_NAME}_ALL_REPOSITORIES +macro(tribits_combine_native_and_extra_repos) + assert_defined(${PROJECT_NAME}_PRE_REPOSITORIES) + assert_defined(${PROJECT_NAME}_NATIVE_REPOSITORIES) + assert_defined(${PROJECT_NAME}_EXTRA_REPOSITORIES) + set( ${PROJECT_NAME}_ALL_REPOSITORIES ${${PROJECT_NAME}_PRE_REPOSITORIES} ${${PROJECT_NAME}_NATIVE_REPOSITORIES} ${${PROJECT_NAME}_EXTRA_REPOSITORIES} ) -ENDMACRO() +endmacro() # Process extra repo extra options files # -MACRO(TRIBITS_PROCESS_EXTRA_REPOS_OPTIONS_FILES) +macro(tribits_process_extra_repos_options_files) # Loop through the Repositories, set their base directories and run their # options setup callback functions. - FOREACH(REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) - TRIBITS_GET_REPO_NAME_DIR(${REPO} REPO_NAME REPO_DIR) - TRIBITS_SET_BASE_REPO_DIR(${PROJECT_SOURCE_DIR} ${REPO_DIR} ${REPO_NAME}_SOURCE_DIR) - TRIBITS_SET_BASE_REPO_DIR(${PROJECT_BINARY_DIR} ${REPO_DIR} ${REPO_NAME}_BINARY_DIR) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Processing extra options call-backs for ${REPO}") - PRINT_VAR(${REPO_NAME}_SOURCE_DIR) - PRINT_VAR(${REPO_NAME}_BINARY_DIR) - ENDIF() - TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS_RUNNER(${REPO_NAME}) - ENDFOREACH() -ENDMACRO() + foreach(REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) + tribits_get_repo_name_dir(${REPO} REPO_NAME REPO_DIR) + tribits_set_base_repo_dir(${PROJECT_SOURCE_DIR} ${REPO_DIR} ${REPO_NAME}_SOURCE_DIR) + tribits_set_base_repo_dir(${PROJECT_BINARY_DIR} ${REPO_DIR} ${REPO_NAME}_BINARY_DIR) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing extra options call-backs for ${REPO}") + print_var(${REPO_NAME}_SOURCE_DIR) + print_var(${REPO_NAME}_BINARY_DIR) + endif() + tribits_repository_setup_extra_options_runner(${REPO_NAME}) + endforeach() +endmacro() # Copy an simple text file to the binary dir to be included in the tarball # -MACRO(TRIBITS_COPY_INSTALLER_RESOURCE _varname _source _destination) - SET("${_varname}" "${_destination}") - IF (EXISTS "${_destination}") - FILE(REMOVE_RECURSE "${_destination}") +macro(tribits_copy_installer_resource _varname _source _destination) + set("${_varname}" "${_destination}") + if (EXISTS "${_destination}") + file(REMOVE_RECURSE "${_destination}") ENDIF () - CONFIGURE_FILE( + configure_file( "${_source}" "${_destination}" COPYONLY) -ENDMACRO() +endmacro() -# Run the git log command to get the verison info for a git rep +# Run the git log command to get the version info for a git repo # -FUNCTION(TRIBITS_GENERATE_SINGLE_REPO_VERSION_STRING GIT_REPO_DIR +function(tribits_generate_single_repo_version_string GIT_REPO_DIR SINGLE_REPO_VERSION_STRING_OUT ) - IF (NOT GIT_EXECUTABLE) - MESSAGE(SEND_ERROR "ERROR, the program '${GIT_NAME}' could not be found!" + if (NOT GIT_EXECUTABLE) + message(SEND_ERROR "ERROR, the program '${GIT_NAME}' could not be found!" " We can not generate the repo version file!") - ENDIF() + endif() # A) Get the basic version info. - EXECUTE_PROCESS( + execute_process( COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:"%h [%ad] <%ae>" WORKING_DIRECTORY ${GIT_REPO_DIR} RESULT_VARIABLE GIT_RETURN @@ -1280,269 +1272,256 @@ FUNCTION(TRIBITS_GENERATE_SINGLE_REPO_VERSION_STRING GIT_REPO_DIR # command. However, git will put those quotes in the output so we have to # strip them out later :-( - IF (NOT GIT_RETURN STREQUAL 0) - MESSAGE(FATAL_ERROR "ERROR, ${GIT_EXECUTABLE} command returned ${GIT_RETURN}!=0" + if (NOT GIT_RETURN STREQUAL 0) + message(FATAL_ERROR "ERROR, ${GIT_EXECUTABLE} command returned ${GIT_RETURN}!=0" " for extra repo ${GIT_REPO_DIR}!") - SET(GIT_VERSION_INFO "Error, could not get version info!") - ELSE() + set(GIT_VERSION_INFO "Error, could not get version info!") + else() # Strip the quotes off :-( - STRING(LENGTH "${GIT_OUTPUT}" GIT_OUTPUT_LEN) - MATH(EXPR OUTPUT_NUM_CHARS_TO_KEEP "${GIT_OUTPUT_LEN}-2") - STRING(SUBSTRING "${GIT_OUTPUT}" 1 ${OUTPUT_NUM_CHARS_TO_KEEP} + string(LENGTH "${GIT_OUTPUT}" GIT_OUTPUT_LEN) + math(EXPR OUTPUT_NUM_CHARS_TO_KEEP "${GIT_OUTPUT_LEN}-2") + string(SUBSTRING "${GIT_OUTPUT}" 1 ${OUTPUT_NUM_CHARS_TO_KEEP} GIT_VERSION_INFO) - ENDIF() + endif() # B) Get the first 80 chars of the summary message for more info - EXECUTE_PROCESS( + execute_process( COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:"%s" WORKING_DIRECTORY ${GIT_REPO_DIR} RESULT_VARIABLE GIT_RETURN OUTPUT_VARIABLE GIT_OUTPUT ) - IF (NOT GIT_RETURN STREQUAL 0) - MESSAGE(FATAL_ERROR "ERROR, ${GIT_EXECUTABLE} command returned ${GIT_RETURN}!=0" + if (NOT GIT_RETURN STREQUAL 0) + message(FATAL_ERROR "ERROR, ${GIT_EXECUTABLE} command returned ${GIT_RETURN}!=0" " for extra repo ${GIT_REPO_DIR}!") - SET(GIT_VERSION_SUMMARY "Error, could not get version summary!") - ELSE() + set(GIT_VERSION_SUMMARY "Error, could not get version summary!") + else() # Strip ouf quotes and quote the 80 char string - SET(MAX_SUMMARY_LEN 80) - MATH(EXPR MAX_SUMMARY_LEN_PLUS_2 "${MAX_SUMMARY_LEN}+2") - STRING(LENGTH "${GIT_OUTPUT}" GIT_OUTPUT_LEN) - MATH(EXPR OUTPUT_NUM_CHARS_TO_KEEP "${GIT_OUTPUT_LEN}-2") - STRING(SUBSTRING "${GIT_OUTPUT}" 1 ${OUTPUT_NUM_CHARS_TO_KEEP} + set(MAX_SUMMARY_LEN 80) + math(EXPR MAX_SUMMARY_LEN_PLUS_2 "${MAX_SUMMARY_LEN}+2") + string(LENGTH "${GIT_OUTPUT}" GIT_OUTPUT_LEN) + math(EXPR OUTPUT_NUM_CHARS_TO_KEEP "${GIT_OUTPUT_LEN}-2") + string(SUBSTRING "${GIT_OUTPUT}" 1 ${OUTPUT_NUM_CHARS_TO_KEEP} GIT_OUTPUT_STRIPPED) - IF (GIT_OUTPUT_LEN GREATER ${MAX_SUMMARY_LEN_PLUS_2}) - STRING(SUBSTRING "${GIT_OUTPUT_STRIPPED}" 0 ${MAX_SUMMARY_LEN} + if (GIT_OUTPUT_LEN GREATER ${MAX_SUMMARY_LEN_PLUS_2}) + string(SUBSTRING "${GIT_OUTPUT_STRIPPED}" 0 ${MAX_SUMMARY_LEN} GIT_SUMMARY_STR) - ELSE() - SET(GIT_SUMMARY_STR "${GIT_OUTPUT_STRIPPED}") - ENDIF() - ENDIF() + else() + set(GIT_SUMMARY_STR "${GIT_OUTPUT_STRIPPED}") + endif() + endif() - SET(${SINGLE_REPO_VERSION_STRING_OUT} + set(${SINGLE_REPO_VERSION_STRING_OUT} "${GIT_VERSION_INFO}\n${GIT_SUMMARY_STR}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() -# # Get the versions of all the git repos # +function(tribits_generate_repo_version_file_string PROJECT_REPO_VERSION_FILE_STRING_OUT) -FUNCTION(TRIBITS_GENERATE_REPO_VERSION_FILE_STRING PROJECT_REPO_VERSION_FILE_STRING_OUT) - - SET(REPO_VERSION_FILE_STR "") + set(REPO_VERSION_FILE_STR "") - TRIBITS_GENERATE_SINGLE_REPO_VERSION_STRING( + tribits_generate_single_repo_version_string( ${CMAKE_CURRENT_SOURCE_DIR} SINGLE_REPO_VERSION) - APPEND_STRING_VAR(REPO_VERSION_FILE_STR + append_string_var(REPO_VERSION_FILE_STR "*** Base Git Repo: ${PROJECT_NAME}\n" "${SINGLE_REPO_VERSION}\n" ) - SET(EXTRAREPO_IDX 0) - FOREACH(EXTRA_REPO ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}) + set(EXTRAREPO_IDX 0) + foreach(EXTRA_REPO ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}) - #PRINT_VAR(EXTRA_REPO) - #PRINT_VAR(EXTRAREPO_IDX) - #PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) + #print_var(EXTRA_REPO) + #print_var(EXTRAREPO_IDX) + #print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) - IF (${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) + if (${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) # Read from an extra repo file with potentially different dir. - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_IDX} EXTRAREPO_DIR ) - ELSE() + else() # Not read from extra repo file so dir is same as name - SET(EXTRAREPO_DIR ${EXTRA_REPO}) - ENDIF() - #PRINT_VAR(EXTRAREPO_DIR) + set(EXTRAREPO_DIR ${EXTRA_REPO}) + endif() + #print_var(EXTRAREPO_DIR) - TRIBITS_GENERATE_SINGLE_REPO_VERSION_STRING( + tribits_generate_single_repo_version_string( "${CMAKE_CURRENT_SOURCE_DIR}/${EXTRAREPO_DIR}" SINGLE_REPO_VERSION) - APPEND_STRING_VAR(REPO_VERSION_FILE_STR + append_string_var(REPO_VERSION_FILE_STR "*** Git Repo: ${EXTRAREPO_DIR}\n" "${SINGLE_REPO_VERSION}\n" ) - #PRINT_VAR(REPO_VERSION_FILE_STR) + #print_var(REPO_VERSION_FILE_STR) - MATH(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") + math(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") - ENDFOREACH() + endforeach() - SET(${PROJECT_REPO_VERSION_FILE_STRING_OUT} ${REPO_VERSION_FILE_STR} PARENT_SCOPE) + set(${PROJECT_REPO_VERSION_FILE_STRING_OUT} ${REPO_VERSION_FILE_STR} PARENT_SCOPE) -ENDFUNCTION() +endfunction() -# # Generate the project repos version file and print to stdout # # This function is designed so that it can be unit tested from inside of a # cmake -P script. # - -FUNCTION(TRIBITS_GENERATE_REPO_VERSION_OUTPUT_AND_FILE) +function(tribits_generate_repo_version_output_and_file) # Get the repos versions - TRIBITS_GENERATE_REPO_VERSION_FILE_STRING(PROJECT_REPO_VERSION_FILE_STRING) + tribits_generate_repo_version_file_string(PROJECT_REPO_VERSION_FILE_STRING) # Print the versions - MESSAGE("\n${PROJECT_NAME} repos versions:\n" + message("\n${PROJECT_NAME} repos versions:\n" "--------------------------------------------------------------------------------\n" "${PROJECT_REPO_VERSION_FILE_STRING}" " --------------------------------------------------------------------------------\n" ) #) Write out the version file - FILE(WRITE + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}" "${PROJECT_REPO_VERSION_FILE_STRING}") -ENDFUNCTION() +endfunction() -# -# Create project dependencies file and create install target +# Create project dependencies file and create install target for these # # NOTE: Before calling this function, the extra repos datastructure must be # filled out! # -# NOTE: This function can not be called in a cmake -P script because it has a -# call to INSTALL()! That is why this function is seprated out from -# TRIBITS_GENERATE_REPO_VERSION_OUTPUT_AND_FILE(). +# NOTE: This function cannot be called in a cmake -P script because it has a +# call to install()! That is why this function is separated out from +# tribits_generate_repo_version_output_and_file(). # - -FUNCTION(TRIBITS_GENERATE_REPO_VERSION_OUTPUT_AND_FILE_AND_INSTALL) +function(tribits_generate_repo_version_output_and_file_and_install) # # A) Create the ${PROJECT_NAME}RepoVersion.txt file if requested # - IF (${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE) + if (${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE) # A) Make sure that there is a .git dir in the project before generating - IF (EXISTS "${PROJECT_SOURCE_DIR}/.git") - SET(PROJECT_SOURCE_IS_GIT_REPO TRUE) - ELSE() - SET(PROJECT_SOURCE_IS_GIT_REPO FALSE) - ENDIF() - IF (PROJECT_SOURCE_IS_GIT_REPO) + if (EXISTS "${PROJECT_SOURCE_DIR}/.git") + set(PROJECT_SOURCE_IS_GIT_REPO TRUE) + else() + set(PROJECT_SOURCE_IS_GIT_REPO FALSE) + endif() + if (PROJECT_SOURCE_IS_GIT_REPO) # Get repo versions, print to stdout and write file - TRIBITS_GENERATE_REPO_VERSION_OUTPUT_AND_FILE() + tribits_generate_repo_version_output_and_file() # Add install target for this file - INSTALL( + install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}" DESTINATION "." ) - ELSE() - MESSAGE("\nNOTE: Skipping generation of ${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}" + else() + message("\nNOTE: Skipping generation of ${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}" " because project source is not a git repo!") - ENDIF() + endif() # B) Install the repo version file if it is in source tree which it will - # be for a tarball (see TRIBITS_SETUP_PACKAGING_AND_DISTRIBUTION()). - SET(REPO_VERSION_FILE_IN_SOURCE_TREE + # be for a tarball (see tribits_setup_packaging_and_distribution()). + set(REPO_VERSION_FILE_IN_SOURCE_TREE ${CMAKE_CURRENT_SOURCE_DIR}/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}) - IF (EXISTS ${REPO_VERSION_FILE_IN_SOURCE_TREE}) - INSTALL( + if (EXISTS ${REPO_VERSION_FILE_IN_SOURCE_TREE}) + install( FILES "${REPO_VERSION_FILE_IN_SOURCE_TREE}" DESTINATION "." ) - ENDIF() - - ENDIF() + endif() + endif() -ENDFUNCTION() +endfunction() -# # Print out a list with white-space separators with an initial doc string # -FUNCTION(TRIBITS_PRINT_PREFIX_STRING_AND_LIST DOCSTRING LIST_TO_PRINT) - STRING(REPLACE ";" " " LIST_TO_PRINT_STR "${LIST_TO_PRINT}") - LIST(LENGTH LIST_TO_PRINT NUM_ELEMENTS) - IF (NUM_ELEMENTS GREATER "0") - MESSAGE("${DOCSTRING}: ${LIST_TO_PRINT_STR} ${NUM_ELEMENTS}") - ELSE() - MESSAGE("${DOCSTRING}: ${NUM_ELEMENTS}") - ENDIF() -ENDFUNCTION() +function(tribits_print_prefix_string_and_list DOCSTRING LIST_TO_PRINT) + string(REPLACE ";" " " LIST_TO_PRINT_STR "${LIST_TO_PRINT}") + list(LENGTH LIST_TO_PRINT NUM_ELEMENTS) + if (NUM_ELEMENTS GREATER "0") + message("${DOCSTRING}: ${LIST_TO_PRINT_STR} ${NUM_ELEMENTS}") + else() + message("${DOCSTRING}: ${NUM_ELEMENTS}") + endif() +endfunction() +# Print the current set of enabled/disabled packages given input list of +# packages # -# Function that prints the current set of enabled/disabled packages given -# input list of packages. -# -FUNCTION(TRIBITS_PRINT_ENABLED_PACKAGES_LIST_FROM_VAR PACKAGES_LIST_VAR +function(tribits_print_enabled_packages_list_from_var PACKAGES_LIST_VAR DOCSTRING ENABLED_FLAG INCLUDE_EMPTY ) - IF (ENABLED_FLAG AND NOT INCLUDE_EMPTY) - TRIBITS_GET_ENABLED_LIST(${PACKAGES_LIST_VAR} ${PROJECT_NAME} + if (ENABLED_FLAG AND NOT INCLUDE_EMPTY) + tribits_get_enabled_list(${PACKAGES_LIST_VAR} ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) - ELSEIF (ENABLED_FLAG AND INCLUDE_EMPTY) - TRIBITS_GET_NONDISABLED_LIST(${PACKAGES_LIST_VAR} ${PROJECT_NAME} + elseif (ENABLED_FLAG AND INCLUDE_EMPTY) + tribits_get_nondisabled_list(${PACKAGES_LIST_VAR} ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) - ELSEIF (NOT ENABLED_FLAG AND NOT INCLUDE_EMPTY) - TRIBITS_GET_DISABLED_LIST(${PACKAGES_LIST_VAR} ${PROJECT_NAME} + elseif (NOT ENABLED_FLAG AND NOT INCLUDE_EMPTY) + tribits_get_disabled_list(${PACKAGES_LIST_VAR} ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) - ELSE() # NOT ENABLED_FLAG AND INCLUDE_EMPTY - TRIBITS_GET_NONENABLED_LIST(${PACKAGES_LIST_VAR} ${PROJECT_NAME} + else() # NOT ENABLED_FLAG AND INCLUDE_EMPTY + tribits_get_nonenabled_list(${PACKAGES_LIST_VAR} ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) - ENDIF() - TRIBITS_PRINT_PREFIX_STRING_AND_LIST("${DOCSTRING}" "${ENABLED_PACKAGES}") -ENDFUNCTION() + endif() + tribits_print_prefix_string_and_list("${DOCSTRING}" "${ENABLED_PACKAGES}") +endfunction() +# Prints the current set of enabled/disabled packages # -# Function that prints the current set of enabled/disabled packages -# -FUNCTION(TRIBITS_PRINT_ENABLED_PACKAGE_LIST DOCSTRING ENABLED_FLAG INCLUDE_EMPTY) - TRIBITS_PRINT_ENABLED_PACKAGES_LIST_FROM_VAR( ${PROJECT_NAME}_PACKAGES +function(tribits_print_enabled_package_list DOCSTRING ENABLED_FLAG INCLUDE_EMPTY) + tribits_print_enabled_packages_list_from_var( ${PROJECT_NAME}_PACKAGES "${DOCSTRING}" ${ENABLED_FLAG} ${INCLUDE_EMPTY} ) -ENDFUNCTION() +endfunction() +# Prints the current set of enabled/disabled SE packages # -# Function that prints the current set of enabled/disabled SE packages -# -FUNCTION(TRIBITS_PRINT_ENABLED_SE_PACKAGE_LIST DOCSTRING ENABLED_FLAG INCLUDE_EMPTY) - IF (ENABLED_FLAG AND NOT INCLUDE_EMPTY) - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} +function(tribits_print_enabled_se_package_list DOCSTRING ENABLED_FLAG INCLUDE_EMPTY) + if (ENABLED_FLAG AND NOT INCLUDE_EMPTY) + tribits_get_enabled_list( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} ENABLED_SE_PACKAGES NUM_ENABLED) - ELSEIF (ENABLED_FLAG AND INCLUDE_EMPTY) - TRIBITS_GET_NONDISABLED_LIST( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} + elseif (ENABLED_FLAG AND INCLUDE_EMPTY) + tribits_get_nondisabled_list( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} ENABLED_SE_PACKAGES NUM_ENABLED) - ELSEIF (NOT ENABLED_FLAG AND NOT INCLUDE_EMPTY) - TRIBITS_GET_DISABLED_LIST( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} + elseif (NOT ENABLED_FLAG AND NOT INCLUDE_EMPTY) + tribits_get_disabled_list( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} ENABLED_SE_PACKAGES NUM_ENABLED) - ELSE() # NOT ENABLED_FLAG AND INCLUDE_EMPTY - TRIBITS_GET_NONENABLED_LIST( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} + else() # NOT ENABLED_FLAG AND INCLUDE_EMPTY + tribits_get_nonenabled_list( ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME} ENABLED_SE_PACKAGES NUM_ENABLED) - ENDIF() - TRIBITS_PRINT_PREFIX_STRING_AND_LIST("${DOCSTRING}" "${ENABLED_SE_PACKAGES}") -ENDFUNCTION() + endif() + tribits_print_prefix_string_and_list("${DOCSTRING}" "${ENABLED_SE_PACKAGES}") +endfunction() +# Print the current set of enabled/disabled TPLs # -# Function that prints the current set of enabled/disabled TPLs -# -FUNCTION(TRIBITS_PRINT_ENABLED_TPL_LIST DOCSTRING ENABLED_FLAG INCLUDE_EMPTY) - IF (ENABLED_FLAG AND NOT INCLUDE_EMPTY) - TRIBITS_GET_ENABLED_LIST( ${PROJECT_NAME}_TPLS TPL +function(tribits_print_enabled_tpl_list DOCSTRING ENABLED_FLAG INCLUDE_EMPTY) + if (ENABLED_FLAG AND NOT INCLUDE_EMPTY) + tribits_get_enabled_list( ${PROJECT_NAME}_TPLS TPL ENABLED_TPLS NUM_ENABLED) - ELSEIF (ENABLED_FLAG AND INCLUDE_EMPTY) - TRIBITS_GET_NONDISABLED_LIST( ${PROJECT_NAME}_TPLS TPL + elseif (ENABLED_FLAG AND INCLUDE_EMPTY) + tribits_get_nondisabled_list( ${PROJECT_NAME}_TPLS TPL ENABLED_TPLS NUM_ENABLED) - ELSEIF (NOT ENABLED_FLAG AND NOT INCLUDE_EMPTY) - TRIBITS_GET_DISABLED_LIST( ${PROJECT_NAME}_TPLS TPL + elseif (NOT ENABLED_FLAG AND NOT INCLUDE_EMPTY) + tribits_get_disabled_list( ${PROJECT_NAME}_TPLS TPL ENABLED_TPLS NUM_ENABLED) - ELSE() # NOT ENABLED_FLAG AND INCLUDE_EMPTY - TRIBITS_GET_NONENABLED_LIST( ${PROJECT_NAME}_TPLS TPL + else() # NOT ENABLED_FLAG AND INCLUDE_EMPTY + tribits_get_nonenabled_list( ${PROJECT_NAME}_TPLS TPL ENABLED_TPLS NUM_ENABLED) - ENDIF() - TRIBITS_PRINT_PREFIX_STRING_AND_LIST("${DOCSTRING}" "${ENABLED_TPLS}") -ENDFUNCTION() + endif() + tribits_print_prefix_string_and_list("${DOCSTRING}" "${ENABLED_TPLS}") +endfunction() -# # Adjust package enable logic and print out before and after state # # On output sets: @@ -1551,64 +1530,62 @@ ENDFUNCTION() # ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}: Enable status of PACKAGE_NAME (local variable) # ToDo: Fill in others as well! # -MACRO(TRIBITS_ADJUST_AND_PRINT_PACKAGE_DEPENDENCIES) +macro(tribits_adjust_and_print_package_dependencies) - TRIBITS_CONFIG_CODE_START_TIMER(ADJUST_PACKAGE_DEPS_TIME_START_SECONDS) + tribits_config_code_start_timer(ADJUST_PACKAGE_DEPS_TIME_START_SECONDS) - TRIBITS_PRINT_ENABLED_PACKAGE_LIST( + tribits_print_enabled_package_list( "\nExplicitly enabled packages on input (by user)" ON FALSE) - TRIBITS_PRINT_ENABLED_SE_PACKAGE_LIST( + tribits_print_enabled_se_package_list( "\nExplicitly enabled SE packages on input (by user)" ON FALSE) - TRIBITS_PRINT_ENABLED_PACKAGE_LIST( + tribits_print_enabled_package_list( "\nExplicitly disabled packages on input (by user or by default)" OFF FALSE) - TRIBITS_PRINT_ENABLED_SE_PACKAGE_LIST( + tribits_print_enabled_se_package_list( "\nExplicitly disabled SE packages on input (by user or by default)" OFF FALSE) - TRIBITS_PRINT_ENABLED_TPL_LIST( + tribits_print_enabled_tpl_list( "\nExplicitly enabled TPLs on input (by user)" ON FALSE) - TRIBITS_PRINT_ENABLED_TPL_LIST( + tribits_print_enabled_tpl_list( "\nExplicitly disabled TPLs on input (by user or by default)" OFF FALSE) - TRIBITS_ADJUST_PACKAGE_ENABLES() + tribits_adjust_package_enables() - TRIBITS_PRINT_PREFIX_STRING_AND_LIST( + tribits_print_prefix_string_and_list( "\nFinal set of enabled packages" "${${PROJECT_NAME}_ENABLED_PACKAGES}") - TRIBITS_PRINT_PREFIX_STRING_AND_LIST( + tribits_print_prefix_string_and_list( "\nFinal set of enabled SE packages" "${${PROJECT_NAME}_ENABLED_SE_PACKAGES}") - TRIBITS_PRINT_ENABLED_PACKAGE_LIST( + tribits_print_enabled_package_list( "\nFinal set of non-enabled packages" OFF TRUE) - TRIBITS_PRINT_ENABLED_SE_PACKAGE_LIST( + tribits_print_enabled_se_package_list( "\nFinal set of non-enabled SE packages" OFF TRUE) - TRIBITS_PRINT_ENABLED_TPL_LIST( + tribits_print_enabled_tpl_list( "\nFinal set of enabled TPLs" ON FALSE) - TRIBITS_PRINT_ENABLED_TPL_LIST( + tribits_print_enabled_tpl_list( "\nFinal set of non-enabled TPLs" OFF TRUE) - TRIBITS_SET_UP_ENABLED_ONLY_DEPENDENCIES() + tribits_set_up_enabled_only_dependencies() - TRIBITS_CONFIG_CODE_STOP_TIMER(ADJUST_PACKAGE_DEPS_TIME_START_SECONDS + tribits_config_code_stop_timer(ADJUST_PACKAGE_DEPS_TIME_START_SECONDS "\nTotal time to adjust package and TPL enables") -ENDMACRO() +endmacro() +# Gather information from enabled TPLs # -# Macro that gathers information from enabled TPLs -# - -MACRO(TRIBITS_PROCESS_ENABLED_TPLS) +macro(tribits_process_enabled_tpls) - TRIBITS_CONFIG_CODE_START_TIMER(CONFIGURE_TPLS_TIME_START_SECONDS) + tribits_config_code_start_timer(CONFIGURE_TPLS_TIME_START_SECONDS) - FOREACH(TPL_NAME ${${PROJECT_NAME}_TPLS}) - IF (TPL_ENABLE_${TPL_NAME}) - TRIBITS_PROCESS_ENABLED_TPL(${TPL_NAME}) - ENDIF() - ENDFOREACH() + foreach(TPL_NAME ${${PROJECT_NAME}_TPLS}) + if (TPL_ENABLE_${TPL_NAME}) + tribits_process_enabled_tpl(${TPL_NAME}) + endif() + endforeach() - TRIBITS_CONFIG_CODE_STOP_TIMER(CONFIGURE_TPLS_TIME_START_SECONDS + tribits_config_code_stop_timer(CONFIGURE_TPLS_TIME_START_SECONDS "\nTotal time to configure enabled TPLs") -ENDMACRO() +endmacro() # @@ -1616,202 +1593,202 @@ ENDMACRO() # -MACRO(TRIBITS_SETUP_ENV) +macro(tribits_setup_env) - TRIBITS_CONFIG_CODE_START_TIMER(SETUP_ENV_TIME_START_SECONDS) + tribits_config_code_start_timer(SETUP_ENV_TIME_START_SECONDS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - SET(TRIBITS_SETUP_ENV_DEBUG TRUE) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + set(TRIBITS_SETUP_ENV_DEBUG TRUE) + endif() # Apply XSDK defaults - IF ("${${PROJECT_NAME}_TRIBITS_XSDK_DIR}" STREQUAL "") - SET(${PROJECT_NAME}_TRIBITS_XSDK_DIR "${${PROJECT_NAME}_TRIBITS_DIR}/xsdk") - ENDIF() - IF (EXISTS "${${PROJECT_NAME}_TRIBITS_XSDK_DIR}") - SET(USE_XSDK_DEFAULTS_DEFAULT FALSE) # Set to TRUE for Trilinos 13.0.0? - SET(XSDK_ENABLE_C ${${PROJECT_NAME}_ENABLE_C}) - SET(XSDK_ENABLE_CXX ${${PROJECT_NAME}_ENABLE_CXX}) - SET(XSDK_ENABLE_Fortran ${${PROJECT_NAME}_ENABLE_Fortran}) - INCLUDE("${${PROJECT_NAME}_TRIBITS_XSDK_DIR}/XSDKDefaults.cmake") + if ("${${PROJECT_NAME}_TRIBITS_XSDK_DIR}" STREQUAL "") + set(${PROJECT_NAME}_TRIBITS_XSDK_DIR "${${PROJECT_NAME}_TRIBITS_DIR}/xsdk") + endif() + if (EXISTS "${${PROJECT_NAME}_TRIBITS_XSDK_DIR}") + set(USE_XSDK_DEFAULTS_DEFAULT FALSE) # Set to TRUE for Trilinos 13.0.0? + set(XSDK_ENABLE_C ${${PROJECT_NAME}_ENABLE_C}) + set(XSDK_ENABLE_CXX ${${PROJECT_NAME}_ENABLE_CXX}) + set(XSDK_ENABLE_Fortran ${${PROJECT_NAME}_ENABLE_Fortran}) + include("${${PROJECT_NAME}_TRIBITS_XSDK_DIR}/XSDKDefaults.cmake") # NOTE: BUILD_SHARED_LIBS was set in - # TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS() based on + # tribits_define_global_options_and_define_extra_repos() based on # USE_XSDK_DEFAULTS in case there is logic in TriBITS that depends on this # var getting set there. - ENDIF() + endif() # BUILD_SHARED_LIBS - PRINT_VAR(BUILD_SHARED_LIBS) + print_var(BUILD_SHARED_LIBS) # Set to release build by default - IF ("${CMAKE_BUILD_TYPE}" STREQUAL "") - MESSAGE(STATUS "Setting CMAKE_BUILD_TYPE=RELEASE since it was not set ...") - SET(CMAKE_BUILD_TYPE RELEASE CACHE STRING + if ("${CMAKE_BUILD_TYPE}" STREQUAL "") + message(STATUS "Setting CMAKE_BUILD_TYPE=RELEASE since it was not set ...") + set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "Type of build to perform (i.e. DEBUG, RELEASE, NONE)" ) - ELSE() - STRING(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UP) - LIST(FIND CMAKE_BUILD_TYPES_LIST ${CMAKE_BUILD_TYPE_UP} BUILD_TYPE_IDX) - IF (BUILD_TYPE_IDX EQUAL -1) - MESSAGE(SEND_ERROR "Error, the given CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" + else() + string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UP) + list(FIND CMAKE_BUILD_TYPES_LIST ${CMAKE_BUILD_TYPE_UP} BUILD_TYPE_IDX) + if (BUILD_TYPE_IDX EQUAL -1) + message(SEND_ERROR "Error, the given CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" " is not in the list of valid values \"${CMAKE_BUILD_TYPES_LIST}\"!") - ENDIF() - ENDIF() - PRINT_VAR(CMAKE_BUILD_TYPE) + endif() + endif() + print_var(CMAKE_BUILD_TYPE) # Override the silly CMAKE_CONFIGURATION_TYPES variable. This is needed for # MSVS! Later, we Override CMAKE_CONFIGURATION_TYPES to just one # configuration after the compiler checks (see below). - IF (CMAKE_CONFIGURATION_TYPES) - IF (CMAKE_BUILD_TYPE STREQUAL "DEBUG") - SET(CMAKE_CONFIGURATION_TYPE "Debug") - ELSEIF(CMAKE_BUILD_TYPE STREQUAL "RELEASE") - SET(CMAKE_CONFIGURATION_TYPE "Release") - ELSE() - SET(CMAKE_CONFIGURATION_TYPE "Release") - ENDIF() - ELSE() - SET(CMAKE_CONFIGURATION_TYPE "") - ENDIF() - IF (TRIBITS_SETUP_ENV_DEBUG) - PRINT_VAR(CMAKE_CONFIGURATION_TYPE) - ENDIF() + if (CMAKE_CONFIGURATION_TYPES) + if (CMAKE_BUILD_TYPE STREQUAL "DEBUG") + set(CMAKE_CONFIGURATION_TYPE "Debug") + elseif(CMAKE_BUILD_TYPE STREQUAL "RELEASE") + set(CMAKE_CONFIGURATION_TYPE "Release") + else() + set(CMAKE_CONFIGURATION_TYPE "Release") + endif() + else() + set(CMAKE_CONFIGURATION_TYPE "") + endif() + if (TRIBITS_SETUP_ENV_DEBUG) + print_var(CMAKE_CONFIGURATION_TYPE) + endif() # Set up MPI if MPI is being used - IF ("${TPL_ENABLE_MPI}" STREQUAL "") + if ("${TPL_ENABLE_MPI}" STREQUAL "") # If TPL_ENABLE_MPI is undefined or empty because this project does not # define an MPI TPL, then explicitly disable it. - SET(TPL_ENABLE_MPI FALSE) - ENDIF() + set(TPL_ENABLE_MPI FALSE) + endif() - IF (TPL_ENABLE_MPI) - TRIBITS_SETUP_MPI() - ENDIF() + if (TPL_ENABLE_MPI) + tribits_setup_mpi() + endif() # Enable compilers - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_C) - IF (${PROJECT_NAME}_ENABLE_C) - ENABLE_LANGUAGE(C) - INCLUDE(CMakeDetermineCCompiler) - PRINT_VAR(CMAKE_C_COMPILER_ID) - PRINT_VAR(CMAKE_C_COMPILER_VERSION) + assert_defined(${PROJECT_NAME}_ENABLE_C) + if (${PROJECT_NAME}_ENABLE_C) + enable_language(C) + include(CMakeDetermineCCompiler) + print_var(CMAKE_C_COMPILER_ID) + print_var(CMAKE_C_COMPILER_VERSION) # See CMake/Modules/CMakeCXXCompilerId.cpp.in in the CMake source # directory for a listing of known compiler types. - ENDIF() - - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_CXX) - IF (${PROJECT_NAME}_ENABLE_CXX) - ENABLE_LANGUAGE(CXX) - INCLUDE(CMakeDetermineCXXCompiler) - PRINT_VAR(CMAKE_CXX_COMPILER_ID) - PRINT_VAR(CMAKE_CXX_COMPILER_VERSION) + endif() + + assert_defined(${PROJECT_NAME}_ENABLE_CXX) + if (${PROJECT_NAME}_ENABLE_CXX) + enable_language(CXX) + include(CMakeDetermineCXXCompiler) + print_var(CMAKE_CXX_COMPILER_ID) + print_var(CMAKE_CXX_COMPILER_VERSION) # See CMake/Modules/CMakeCXXCompilerId.cpp.in in the CMake source # directory for a listing of known compiler types. - ENDIF() + endif() - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_Fortran) - IF (${PROJECT_NAME}_ENABLE_Fortran) - ENABLE_LANGUAGE(Fortran) - ENDIF() + assert_defined(${PROJECT_NAME}_ENABLE_Fortran) + if (${PROJECT_NAME}_ENABLE_Fortran) + enable_language(Fortran) + endif() # Do some project-specific tweaks for compiler options, etc. - SET(PROJECT_COMPILER_CONFIG_FILE + set(PROJECT_COMPILER_CONFIG_FILE # Can be used for things like Kokkos. "${${PROJECT_NAME}_SOURCE_DIR}/cmake/ProjectCompilerPostConfig.cmake" CACHE FILEPATH "Allow for project-specific compiler settings." ) - IF (EXISTS "${PROJECT_COMPILER_CONFIG_FILE}") - TRIBITS_TRACE_FILE_PROCESSING(PROJECT INCLUDE "${PROJECT_COMPILER_CONFIG_FILE}") - INCLUDE("${PROJECT_COMPILER_CONFIG_FILE}") - ENDIF() + if (EXISTS "${PROJECT_COMPILER_CONFIG_FILE}") + tribits_trace_file_processing(PROJECT INCLUDE "${PROJECT_COMPILER_CONFIG_FILE}") + include("${PROJECT_COMPILER_CONFIG_FILE}") + endif() # Set up C++ language standard selection. - IF (NOT CMAKE_CXX_STANDARD) - SET(CMAKE_CXX_STANDARD 11) - ELSEIF (NOT CMAKE_CXX_STANDARD MATCHES "^(11|14|17|20)$") - MESSAGE(FATAL_ERROR "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is not 11, 14, 17, or 20.") + if (NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) + elseif (NOT CMAKE_CXX_STANDARD MATCHES "^(11|14|17|20)$") + message(FATAL_ERROR "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is not 11, 14, 17, or 20.") ENDIF () - SET(${PROJECT_NAME}_CXX_STANDARD_FEATURE cxx_std_${CMAKE_CXX_STANDARD}) - IF (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) - SET(CMAKE_CXX_STANDARD_REQUIRED ON) + set(${PROJECT_NAME}_CXX_STANDARD_FEATURE cxx_std_${CMAKE_CXX_STANDARD}) + if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) + set(CMAKE_CXX_STANDARD_REQUIRED ON) ENDIF () - IF (NOT DEFINED CMAKE_CXX_EXTENSIONS) - SET(CMAKE_CXX_EXTENSIONS OFF) + if (NOT DEFINED CMAKE_CXX_EXTENSIONS) + set(CMAKE_CXX_EXTENSIONS OFF) ENDIF () # Set up for strong compiler warnings and warnings as errors - INCLUDE(TribitsSetupBasicCompileLinkFlags) - TRIBITS_SETUP_BASIC_COMPILE_LINK_FLAGS() + include(TribitsSetupBasicCompileLinkFlags) + tribits_setup_basic_compile_link_flags() # # The compilers are set, the environment is known to CMake. Now set the # installation paths and options. # - TRIBITS_SETUP_INSTALLATION_PATHS() + tribits_setup_installation_paths() # Set up Windows interface stuff - IF (MSVC) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE + if (MSVC) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) - SET(WIN_INTERFACE_INCL ${${PROJECT_NAME}_TRIBITS_DIR}/win_interface/include) - IF (EXISTS "${WIN_INTERFACE_INCL}") - INCLUDE_DIRECTORIES("${WIN_INTERFACE_INCL}") - IF (TRIBITS_SETUP_ENV_DEBUG) - MESSAGE("-- Adding win_interface/include ...") - ENDIF() - ENDIF() - ENDIF() - - IF (WIN32 AND NOT CYGWIN) - SET(NATIVE_MS_WINDOWS TRUE) - ELSE() - SET(NATIVE_MS_WINDOWS FALSE) - ENDIF() + set(WIN_INTERFACE_INCL ${${PROJECT_NAME}_TRIBITS_DIR}/win_interface/include) + if (EXISTS "${WIN_INTERFACE_INCL}") + include_directories("${WIN_INTERFACE_INCL}") + if (TRIBITS_SETUP_ENV_DEBUG) + message("-- Adding win_interface/include ...") + endif() + endif() + endif() + + if (WIN32 AND NOT CYGWIN) + set(NATIVE_MS_WINDOWS TRUE) + else() + set(NATIVE_MS_WINDOWS FALSE) + endif() # Probe for non-standard headers - IF (${PROJECT_NAME}_ENABLE_CXX) - CHECK_INCLUDE_FILE_CXX(sys/time.h HAVE_SYS_TIME_H) - CHECK_INCLUDE_FILE_CXX(time.h HAVE_TIME_H) - CHECK_INCLUDE_FILE_CXX(stdint.h HAVE_STDINT_H) - CHECK_INCLUDE_FILE_CXX(inttypes.h HAVE_INTTYPES_H) - ENDIF() - - SET(HAVE_ALGORITHM TRUE) - SET(HAVE_CASSERT TRUE) - SET(HAVE_CCTYPE TRUE) - SET(HAVE_CERRNO TRUE) - SET(HAVE_CLIMITS TRUE) - SET(HAVE_CMATH TRUE) - SET(HAVE_COMPLEX TRUE) - SET(HAVE_CSTDARG TRUE) - SET(HAVE_CSTDIO TRUE) - SET(HAVE_CSTDLIB TRUE) - SET(HAVE_CSTRING TRUE) - SET(HAVE_IOMANIP TRUE) - SET(HAVE_IOSTREAM TRUE) - SET(HAVE_ITERATOR TRUE) - SET(HAVE_LIST TRUE) - SET(HAVE_MAP TRUE) - SET(HAVE_MEMORY TRUE) - SET(HAVE_MUTABLE TRUE) - SET(HAVE_NAMESPACES TRUE) - SET(HAVE_NEW_FOR_SCOPING TRUE) - SET(HAVE_NUMERIC TRUE) - SET(HAVE_NUMERIC_LIMITS TRUE) - SET(HAVE_POW TRUE) - SET(HAVE_SET TRUE) - SET(HAVE_SSTREAM TRUE) - SET(HAVE_FSTREAM TRUE) - SET(HAVE_STDEXCEPT TRUE) - SET(HAVE_STRING TRUE) - SET(HAVE_VECTOR TRUE) + if (${PROJECT_NAME}_ENABLE_CXX) + check_include_file_cxx(sys/time.h HAVE_SYS_TIME_H) + check_include_file_cxx(time.h HAVE_TIME_H) + check_include_file_cxx(stdint.h HAVE_STDINT_H) + check_include_file_cxx(inttypes.h HAVE_INTTYPES_H) + endif() + + set(HAVE_ALGORITHM TRUE) + set(HAVE_CASSERT TRUE) + set(HAVE_CCTYPE TRUE) + set(HAVE_CERRNO TRUE) + set(HAVE_CLIMITS TRUE) + set(HAVE_CMATH TRUE) + set(HAVE_COMPLEX TRUE) + set(HAVE_CSTDARG TRUE) + set(HAVE_CSTDIO TRUE) + set(HAVE_CSTDLIB TRUE) + set(HAVE_CSTRING TRUE) + set(HAVE_IOMANIP TRUE) + set(HAVE_IOSTREAM TRUE) + set(HAVE_ITERATOR TRUE) + set(HAVE_LIST TRUE) + set(HAVE_MAP TRUE) + set(HAVE_MEMORY TRUE) + set(HAVE_MUTABLE TRUE) + set(HAVE_NAMESPACES TRUE) + set(HAVE_NEW_FOR_SCOPING TRUE) + set(HAVE_NUMERIC TRUE) + set(HAVE_NUMERIC_LIMITS TRUE) + set(HAVE_POW TRUE) + set(HAVE_SET TRUE) + set(HAVE_SSTREAM TRUE) + set(HAVE_FSTREAM TRUE) + set(HAVE_STDEXCEPT TRUE) + set(HAVE_STRING TRUE) + set(HAVE_VECTOR TRUE) # 2008/12/20: rabartl: Above: All of these defines should be removed # because we decided that we were going to assume that all compilers @@ -1821,114 +1798,113 @@ MACRO(TRIBITS_SETUP_ENV) # Find Perl - FIND_PACKAGE(Perl) + find_package(Perl) # Do Fortran stuff - INCLUDE(TribitsFortranMangling) + include(TribitsFortranMangling) # Get BLAS name mangling # # ToDo: Make this a project-specific specialization - INCLUDE(TribitsBLASMangling) + include(TribitsBLASMangling) # Set up some MPI info - IF (TPL_ENABLE_MPI) - SET(HAVE_MPI TRUE) - ELSE() - SET(HAVE_MPI FALSE) - ENDIF() + if (TPL_ENABLE_MPI) + set(HAVE_MPI TRUE) + else() + set(HAVE_MPI FALSE) + endif() # OpenMP isn't really a TPL because support is built into the compiler. - IF(${PROJECT_NAME}_ENABLE_OpenMP) - FIND_PACKAGE(OpenMP) - IF(OPENMP_FOUND) - TRIBITS_SET_OPENMP_FLAGS(CXX) - TRIBITS_SET_OPENMP_FLAGS(C) - IF(OpenMP_Fortran_FLAGS) - TRIBITS_SET_OPENMP_FLAGS(Fortran) - ELSE() + if(${PROJECT_NAME}_ENABLE_OpenMP) + find_package(OpenMP) + if(OPENMP_FOUND) + tribits_set_openmp_flags(CXX) + tribits_set_openmp_flags(C) + if(OpenMP_Fortran_FLAGS) + tribits_set_openmp_flags(Fortran) + else() # Older versions of FindOpenMP.cmake don't find Fortran flags. Mike H said this is safe. - SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_C_FLAGS}") - ENDIF() - ELSE() - MESSAGE(FATAL_ERROR "Could not find OpenMP, try setting OpenMP_C_FLAGS and OpenMP_CXX_FLAGS directly") - ENDIF(OPENMP_FOUND) - ENDIF(${PROJECT_NAME}_ENABLE_OpenMP) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_C_FLAGS}") + endif() + else() + message(FATAL_ERROR "Could not find OpenMP, try setting OpenMP_C_FLAGS and OpenMP_CXX_FLAGS directly") + endif(OPENMP_FOUND) + endif(${PROJECT_NAME}_ENABLE_OpenMP) # Check if we need the math library or not and find the right one - IF (NOT NATIVE_MS_WINDOWS) - INCLUDE(MathLibraryNeeded) - ENDIF() + if (NOT NATIVE_MS_WINDOWS) + include(MathLibraryNeeded) + endif() # Check for isnan and isinf support - IF (${PROJECT_NAME}_ENABLE_CXX) - INCLUDE(FiniteValue) - ENDIF() + if (${PROJECT_NAME}_ENABLE_CXX) + include(FiniteValue) + endif() # Check for Doxygen/dot - We can use variables set in this check to - # enable/disable the grapical dependency graphs in doxygen Doxyfiles. - INCLUDE(FindDoxygen) + # enable/disable the graphical dependency graphs in doxygen Doxyfiles. + include(FindDoxygen) # Set the hack library to get link options on - IF (${PROJECT_NAME}_EXTRA_LINK_FLAGS) - IF (TRIBITS_SETUP_ENV_DEBUG) - MESSAGE(STATUS "Creating dummy last_lib for appending the link flags: " + if (${PROJECT_NAME}_EXTRA_LINK_FLAGS) + if (TRIBITS_SETUP_ENV_DEBUG) + message(STATUS "Creating dummy last_lib for appending the link flags: " "${${PROJECT_NAME}_EXTRA_LINK_FLAGS}") - ENDIF() - IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/last_lib_dummy.c) - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/last_lib_dummy.c + endif() + if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/last_lib_dummy.c) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/last_lib_dummy.c "typedef int last_lib_dummy_t;\n") - ENDIF() - ADD_LIBRARY(last_lib STATIC ${CMAKE_CURRENT_BINARY_DIR}/last_lib_dummy.c) - TARGET_LINK_LIBRARIES(last_lib ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}) - ENDIF() + endif() + add_library(last_lib STATIC ${CMAKE_CURRENT_BINARY_DIR}/last_lib_dummy.c) + target_link_libraries(last_lib ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}) + endif() # You have to override the configuration types for MSVS after the compiler # checks! - SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPE} + set(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPE} CACHE STRING "Override by TriBITS (see TribitsDevelopersGuilde.*)" FORCE) - IF (CMAKE_CONFIGURATION_TYPES) - PRINT_VAR(CMAKE_CONFIGURATION_TYPES) - ENDIF() + if (CMAKE_CONFIGURATION_TYPES) + print_var(CMAKE_CONFIGURATION_TYPES) + endif() - TRIBITS_CONFIG_CODE_STOP_TIMER(SETUP_ENV_TIME_START_SECONDS + tribits_config_code_stop_timer(SETUP_ENV_TIME_START_SECONDS "\nTotal time to probe and setup the environment") # Set ninja compile and link parallel job limits - IF (${PROJECT_NAME}_PARALLEL_COMPILE_JOBS_LIMIT) - SET_PROPERTY(GLOBAL APPEND PROPERTY JOB_POOLS + if (${PROJECT_NAME}_PARALLEL_COMPILE_JOBS_LIMIT) + set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${${PROJECT_NAME}_PARALLEL_COMPILE_JOBS_LIMIT}) - SET(CMAKE_JOB_POOL_COMPILE compile_job_pool) - ENDIF() + set(CMAKE_JOB_POOL_COMPILE compile_job_pool) + endif() - IF (${PROJECT_NAME}_PARALLEL_LINK_JOBS_LIMIT) - SET_PROPERTY(GLOBAL APPEND PROPERTY JOB_POOLS + if (${PROJECT_NAME}_PARALLEL_LINK_JOBS_LIMIT) + set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${${PROJECT_NAME}_PARALLEL_LINK_JOBS_LIMIT}) - SET(CMAKE_JOB_POOL_LINK link_job_pool) - ENDIF() + set(CMAKE_JOB_POOL_LINK link_job_pool) + endif() -ENDMACRO() +endmacro() -MACRO(TRIBITS_SET_OPENMP_FLAGS LANG) - IF (NOT "${OpenMP_${LANG}_FLAGS_OVERRIDE}" STREQUAL "") - SET(CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} ${OpenMP_${LANG}_FLAGS_OVERRIDE}") - ELSE() - SET(CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} ${OpenMP_${LANG}_FLAGS}") - ENDIF() -ENDMACRO() +macro(tribits_set_openmp_flags LANG) + if (NOT "${OpenMP_${LANG}_FLAGS_OVERRIDE}" STREQUAL "") + set(CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} ${OpenMP_${LANG}_FLAGS_OVERRIDE}") + else() + set(CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} ${OpenMP_${LANG}_FLAGS}") + endif() +endmacro() -# # Set mapping of labels to subprojects (i.e. TriBITS packages) for local CTest -# only. +# only # # NOTE: This macro is only used define mapping of labels to subprojects for # running ctest locally. This results in summarizing the tests run for each @@ -1936,50 +1912,47 @@ ENDMACRO() # harmless to define the mapping for every TriBITS package. Only TriBITS # packages will be listed in the summary if they had one or more tests run. # +macro(tribits_set_labels_to_subprojects_mapping) + set(CTEST_LABELS_FOR_SUBPROJECTS ${${PROJECT_NAME}_PACKAGES}) +endmacro() -MACRO(TRIBITS_SET_LABELS_TO_SUBPROJECTS_MAPPING) - SET(CTEST_LABELS_FOR_SUBPROJECTS ${${PROJECT_NAME}_PACKAGES}) -ENDMACRO() - -# # Macro to turn on CTest support # +macro(tribits_include_ctest_support) -MACRO(TRIBITS_INCLUDE_CTEST_SUPPORT) - - SET(DART_TESTING_TIMEOUT_IN ${DART_TESTING_TIMEOUT}) + set(DART_TESTING_TIMEOUT_IN ${DART_TESTING_TIMEOUT}) - IF (DART_TESTING_TIMEOUT_IN) - TRIBITS_SCALE_TIMEOUT(${DART_TESTING_TIMEOUT} DART_TESTING_TIMEOUT) - IF (NOT DART_TESTING_TIMEOUT STREQUAL DART_TESTING_TIMEOUT_IN) - MESSAGE("-- DART_TESTING_TIMEOUT=${DART_TESTING_TIMEOUT_IN} being scaled by ${PROJECT_NAME}_SCALE_TEST_TIMEOUT=${${PROJECT_NAME}_SCALE_TEST_TIMEOUT} to ${DART_TESTING_TIMEOUT}") - ENDIF() + if (DART_TESTING_TIMEOUT_IN) + tribits_scale_timeout(${DART_TESTING_TIMEOUT} DART_TESTING_TIMEOUT) + if (NOT DART_TESTING_TIMEOUT STREQUAL DART_TESTING_TIMEOUT_IN) + message("-- DART_TESTING_TIMEOUT=${DART_TESTING_TIMEOUT_IN} being scaled by ${PROJECT_NAME}_SCALE_TEST_TIMEOUT=${${PROJECT_NAME}_SCALE_TEST_TIMEOUT} to ${DART_TESTING_TIMEOUT}") + endif() # Have to set DART_TESTING_TIMEOUT in cache or CMake will not put in right # 'TimeOut' in DartConfiguration.tcl file! - SET(DART_TESTING_TIMEOUT ${DART_TESTING_TIMEOUT} CACHE STRING "" FORCE) - ENDIF() + set(DART_TESTING_TIMEOUT ${DART_TESTING_TIMEOUT} CACHE STRING "" FORCE) + endif() # Set up CTEst/CDash subprojects - TRIBITS_SET_LABELS_TO_SUBPROJECTS_MAPPING() + tribits_set_labels_to_subprojects_mapping() # NOTE: We do this after all of the packages have been defined but before # the DartConfiguration.tcl file has been created. - INCLUDE(CTest) # Generates file DartConfiguration.tcl with 'TimeOut' set! + include(CTest) # Generates file DartConfiguration.tcl with 'TimeOut' set! - IF (DART_TESTING_TIMEOUT_IN) + if (DART_TESTING_TIMEOUT_IN) # Put DART_TESTING_TIMEOUT back to user input value to avoid scaling this # up and up on recofigures! - SET(DART_TESTING_TIMEOUT ${DART_TESTING_TIMEOUT_IN} CACHE STRING + set(DART_TESTING_TIMEOUT ${DART_TESTING_TIMEOUT_IN} CACHE STRING "Original value set by user reset by TriBITS after scaling" FORCE) - ENDIF() + endif() - TRIBITS_CONFIGURE_CTEST_CUSTOM(${${PROJECT_NAME}_SOURCE_DIR} + tribits_configure_ctest_custom(${${PROJECT_NAME}_SOURCE_DIR} ${${PROJECT_NAME}_BINARY_DIR}) - TRIBITS_ADD_TEST_HELPERS_INIT() + tribits_add_test_helpers_init() -ENDMACRO() +endmacro() # NOTE: The above logic with DART_TESTING_TIMEOUT is a huge hack. For some # reason, on the first configure CMake will not put the local value of the # scaled DART_TESTING_TIMEOUT variable into the DartConfiguration.tcl. @@ -1992,71 +1965,66 @@ ENDMACRO() # force-set DART_TESTING_TIMEOUT back to the user's input value. The only # disadvantage of this approach (other than it is a hack to get around a CMake # bug) is that you loose the user's documentation string, in case they set -# that with a SET( ... CACHE ...) statement in an input *.cmake file. +# that with a set( ... CACHE ...) statement in an input *.cmake file. +# Determines if a package should be processed # -# Function that determines if a package should be processed -# - -FUNCTION(TRIBITS_DETERMINE_IF_PROCESS_PACKAGE PACKAGE_NAME +function(tribits_determine_if_process_package PACKAGE_NAME PROCESS_PACKAGE_OUT PACKAGE_ENABLE_STR_OUT ) - SET(PROCESS_PACKAGE FALSE) - SET(PACKAGE_ENABLE_STR "") - - IF (${PACKAGE_NAME}_SUBPACKAGES) - # Process the package if any of the the subpackages are enable - FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - IF (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - SET(PROCESS_PACKAGE TRUE) - APPEND_STRING_VAR_WITH_SEP(PACKAGE_ENABLE_STR ", " ${TRIBITS_SUBPACKAGE}) - ENDIF() - ENDFOREACH() - ELSE() + set(PROCESS_PACKAGE FALSE) + set(PACKAGE_ENABLE_STR "") + + if (${PACKAGE_NAME}_SUBPACKAGES) + # Process the package if any of the subpackages are enable + foreach(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) + set(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + if (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + set(PROCESS_PACKAGE TRUE) + append_string_var_with_sep(PACKAGE_ENABLE_STR ", " ${TRIBITS_SUBPACKAGE}) + endif() + endforeach() + else() # If the package itself is enabled, of course process it - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - SET(PROCESS_PACKAGE TRUE) - APPEND_STRING_VAR_WITH_SEP(PACKAGE_ENABLE_STR ", " "Libs") - ENDIF() - ENDIF() + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + set(PROCESS_PACKAGE TRUE) + append_string_var_with_sep(PACKAGE_ENABLE_STR ", " "Libs") + endif() + endif() # If subpackages or package is enabled, then check tests/examples - IF (PROCESS_PACKAGE) - IF (${PACKAGE_NAME}_ENABLE_TESTS) - APPEND_STRING_VAR_WITH_SEP(PACKAGE_ENABLE_STR ", " "Tests") - ENDIF() - IF (${PACKAGE_NAME}_ENABLE_EXAMPLES) - APPEND_STRING_VAR_WITH_SEP(PACKAGE_ENABLE_STR ", " "Examples") - ENDIF() - ENDIF() + if (PROCESS_PACKAGE) + if (${PACKAGE_NAME}_ENABLE_TESTS) + append_string_var_with_sep(PACKAGE_ENABLE_STR ", " "Tests") + endif() + if (${PACKAGE_NAME}_ENABLE_EXAMPLES) + append_string_var_with_sep(PACKAGE_ENABLE_STR ", " "Examples") + endif() + endif() - SET(${PROCESS_PACKAGE_OUT} ${PROCESS_PACKAGE} PARENT_SCOPE) - SET(${PACKAGE_ENABLE_STR_OUT} ${PACKAGE_ENABLE_STR} PARENT_SCOPE) + set(${PROCESS_PACKAGE_OUT} ${PROCESS_PACKAGE} PARENT_SCOPE) + set(${PACKAGE_ENABLE_STR_OUT} ${PACKAGE_ENABLE_STR} PARENT_SCOPE) -ENDFUNCTION() +endfunction() +# Reads in the project's version file into the current scope # -# Macro that reads in the project's version file into the current scope -# - -MACRO(TRIBITS_PROJECT_READ_VERSION_FILE PROJECT_SOURCE_DIR_IN) - SET(PROJECT_VERSION_FILE ${PROJECT_SOURCE_DIR_IN}/Version.cmake) - IF (EXISTS ${PROJECT_VERSION_FILE}) +macro(tribits_project_read_version_file PROJECT_SOURCE_DIR_IN) + set(PROJECT_VERSION_FILE ${PROJECT_SOURCE_DIR_IN}/Version.cmake) + if (EXISTS ${PROJECT_VERSION_FILE}) # Set REPOSITORY_NAME in case Version.cmake is written generically! - SET(REPOSITORY_NAME ${PROJECT_NAME}) - TRIBITS_TRACE_FILE_PROCESSING(PROJECT INCLUDE "${PROJECT_VERSION_FILE}") - INCLUDE(${PROJECT_VERSION_FILE}) - ENDIF() -ENDMACRO() + set(REPOSITORY_NAME ${PROJECT_NAME}) + tribits_trace_file_processing(PROJECT INCLUDE "${PROJECT_VERSION_FILE}") + include(${PROJECT_VERSION_FILE}) + endif() +endmacro() -# -# Function that reads in and the Repository's specific Version.cmake file and -# then configures its ${REPO_NAME}_version.h file. +# Read in and the Repository's specific Version.cmake file and then configure +# its ${REPO_NAME}_version.h file. # # The file ${REPO_NAME}_version.h is only configured if the repository contains # the files Version.cmake and Copyright.txt @@ -2064,218 +2032,215 @@ ENDMACRO() # NOTE: This is done as a function so that the read-in version variables don't # bleed into the outer scope. # -FUNCTION(TRIBITS_REPOSITORY_CONFIGURE_VERSION_HEADER_FILE +function(tribits_repository_configure_version_header_file REPOSITORY_NAME REPOSITORY_DIR ADD_INSTALL_TARGET OUTPUT_VERSION_HEADER_FILE ) - IF (TRIBITS_REPOSITORY_CONFIGURE_VERSION_HEADER_FILE_DEBUG_DUMP) - MESSAGE("TRIBITS_REPOSITORY_CONFIGURE_VERSION_HEADER_FILE: " + if (TRIBITS_REPOSITORY_CONFIGURE_VERSION_HEADER_FILE_DEBUG_DUMP) + message("TRIBITS_REPOSITORY_CONFIGURE_VERSION_HEADER_FILE: " "'${REPOSITORY_NAME}' '${REPOSITORY_DIR}" " '${OUTPUT_VERSION_HEADER_FILE}'") - ENDIF() + endif() - STRING(TOUPPER ${REPOSITORY_NAME} REPOSITORY_NAME_UC) + string(TOUPPER ${REPOSITORY_NAME} REPOSITORY_NAME_UC) - TRIBITS_SET_BASE_REPO_DIR(${PROJECT_SOURCE_DIR} ${REPOSITORY_DIR} + tribits_set_base_repo_dir(${PROJECT_SOURCE_DIR} ${REPOSITORY_DIR} REPOSITORY_ABS_DIR) - SET(REPOSITORY_VERSION_FILE ${REPOSITORY_ABS_DIR}/Version.cmake) - SET(REPOSITORY_COPYRIGHT_FILE ${REPOSITORY_ABS_DIR}/Copyright.txt) + set(REPOSITORY_VERSION_FILE ${REPOSITORY_ABS_DIR}/Version.cmake) + set(REPOSITORY_COPYRIGHT_FILE ${REPOSITORY_ABS_DIR}/Copyright.txt) - IF (EXISTS ${REPOSITORY_VERSION_FILE} AND EXISTS ${REPOSITORY_COPYRIGHT_FILE}) + if (EXISTS ${REPOSITORY_VERSION_FILE} AND EXISTS ${REPOSITORY_COPYRIGHT_FILE}) # Read the copyright header info - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY READ "${REPOSITORY_COPYRIGHT_FILE}") - FILE(READ "${REPOSITORY_COPYRIGHT_FILE}" REPOSITORY_COPYRIGHT_HEADER) + tribits_trace_file_processing(REPOSITORY READ "${REPOSITORY_COPYRIGHT_FILE}") + file(READ "${REPOSITORY_COPYRIGHT_FILE}" REPOSITORY_COPYRIGHT_HEADER) # Read the version variables and translate into standard form - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE "${REPOSITORY_VERSION_FILE}") - INCLUDE(${REPOSITORY_VERSION_FILE}) - SET(REPOSITORY_MAJOR_VERSION ${${REPOSITORY_NAME}_MAJOR_VERSION}) - SET(REPOSITORY_MAJOR_MINOR_VERSION ${${REPOSITORY_NAME}_MAJOR_MINOR_VERSION}) - SET(REPOSITORY_VERSION_STRING ${${REPOSITORY_NAME}_VERSION_STRING}) + tribits_trace_file_processing(REPOSITORY INCLUDE "${REPOSITORY_VERSION_FILE}") + include(${REPOSITORY_VERSION_FILE}) + set(REPOSITORY_MAJOR_VERSION ${${REPOSITORY_NAME}_MAJOR_VERSION}) + set(REPOSITORY_MAJOR_MINOR_VERSION ${${REPOSITORY_NAME}_MAJOR_MINOR_VERSION}) + set(REPOSITORY_VERSION_STRING ${${REPOSITORY_NAME}_VERSION_STRING}) # Configure the file with everything set - IF (TRIBITS_REPOSITORY_CONFIGURE_VERSION_HEADER_FILE_DEBUG_DUMP) - MESSAGE("-- Writing the file ${OUTPUT_VERSION_HEADER_FILE} ...") - ENDIF() - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY CONFIGURE "${OUTPUT_VERSION_HEADER_FILE}") - CONFIGURE_FILE( + if (TRIBITS_REPOSITORY_CONFIGURE_VERSION_HEADER_FILE_DEBUG_DUMP) + message("-- Writing the file ${OUTPUT_VERSION_HEADER_FILE} ...") + endif() + tribits_trace_file_processing(REPOSITORY CONFIGURE "${OUTPUT_VERSION_HEADER_FILE}") + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_PACKAGE_ARCH_DIR}/Tribits_version.h.in ${OUTPUT_VERSION_HEADER_FILE}) - IF (ADD_INSTALL_TARGET) + if (ADD_INSTALL_TARGET) # Install version header file - TRIBITS_INSTALL_HEADERS(HEADERS ${OUTPUT_VERSION_HEADER_FILE}) - ENDIF() + tribits_install_headers(HEADERS ${OUTPUT_VERSION_HEADER_FILE}) + endif() - ENDIF() + endif() -ENDFUNCTION() +endfunction() +# Configure each of the Repositories' version header file # -# Configure each of the Repositories version header files -# - -FUNCTION(TRIBITS_REPOSITORY_CONFIGURE_ALL_VERSION_HEADER_FILES) - #PRINT_VAR(ARGN) - FOREACH(REPO ${ARGN}) - TRIBITS_GET_REPO_NAME_DIR(${REPO} REPO_NAME REPO_DIR) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Considering configuring version file for '${REPO_NAME}'") - ENDIF() - TRIBITS_REPOSITORY_CONFIGURE_VERSION_HEADER_FILE( ${REPO_NAME} ${REPO_DIR} TRUE +function(tribits_repository_configure_all_version_header_files) + #print_var(ARGN) + foreach(REPO ${ARGN}) + tribits_get_repo_name_dir(${REPO} REPO_NAME REPO_DIR) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Considering configuring version file for '${REPO_NAME}'") + endif() + tribits_repository_configure_version_header_file( ${REPO_NAME} ${REPO_DIR} TRUE "${${PROJECT_NAME}_BINARY_DIR}/${REPO_DIR}/${REPO_NAME}_version.h") - ENDFOREACH() -ENDFUNCTION() + endforeach() +endfunction() -# -# Function that generates the VersionDate.cmake and -# ${REPO_NAME}_version_date.h files. +# Generate the VersionDate.cmake and ${REPO_NAME}_version_date.h files for a +# TriBITS Repository # # NOTE: This is done as a function so that the read-in version variables don't # bleed into the outer scope. # -FUNCTION(TRIBITS_REPOSITORY_CONFIGURE_VERSION_DATE_FILES +function(tribits_repository_configure_version_date_files REPOSITORY_NAME REPOSITORY_DIR ADD_INSTALL_TARGET ) - IF (TRIBITS_REPOSITORY_CONFIGURE_VERSION_DATE_FILES_DEBUG_DUMP) - MESSAGE("TRIBITS_REPOSITORY_CONFIGURE_VERSION_DATE_FILES: " + if (TRIBITS_REPOSITORY_CONFIGURE_VERSION_DATE_FILES_DEBUG_DUMP) + message("TRIBITS_REPOSITORY_CONFIGURE_VERSION_DATE_FILES: " "'${REPOSITORY_NAME}' '${REPOSITORY_DIR}" ) - ENDIF() + endif() - STRING(TOUPPER ${REPOSITORY_NAME} REPOSITORY_NAME_UC) + string(TOUPPER ${REPOSITORY_NAME} REPOSITORY_NAME_UC) - TRIBITS_SET_BASE_REPO_DIR(${PROJECT_SOURCE_DIR} ${REPOSITORY_DIR} + tribits_set_base_repo_dir(${PROJECT_SOURCE_DIR} ${REPOSITORY_DIR} REPO_SOURCE_ABS_DIR) - TRIBITS_SET_BASE_REPO_DIR(${PROJECT_BINARY_DIR} ${REPOSITORY_DIR} + tribits_set_base_repo_dir(${PROJECT_BINARY_DIR} ${REPOSITORY_DIR} REPO_BINARY_ABS_DIR) - SET(REPO_GIT_VERSION_DATE) - IF (NOT IS_DIRECTORY "${REPO_SOURCE_ABS_DIR}/.git") - MESSAGE("-- NOTE: Can't fill in version date files for ${REPOSITORY_NAME} since" + set(REPO_GIT_VERSION_DATE) + if (NOT IS_DIRECTORY "${REPO_SOURCE_ABS_DIR}/.git") + message("-- NOTE: Can't fill in version date files for ${REPOSITORY_NAME} since" " ${REPO_SOURCE_ABS_DIR}/.git/ does not exist!") - ELSEIF (GIT_VERSION_STRING VERSION_LESS "2.10.0") - MESSAGE("-- NOTE: Can't fill in version date files for ${REPOSITORY_NAME} since" + elseif (GIT_VERSION_STRING VERSION_LESS "2.10.0") + message("-- NOTE: Can't fill in version date files for ${REPOSITORY_NAME} since" " GIT_VERSION_STRING=${GIT_VERSION_STRING} < 2.10.0") - ELSE() + else() # Generate the version date integer - TRIBITS_GET_RAW_GIT_COMMIT_UTC_TIME("${REPO_SOURCE_ABS_DIR}" "HEAD" + tribits_get_raw_git_commit_utc_time("${REPO_SOURCE_ABS_DIR}" "HEAD" REPO_GIT_COMMIT_UTC_TIME) - TRIBITS_GET_VERSION_DATE_FROM_RAW_GIT_COMMIT_UTC_TIME("${REPO_GIT_COMMIT_UTC_TIME}" + tribits_get_version_date_from_raw_git_commit_utc_time("${REPO_GIT_COMMIT_UTC_TIME}" REPO_GIT_VERSION_DATE ) - ENDIF() + endif() - IF (REPO_GIT_VERSION_DATE) + if (REPO_GIT_VERSION_DATE) # Configure the VersionDate.cmake file in the repo binary dir and include it - SET(REPO_VERSION_DATE_CMAKE_FILE "${REPO_BINARY_ABS_DIR}/VersionDate.cmake") - CONFIGURE_FILE( + set(REPO_VERSION_DATE_CMAKE_FILE "${REPO_BINARY_ABS_DIR}/VersionDate.cmake") + configure_file( "${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_PACKAGE_ARCH_DIR}/VersionDate.cmake.in" "${REPO_VERSION_DATE_CMAKE_FILE}" ) - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE "${REPO_VERSION_DATE_CMAKE_FILE}") - INCLUDE(${REPO_VERSION_DATE_CMAKE_FILE}) - ENDIF() + tribits_trace_file_processing(REPOSITORY INCLUDE "${REPO_VERSION_DATE_CMAKE_FILE}") + include(${REPO_VERSION_DATE_CMAKE_FILE}) + endif() # Configure the _version_date.h file in the repo binary dir - IF (REPO_GIT_VERSION_DATE) - SET(REPOSITORY_VERSION_DATE_MACRO_DEF + if (REPO_GIT_VERSION_DATE) + set(REPOSITORY_VERSION_DATE_MACRO_DEF "#define ${REPOSITORY_NAME_UC}_VERSION_DATE ${REPO_GIT_VERSION_DATE}" ) - ELSE() - SET(REPOSITORY_VERSION_DATE_MACRO_DEF + else() + set(REPOSITORY_VERSION_DATE_MACRO_DEF "#undef ${REPOSITORY_NAME_UC}_VERSION_DATE" ) - ENDIF() - SET(REPO_VERSION_DATE_HEADER_FILE "${REPO_BINARY_ABS_DIR}/${REPOSITORY_NAME}_version_date.h") - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY CONFIGURE "${REPO_VERSION_DATE_HEADER_FILE}") - CONFIGURE_FILE( + endif() + set(REPO_VERSION_DATE_HEADER_FILE "${REPO_BINARY_ABS_DIR}/${REPOSITORY_NAME}_version_date.h") + tribits_trace_file_processing(REPOSITORY CONFIGURE "${REPO_VERSION_DATE_HEADER_FILE}") + configure_file( "${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_PACKAGE_ARCH_DIR}/Tribits_version_date.h.in" "${REPO_VERSION_DATE_HEADER_FILE}" ) # Add the install target for _version_date.h - IF (ADD_INSTALL_TARGET) - TRIBITS_INSTALL_HEADERS(HEADERS ${REPO_VERSION_DATE_HEADER_FILE}) - ENDIF() + if (ADD_INSTALL_TARGET) + tribits_install_headers(HEADERS ${REPO_VERSION_DATE_HEADER_FILE}) + endif() -ENDFUNCTION() +endfunction() +# Configure each of the Repositories' version date files # -# Configure each of the Repositories version date files -# - -FUNCTION(TRIBITS_REPOSITORY_CONFIGURE_ALL_VERSION_DATE_FILES) - #PRINT_VAR(ARGN) - IF (${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES) - FOREACH(REPO ${ARGN}) - TRIBITS_GET_REPO_NAME_DIR(${REPO} REPO_NAME REPO_DIR) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Considering configuring version date files for '${REPO_NAME}'") - ENDIF() - TRIBITS_REPOSITORY_CONFIGURE_VERSION_DATE_FILES(${REPO_NAME} ${REPO_DIR} TRUE) - ENDFOREACH() - ENDIF() -ENDFUNCTION() +function(tribits_repository_configure_all_version_date_files) + #print_var(ARGN) + if (${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES) + foreach(REPO ${ARGN}) + tribits_get_repo_name_dir(${REPO} REPO_NAME REPO_DIR) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Considering configuring version date files for '${REPO_NAME}'") + endif() + tribits_repository_configure_version_date_files(${REPO_NAME} ${REPO_DIR} TRUE) + endforeach() + endif() +endfunction() +# Configure the enabled packages # -# Macro that does the final set of package configurations +# This macro actally calls add_subdirectory() on the enabled +# TriBITS packages. # -MACRO(TRIBITS_CONFIGURE_ENABLED_PACKAGES) +macro(tribits_configure_enabled_packages) - TRIBITS_CONFIG_CODE_START_TIMER(CONFIGURE_PACKAGES_TIME_START_SECONDS) + tribits_config_code_start_timer(CONFIGURE_PACKAGES_TIME_START_SECONDS) # # A) Global variable initialization # - GLOBAL_NULL_SET(${PROJECT_NAME}_INCLUDE_DIRS) - GLOBAL_NULL_SET(${PROJECT_NAME}_LIBRARY_DIRS) - GLOBAL_NULL_SET(${PROJECT_NAME}_LIBRARIES) - GLOBAL_NULL_SET(${PROJECT_NAME}_ETI_PACKAGES) + global_null_set(${PROJECT_NAME}_INCLUDE_DIRS) + global_null_set(${PROJECT_NAME}_LIBRARY_DIRS) + global_null_set(${PROJECT_NAME}_LIBRARIES) + global_null_set(${PROJECT_NAME}_ETI_PACKAGES) # - # B) Define the source and binary directories for all of the pacakges that - # have been enbaled. These are used to allow packages to refer to each + # B) Define the source and binary directories for all of the packages that + # have been enabled. These are used to allow packages to refer to each # other even downstream packages (which is pretty messed up really). # - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) # Get all the package sources independent of whether they are enabled or not. # There are some messed up packages that grab parts out of unrelated # downstream packages that might not even be enabled. To support this, # allow this. - TRIBITS_DETERMINE_IF_PROCESS_PACKAGE(${TRIBITS_PACKAGE} + tribits_determine_if_process_package(${TRIBITS_PACKAGE} PROCESS_PACKAGE PACKAGE_ENABLE_STR) - IF (PROCESS_PACKAGE) + if (PROCESS_PACKAGE) - IF (${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR) - ENDIF() - IF(IS_ABSOLUTE ${${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR}) - SET(${TRIBITS_PACKAGE}_BINARY_DIR ${${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR}) - ELSE() - SET(${TRIBITS_PACKAGE}_BINARY_DIR + if (${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR) + endif() + if(IS_ABSOLUTE ${${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR}) + set(${TRIBITS_PACKAGE}_BINARY_DIR ${${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR}) + else() + set(${TRIBITS_PACKAGE}_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${${TRIBITS_PACKAGE}_SPECIFIED_BINARY_DIR}) - ENDIF() - ELSE() - SET(${TRIBITS_PACKAGE}_BINARY_DIR + endif() + else() + set(${TRIBITS_PACKAGE}_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) - ENDIF() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${TRIBITS_PACKAGE}_BINARY_DIR) - ENDIF() + endif() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${TRIBITS_PACKAGE}_BINARY_DIR) + endif() - ENDIF() + endif() - ENDFOREACH() + endforeach() # # C) Loop over all of the packages and process their CMakeLists.txt files if @@ -2284,203 +2249,217 @@ MACRO(TRIBITS_CONFIGURE_ENABLED_PACKAGES) # Include these here so they don't need to be included in each package's # CMakeLists.txt files. - INCLUDE(TribitsPackageMacros) - INCLUDE(TribitsSubPackageMacros) - INCLUDE(AddSubdirectories) + include(TribitsPackageMacros) + include(TribitsSubPackageMacros) + include(AddSubdirectories) - SET(CONFIGURED_A_PACKAGE FALSE) - SET(ENABLED_PACKAGE_LIBS_TARGETS) + set(CONFIGURED_A_PACKAGE FALSE) + set(ENABLED_PACKAGE_LIBS_TARGETS) # Tell packages that are also repos they are being processed as a package. - SET(TRIBITS_PROCESSING_PACKAGE TRUE) + set(TRIBITS_PROCESSING_PACKAGE TRUE) - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) - TRIBITS_DETERMINE_IF_PROCESS_PACKAGE(${TRIBITS_PACKAGE} + tribits_determine_if_process_package(${TRIBITS_PACKAGE} PROCESS_PACKAGE PACKAGE_ENABLE_STR) - IF (PROCESS_PACKAGE) + if (PROCESS_PACKAGE) - MESSAGE("Processing enabled package: ${TRIBITS_PACKAGE} (${PACKAGE_ENABLE_STR})") + message("Processing enabled package: ${TRIBITS_PACKAGE} (${PACKAGE_ENABLE_STR})") - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - TRIBITS_PACKAGE_CONFIG_CODE_START_TIMER(PROCESS_THIS_PACKAGE_TIME_START_SECONDS) + tribits_package_config_code_start_timer(PROCESS_THIS_PACKAGE_TIME_START_SECONDS) - SET(PACKAGE_NAME ${TRIBITS_PACKAGE}) # Used in CMake code in downstream package - SET(PARENT_PACKAGE_NAME ${TRIBITS_PACKAGE}) - STRING(TOUPPER "${PARENT_PACKAGE_NAME}" PARENT_PACKAGE_NAME_UC) + set(PACKAGE_NAME ${TRIBITS_PACKAGE}) # Used in CMake code in downstream package + set(PARENT_PACKAGE_NAME ${TRIBITS_PACKAGE}) + string(TOUPPER "${PARENT_PACKAGE_NAME}" PARENT_PACKAGE_NAME_UC) - IF (NOT EXISTS ${${TRIBITS_PACKAGE}_SOURCE_DIR}/CMakeLists.txt) - MESSAGE(FATAL_ERROR + if (NOT EXISTS ${${TRIBITS_PACKAGE}_SOURCE_DIR}/CMakeLists.txt) + message(FATAL_ERROR "Error, the file ${${TRIBITS_PACKAGE}_SOURCE_DIR}/CMakeLists.txt does not exist!") - ENDIF() + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${TRIBITS_PACKAGE}_SOURCE_DIR) - PRINT_VAR(${TRIBITS_PACKAGE}_BINARY_DIR) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${TRIBITS_PACKAGE}_SOURCE_DIR) + print_var(${TRIBITS_PACKAGE}_BINARY_DIR) + endif() - SET(TRIBITS_PACKAGE_CMAKELIST_FILE + set(TRIBITS_PACKAGE_CMAKELIST_FILE "${${TRIBITS_PACKAGE}_SOURCE_DIR}/CMakeLists.txt") - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE ADD_SUBDIR + tribits_trace_file_processing(PACKAGE ADD_SUBDIR "${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() - INCLUDE("${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() - IF (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "ERROR: Forgot to call TRIBITS_PACKAGE_POSTPROCESS() in" + if (NOT ${TRIBITS_PACKAGE}_SOURCE_DIR STREQUAL ${PROJECT_NAME}_SOURCE_DIR) + add_subdirectory(${${TRIBITS_PACKAGE}_SOURCE_DIR} ${${TRIBITS_PACKAGE}_BINARY_DIR}) + else() + include("${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() + if (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS) + tribits_report_invalid_tribits_usage( + "ERROR: Forgot to call tribits_package_postprocess() in" " ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - LIST(APPEND ENABLED_PACKAGE_LIBS_TARGETS ${TRIBITS_PACKAGE}_libs) - LIST(APPEND ${PROJECT_NAME}_INCLUDE_DIRS ${${TRIBITS_PACKAGE}_INCLUDE_DIRS}) - LIST(APPEND ${PROJECT_NAME}_LIBRARY_DIRS ${${TRIBITS_PACKAGE}_LIBRARY_DIRS}) - LIST(APPEND ${PROJECT_NAME}_LIBRARIES ${${TRIBITS_PACKAGE}_LIBRARIES}) + list(APPEND ENABLED_PACKAGE_LIBS_TARGETS ${TRIBITS_PACKAGE}_libs) + list(APPEND ${PROJECT_NAME}_INCLUDE_DIRS ${${TRIBITS_PACKAGE}_INCLUDE_DIRS}) + list(APPEND ${PROJECT_NAME}_LIBRARY_DIRS ${${TRIBITS_PACKAGE}_LIBRARY_DIRS}) + list(APPEND ${PROJECT_NAME}_LIBRARIES ${${TRIBITS_PACKAGE}_LIBRARIES}) - TRIBITS_PACKAGE_CONFIG_CODE_STOP_TIMER(PROCESS_THIS_PACKAGE_TIME_START_SECONDS + tribits_package_config_code_stop_timer(PROCESS_THIS_PACKAGE_TIME_START_SECONDS "-- Total time to configure package ${TRIBITS_PACKAGE}") - ENDIF() + endif() - SET(CONFIGURED_A_PACKAGE TRUE) + set(CONFIGURED_A_PACKAGE TRUE) - ENDIF() + endif() - ENDFOREACH() + endforeach() # # D) Loop backwards over ETI packages if ETI is enabled # - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) # Do this regardless of whether project level ETI is enabled - IF("${${PROJECT_NAME}_ETI_PACKAGES}" STREQUAL "") - MESSAGE("\nNo ETI support requested by packages.\n") - ELSE() - #IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nProcessing explicit instantiation support for enabled packages ...\n") - #ENDIF() - SET(REVERSE_ETI_LIST ${${PROJECT_NAME}_ETI_PACKAGES}) - LIST(REVERSE REVERSE_ETI_LIST) - FOREACH(PACKAGE_NAME ${REVERSE_ETI_LIST}) - MESSAGE("Processing ETI support: ${PACKAGE_NAME}") - TRIBITS_PACKAGE_CONFIG_CODE_START_TIMER(PROCESS_ETI_START_SECONDS) - SET(ETIFILE + if("${${PROJECT_NAME}_ETI_PACKAGES}" STREQUAL "") + message("\nNo ETI support requested by packages.\n") + else() + #if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nProcessing explicit instantiation support for enabled packages ...\n") + #endif() + set(REVERSE_ETI_LIST ${${PROJECT_NAME}_ETI_PACKAGES}) + list(REVERSE REVERSE_ETI_LIST) + foreach(PACKAGE_NAME ${REVERSE_ETI_LIST}) + message("Processing ETI support: ${PACKAGE_NAME}") + tribits_package_config_code_start_timer(PROCESS_ETI_START_SECONDS) + set(ETIFILE ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/ExplicitInstantiationSupport.cmake) - IF(NOT EXISTS "${ETIFILE}") - MESSAGE(FATAL_ERROR + if(NOT EXISTS "${ETIFILE}") + message(FATAL_ERROR "Could not find ${PACKAGE_NAME} ETI support file ${ETIFILE}") - ENDIF() - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE INCLUDE "${ETIFILE}") - INCLUDE("${ETIFILE}") - TRIBITS_PACKAGE_CONFIG_CODE_STOP_TIMER(PROCESS_ETI_START_SECONDS + endif() + tribits_trace_file_processing(PACKAGE INCLUDE "${ETIFILE}") + include("${ETIFILE}") + tribits_package_config_code_stop_timer(PROCESS_ETI_START_SECONDS "-- Time to process ETI support for package ${PACKAGE_NAME}") - ENDFOREACH() - ENDIF() + endforeach() + endif() - ENDIF() + endif() # # E) Check if no packages are enabled and if that is allowed # - ADVANCED_SET( ${PROJECT_NAME}_ALLOW_NO_PACKAGES ON + advanced_set( ${PROJECT_NAME}_ALLOW_NO_PACKAGES ON CACHE BOOL "Allow configuration to finish even if no packages are enabled") - IF (NOT CONFIGURED_A_PACKAGE) - IF (${PROJECT_NAME}_ALLOW_NO_PACKAGES) - SET(MSG_TYPE WARNING) - ELSE() - SET(MSG_TYPE ERROR) - ENDIF() - MESSAGE( + if (NOT CONFIGURED_A_PACKAGE) + if (${PROJECT_NAME}_ALLOW_NO_PACKAGES) + set(MSG_TYPE WARNING) + else() + set(MSG_TYPE ERROR) + endif() + message( "\n***" "\n*** ${MSG_TYPE}: There were no packages configured so no libraries" " or tests/examples will be built!" "\n***\n" ) - IF (NOT ${PROJECT_NAME}_ALLOW_NO_PACKAGES) - MESSAGE(SEND_ERROR "Stopping configure!") - ENDIF() - ELSE() - ASSERT_AND_TOUCH_DEFINED(${PROJECT_NAME}_ALLOW_NO_PACKAGES) - ENDIF() + if (NOT ${PROJECT_NAME}_ALLOW_NO_PACKAGES) + message(SEND_ERROR "Stopping configure!") + endif() + else() + assert_and_touch_defined(${PROJECT_NAME}_ALLOW_NO_PACKAGES) + endif() # # F) Process the global variables and other cleanup # - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - REMOVE_GLOBAL_DUPLICATES(${PROJECT_NAME}_INCLUDE_DIRS) - REMOVE_GLOBAL_DUPLICATES(${PROJECT_NAME}_LIBRARY_DIRS) - REMOVE_GLOBAL_DUPLICATES(${PROJECT_NAME}_LIBRARIES) + remove_global_duplicates(${PROJECT_NAME}_INCLUDE_DIRS) + remove_global_duplicates(${PROJECT_NAME}_LIBRARY_DIRS) + remove_global_duplicates(${PROJECT_NAME}_LIBRARIES) # Add global 'libs' target - IF(ENABLED_PACKAGE_LIBS_TARGETS) - LIST(REVERSE ENABLED_PACKAGE_LIBS_TARGETS) + if(ENABLED_PACKAGE_LIBS_TARGETS) + list(REVERSE ENABLED_PACKAGE_LIBS_TARGETS) # Make it so when no packages are enabled it is not a cmake error - IF (${PROJECT_NAME}_EXTRA_LINK_FLAGS) - APPEND_SET(ENABLED_PACKAGE_LIBS_TARGETS last_lib) - ENDIF() - #PRINT_VAR(ENABLED_PACKAGE_LIBS_TARGETS) - IF (NOT TARGET ${PROJECT_NAME}_libs) - ADD_CUSTOM_TARGET(${PROJECT_NAME}_libs) - ADD_DEPENDENCIES(${PROJECT_NAME}_libs ${ENABLED_PACKAGE_LIBS_TARGETS}) - ENDIF() - ADD_CUSTOM_TARGET(libs) - ADD_DEPENDENCIES(libs ${ENABLED_PACKAGE_LIBS_TARGETS}) - ENDIF() - - ENDIF() - - TRIBITS_CONFIG_CODE_STOP_TIMER(CONFIGURE_PACKAGES_TIME_START_SECONDS + if (${PROJECT_NAME}_EXTRA_LINK_FLAGS) + append_set(ENABLED_PACKAGE_LIBS_TARGETS last_lib) + endif() + #print_var(ENABLED_PACKAGE_LIBS_TARGETS) + if (NOT TARGET ${PROJECT_NAME}_libs) + add_custom_target(${PROJECT_NAME}_libs) + add_dependencies(${PROJECT_NAME}_libs ${ENABLED_PACKAGE_LIBS_TARGETS}) + endif() + add_custom_target(libs) + add_dependencies(libs ${ENABLED_PACKAGE_LIBS_TARGETS}) + endif() + + # Add empty _libs targets for top-level packages if asked + if (${PROJECT_NAME}_DEFINE_MISSING_PACKAGE_LIBS_TARGETS) + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) + if (NOT TARGET ${TRIBITS_PACKAGE}_libs) + add_custom_target(${TRIBITS_PACKAGE}_libs + COMMENT "Dummy target for ${TRIBITS_PACKAGE}_libs that builds nothing!") + endif() + endforeach() + endif() + # NOTE: For motivation for above, see the comment about the setting of + # ${PROJECT_NAME}_DEFINE_MISSING_PACKAGE_LIBS_TARGETS=ON in + # package-by-package mode in tribits_ctest_driver(). This option is + # purposefully not documented and not defined as a cache variable since it + # is an internal TriBITS implementation detail. + + endif() + + tribits_config_code_stop_timer(CONFIGURE_PACKAGES_TIME_START_SECONDS "\nTotal time to configure enabled packages") -ENDMACRO() +endmacro() -# # Set up for packaging and distribution # -MACRO(TRIBITS_SETUP_PACKAGING_AND_DISTRIBUTION) +macro(tribits_setup_packaging_and_distribution) - TRIBITS_CONFIG_CODE_START_TIMER(CPACK_SETUP_TIME_START_SECONDS) + tribits_config_code_start_timer(CPACK_SETUP_TIME_START_SECONDS) # K.1) Run callback function for the base project. - TRIBITS_PROJECT_DEFINE_PACKAGING_RUNNER() + tribits_project_define_packaging_runner() # The above must define the basic project settings for CPACK that are # specific to the project and should not be provided by the user. # K.2) Removing any packages or SE packages not enabled from the tarball - IF (${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION) - SET(_SE_OR_FULL_PACKAGES ${${PROJECT_NAME}_SE_PACKAGES}) - ELSE() - SET(_SE_OR_FULL_PACKAGES ${${PROJECT_NAME}_PACKAGES}) - ENDIF() + if (${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION) + set(_SE_OR_FULL_PACKAGES ${${PROJECT_NAME}_SE_PACKAGES}) + else() + set(_SE_OR_FULL_PACKAGES ${${PROJECT_NAME}_PACKAGES}) + endif() - TRIBITS_GET_NONENABLED_LIST( + tribits_get_nonenabled_list( _SE_OR_FULL_PACKAGES ${PROJECT_NAME} NON_ENABLED_SE_OR_FULL_PACKAGES NUM_NON_ENABLED_SE_OR_FULL_PACKAGES) - #PRINT_VAR(NON_ENABLED_SE_OR_FULL_PACKAGES) + #print_var(NON_ENABLED_SE_OR_FULL_PACKAGES) - FOREACH(TRIBITS_PACKAGE ${NON_ENABLED_SE_OR_FULL_PACKAGES}) + foreach(TRIBITS_PACKAGE ${NON_ENABLED_SE_OR_FULL_PACKAGES}) # Determine if this is a package to not ignore - FIND_LIST_ELEMENT(TRIBITS_CPACK_PACKAGES_TO_NOT_IGNORE + find_list_element(TRIBITS_CPACK_PACKAGES_TO_NOT_IGNORE ${TRIBITS_PACKAGE} TRIBITS_PACKAGE_DONT_IGNORE) - IF (NOT TRIBITS_PACKAGE_DONT_IGNORE) + if (NOT TRIBITS_PACKAGE_DONT_IGNORE) # Checking if we have a relative path to the package's files. Since the - # exclude is a regular expression any "../" will be interpretted as / which would never match the package's actual # directory. There isn't a direct way in cmake to convert a relative # path into an absolute path with string operations so as a way of @@ -2488,167 +2467,167 @@ MACRO(TRIBITS_SETUP_PACKAGING_AND_DISTRIBUTION) # find_path for the CMakeLists.txt file for the package. Since the # package has to have this file to work correctly it should be # guaranteed to be there. - STRING(REGEX MATCH "[.][.]/" RELATIVE_PATH_CHARS_MATCH + string(REGEX MATCH "[.][.]/" RELATIVE_PATH_CHARS_MATCH ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) - IF ("${RELATIVE_PATH_CHARS_MATCH}" STREQUAL "") - SET(CPACK_SOURCE_IGNORE_FILES + if ("${RELATIVE_PATH_CHARS_MATCH}" STREQUAL "") + set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}/" ${CPACK_SOURCE_IGNORE_FILES}) - ELSE() - FIND_PATH(ABSOLUTE_PATH CMakeLists.txt PATHS + else() + find_path(ABSOLUTE_PATH CMakeLists.txt PATHS "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}" NO_DEFAULT_PATH) - IF ("${ABSOLUTE_PATH}" STREQUAL "ABSOLUTE_PATH-NOTFOUND") - MESSAGE(AUTHOR_WARNING "Relative path found for disabled package" + 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." " This disabled package will likely not be excluded from a source release") - ENDIF() - SET(CPACK_SOURCE_IGNORE_FILES ${ABSOLUTE_PATH} ${CPACK_SOURCE_IGNORE_FILES}) - ENDIF() - ENDIF() + endif() + set(CPACK_SOURCE_IGNORE_FILES ${ABSOLUTE_PATH} ${CPACK_SOURCE_IGNORE_FILES}) + endif() + endif() - ENDFOREACH() + endforeach() # Add excludes for VC files/dirs - SET(CPACK_SOURCE_IGNORE_FILES + set(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES} /[.]git/ [.]gitignore$ ) # Print the set of excluded files - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE OR + if(${PROJECT_NAME}_VERBOSE_CONFIGURE OR ${PROJECT_NAME}_DUMP_CPACK_SOURCE_IGNORE_FILES ) - MESSAGE("Exclude files when building source packages") - FOREACH(item ${CPACK_SOURCE_IGNORE_FILES}) - MESSAGE(${item}) - ENDFOREACH() - ENDIF() + message("Exclude files when building source packages") + foreach(item ${CPACK_SOURCE_IGNORE_FILES}) + message(${item}) + endforeach() + endif() # K.3) Set up install component dependencies - TRIBITS_GET_ENABLED_LIST( + tribits_get_enabled_list( ${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) #message("ENABLED PACKAGES: ${ENABLED_PACKAGES} ${NUM_ENABLED}") - FOREACH(PKG ${ENABLED_PACKAGES}) - IF(NOT "${${PKG}_LIB_REQUIRED_DEP_PACKAGES}" STREQUAL "") + foreach(PKG ${ENABLED_PACKAGES}) + if(NOT "${${PKG}_LIB_REQUIRED_DEP_PACKAGES}" STREQUAL "") string(TOUPPER ${PKG} UPPER_PKG) #message("${UPPER_PKG} depends on : ${${PKG}_LIB_REQUIRED_DEP_PACKAGES}") - SET(CPACK_COMPONENT_${UPPER_PKG}_DEPENDS ${${PKG}_LIB_REQUIRED_DEP_PACKAGES}) - ENDIF() + set(CPACK_COMPONENT_${UPPER_PKG}_DEPENDS ${${PKG}_LIB_REQUIRED_DEP_PACKAGES}) + endif() #message("${PKG} depends on : ${${PKG}_LIB_REQUIRED_DEP_PACKAGES}") - ENDFOREACH() + endforeach() - # K.4) Resetting the name to avoid overwriting registery keys when installing + # K.4) Resetting the name to avoid overwriting registry keys when installing - IF(WIN32) - SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-${${PROJECT_NAME}_VERSION}") - IF (TPL_ENABLE_MPI) - SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-mpi") + if(WIN32) + set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-${${PROJECT_NAME}_VERSION}") + if (TPL_ENABLE_MPI) + set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-mpi") ELSE () - SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-serial") - ENDIF() - SET(CPACK_GENERATOR "NSIS") - SET(CPACK_NSIS_MODIFY_PATH OFF) - ENDIF() + set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-serial") + endif() + set(CPACK_GENERATOR "NSIS") + set(CPACK_NSIS_MODIFY_PATH OFF) + endif() # K.5) Determine the source generator - IF ("${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT "TGZ") - ENDIF() - SET(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR + if ("${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT "TGZ") + endif() + set(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR ${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT} CACHE STRING "The types of source generators to use for CPACK_SOURCE_GENERATOR.") - SET(CPACK_SOURCE_GENERATOR ${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR}) + set(CPACK_SOURCE_GENERATOR ${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR}) # K.6) Loop through the Repositories and run their callback functions. - FOREACH(REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) - TRIBITS_GET_REPO_NAME_DIR(${REPO} REPO_NAME REPO_DIR) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Processing packaging call-backs for ${REPO_NAME}") - ENDIF() - TRIBITS_REPOSITORY_DEFINE_PACKAGING_RUNNER(${REPO_NAME}) - ENDFOREACH() + foreach(REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) + tribits_get_repo_name_dir(${REPO} REPO_NAME REPO_DIR) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing packaging call-backs for ${REPO_NAME}") + endif() + tribits_repository_define_packaging_runner(${REPO_NAME}) + endforeach() # K.7) Include RepoVersion.txt if generated - SET(PROJECT_REPO_VERSION_FILE + set(PROJECT_REPO_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}") - IF (EXISTS "${PROJECT_REPO_VERSION_FILE}") - FOREACH(SOURCE_GEN ${CPACK_SOURCE_GENERATOR}) - SET(CPACK_INSTALL_COMMANDS ${CPACK_INSTALL_COMMANDS} + if (EXISTS "${PROJECT_REPO_VERSION_FILE}") + foreach(SOURCE_GEN ${CPACK_SOURCE_GENERATOR}) + set(CPACK_INSTALL_COMMANDS ${CPACK_INSTALL_COMMANDS} "${CMAKE_COMMAND} -E copy '${PROJECT_REPO_VERSION_FILE}' '${CMAKE_CURRENT_BINARY_DIR}/_CPack_Packages/Linux-Source/${SOURCE_GEN}/${CPACK_PACKAGE_NAME}-${${PROJECT_NAME}_VERSION}-Source/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}'") - ENDFOREACH() - ENDIF() + endforeach() + endif() # K.8) Finally process with CPack - INCLUDE(CPack) + include(CPack) - TRIBITS_CONFIG_CODE_STOP_TIMER(CPACK_SETUP_TIME_START_SECONDS + tribits_config_code_stop_timer(CPACK_SETUP_TIME_START_SECONDS "Total time to set up for CPack packaging") -ENDMACRO() +endmacro() # Create custom 'install_package_by_package' target -FUNCTION(TRIBITS_ADD_INSTALL_PACKAGE_BY_PACKAGE_TARGET) +# +function(tribits_add_install_package_by_package_target) - SET(TRIBITS_ENABLED_PACKAGES_BINARY_DIRS) - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) - LIST(APPEND TRIBITS_ENABLED_PACKAGES_BINARY_DIRS "${${TRIBITS_PACKAGE}_BINARY_DIR}") - ENDFOREACH() + set(TRIBITS_ENABLED_PACKAGES_BINARY_DIRS) + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) + list(APPEND TRIBITS_ENABLED_PACKAGES_BINARY_DIRS "${${TRIBITS_PACKAGE}_BINARY_DIR}") + endforeach() - SET(tribits_install_src + set(tribits_install_src "${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}") - CONFIGURE_FILE( + configure_file( "${tribits_install_src}/cmake_pbp_install.cmake.in" cmake_pbp_install.cmake @ONLY ) - ADVANCED_SET(${PROJECT_NAME}_INSTALL_PBP_RUNNER "" CACHE FILEPATH + advanced_set(${PROJECT_NAME}_INSTALL_PBP_RUNNER "" CACHE FILEPATH "Program used to run cmake -P cmake_pbp_install.cmake to change user for 'install_package_by_package' target") - ADD_CUSTOM_TARGET(install_package_by_package + add_custom_target(install_package_by_package ${${PROJECT_NAME}_INSTALL_PBP_RUNNER} ${CMAKE_COMMAND} -P cmake_pbp_install.cmake WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ) -ENDFUNCTION() +endfunction() -MACRO(TRIBITS_SETUP_FOR_INSTALLATION) +macro(tribits_setup_for_installation) # Set up to install Config.cmake, Config.cmake, and export # makefiles. - ADD_SUBDIRECTORY( + add_subdirectory( "${${PROJECT_NAME}_TRIBITS_DIR}/core/installation/add_project_install_commands" add_project_install_commands) # Set up for fixing group and permissions after the install - ADD_SUBDIRECTORY( + add_subdirectory( "${${PROJECT_NAME}_TRIBITS_DIR}/core/installation/add_install_group_and_perms_fixups" add_install_group_and_perms_fixups) # Create custom 'install_package_by_package' target - TRIBITS_ADD_INSTALL_PACKAGE_BY_PACKAGE_TARGET() + tribits_add_install_package_by_package_target() -ENDMACRO() +endmacro() -# -# @MACRO: TRIBITS_EXCLUDE_FILES() +# @MACRO: tribits_exclude_files() # # Exclude package files/dirs from the source distribution by appending # ``CPACK_SOURCE_IGNORE_FILES``. # # Usage:: # -# TRIBITS_EXCLUDE_FILES( ...) +# tribits_exclude_files( ...) # # This is called in the top-level parent package's # `/CMakeLists.txt`_ file and each file or directory name @@ -2670,58 +2649,56 @@ ENDMACRO() # to match files that get excluded from the tarball. For more details, see # `Creating Source Distributions`_. # -MACRO(TRIBITS_EXCLUDE_FILES) +macro(tribits_exclude_files) - IF (NOT "${${PACKAGE_NAME}_PARENT_PACKAGE}" STREQUAL "") - MESSAGE(FATAL_ERROR - "ERROR: TRIBITS_EXCLUDE_FILES() was called in a subpackage CmakeLists.txt file!" + if (NOT "${${PACKAGE_NAME}_PARENT_PACKAGE}" STREQUAL "") + message(FATAL_ERROR + "ERROR: tribits_exclude_files() was called in a subpackage CmakeLists.txt file!" " Instead, move this call to the file" " ${${${PACKAGE_NAME}_PARENT_PACKAGE}_SOURCE_DIR}/CMakeLists.txt" - " and adjust the paths accodingly!" ) - ENDIF() + " and adjust the paths accordingly!" ) + endif() - SET(FILES_TO_EXCLUDE ${ARGN}) + set(FILES_TO_EXCLUDE ${ARGN}) # Need to add "///" to each file to prevent # someone from trying to exclude a file like "readme" and having it # inadvertently exclude a file matching that name in another package. - SET(MODIFIED_FILES_TO_EXCLUDE "") + set(MODIFIED_FILES_TO_EXCLUDE "") - SET(${PROJECT_NAME}_SOURCE_PATH ${${PROJECT_NAME}_SOURCE_DIR}) + set(${PROJECT_NAME}_SOURCE_PATH ${${PROJECT_NAME}_SOURCE_DIR}) - FOREACH(FILE ${FILES_TO_EXCLUDE}) + foreach(FILE ${FILES_TO_EXCLUDE}) #Ensure that if the full path was specified for the file that we don't add #"///" again. - SET(MATCH_STRING "${${PACKAGE_NAME}_SOURCE_DIR}") - STRING(REGEX MATCH ${MATCH_STRING} MATCHED ${FILE} ) - IF(NOT MATCHED) - LIST(APPEND MODIFIED_FILES_TO_EXCLUDE + set(MATCH_STRING "${${PACKAGE_NAME}_SOURCE_DIR}") + string(REGEX MATCH ${MATCH_STRING} MATCHED ${FILE} ) + if(NOT MATCHED) + list(APPEND MODIFIED_FILES_TO_EXCLUDE "${${PACKAGE_NAME}_SOURCE_DIR}/${FILE}") - ELSE() - LIST(APPEND MODIFIED_FILES_TO_EXCLUDE ${FILE}) - ENDIF() - ENDFOREACH() + else() + list(APPEND MODIFIED_FILES_TO_EXCLUDE ${FILE}) + endif() + endforeach() #Leaving in for debugging purposes -# MESSAGE("List of files being excluded for package ${PACKAGE_NAME}") -# FOREACH(NEW_FILE ${MODIFIED_FILES_TO_EXCLUDE}) -# MESSAGE(${NEW_FILE}) -# ENDFOREACH() +# message("List of files being excluded for package ${PACKAGE_NAME}") +# foreach(NEW_FILE ${MODIFIED_FILES_TO_EXCLUDE}) +# message(${NEW_FILE}) +# endforeach() - LIST(APPEND CPACK_SOURCE_IGNORE_FILES ${MODIFIED_FILES_TO_EXCLUDE}) - IF (NOT ${PROJECT_NAME}_BINARY_DIR STREQUAL ${PACKAGE_NAME}_BINARY_DIR) - SET(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES} PARENT_SCOPE) - ENDIF() + list(APPEND CPACK_SOURCE_IGNORE_FILES ${MODIFIED_FILES_TO_EXCLUDE}) + if (NOT ${PROJECT_NAME}_BINARY_DIR STREQUAL ${PACKAGE_NAME}_BINARY_DIR) + set(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES} PARENT_SCOPE) + endif() -ENDMACRO() +endmacro() +# Exclude files only for the packages that will not be supporting autotools. # -# Macro for helping set up exclude files only for the packages that will not -# be supporting autotools. -# -MACRO(TRIBITS_EXCLUDE_AUTOTOOLS_FILES) # PACKAGE_NAME LIST_RETURN) - SET(AUTOTOOLS_FILES +macro(tribits_exclude_autotools_files) # PACKAGE_NAME LIST_RETURN) + set(AUTOTOOLS_FILES configure.ac$ configure$ Makefile.am$ @@ -2731,11 +2708,20 @@ MACRO(TRIBITS_EXCLUDE_AUTOTOOLS_FILES) # PACKAGE_NAME LIST_RETURN) config/ ) - SET(FILES_TO_EXCLUDE) - FOREACH(FILE ${AUTOTOOLS_FILES}) - LIST(APPEND FILES_TO_EXCLUDE ${FILE} \(.*/\)*${FILE}) - ENDFOREACH() + set(FILES_TO_EXCLUDE) + foreach(FILE ${AUTOTOOLS_FILES}) + list(APPEND FILES_TO_EXCLUDE ${FILE} \(.*/\)*${FILE}) + endforeach() + + tribits_exclude_files(${FILES_TO_EXCLUDE}) - TRIBITS_EXCLUDE_FILES(${FILES_TO_EXCLUDE}) +endmacro() -ENDMACRO() +# LocalWords: +# LocalWords: Sandia SANDIA Redistributions +# LocalWords: tribits TriBITS TRIBITS +# LocalWords: cmake CMake CMAKE CMakeCache CMakeFiles +# LocalWords: ctest CPACK +# LocalWords: foreach endforeach endif endmacro +# LocalWords: BOOL +# LocalWords: libs LIBS config PackageName SUBPACKAGES nonenabled diff --git a/cmake/tribits/core/package_arch/TribitsHostType.cmake b/cmake/tribits/core/package_arch/TribitsHostType.cmake index 2a4aea62cca8..1a554159b404 100644 --- a/cmake/tribits/core/package_arch/TribitsHostType.cmake +++ b/cmake/tribits/core/package_arch/TribitsHostType.cmake @@ -37,11 +37,11 @@ # ************************************************************************ # @HEADER -INCLUDE(AdvancedSet) +include(AdvancedSet) -SET( ${PROJECT_NAME}_HOSTTYPE_DEFAULT ${CMAKE_HOST_SYSTEM_NAME} ) +set( ${PROJECT_NAME}_HOSTTYPE_DEFAULT ${CMAKE_HOST_SYSTEM_NAME} ) -ADVANCED_SET( ${PROJECT_NAME}_HOSTTYPE ${${PROJECT_NAME}_HOSTTYPE_DEFAULT} +advanced_set( ${PROJECT_NAME}_HOSTTYPE ${${PROJECT_NAME}_HOSTTYPE_DEFAULT} CACHE STRING "Name used to identify a system system type (defaults to ${CMAKE_HOST_SYSTEM_NAME})" ) diff --git a/cmake/tribits/core/package_arch/TribitsIncludeDirectories.cmake b/cmake/tribits/core/package_arch/TribitsIncludeDirectories.cmake index 372d272583a0..c1de80edcc9b 100644 --- a/cmake/tribits/core/package_arch/TribitsIncludeDirectories.cmake +++ b/cmake/tribits/core/package_arch/TribitsIncludeDirectories.cmake @@ -37,18 +37,18 @@ # ************************************************************************ # @HEADER -INCLUDE(CMakeParseArguments) +include(CMakeParseArguments) # -# @MACRO: TRIBITS_INCLUDE_DIRECTORIES() +# @MACRO: tribits_include_directories() # # This function is to override the standard behavior of the built-in CMake -# ``INCLUDE_DIRECTORIES()`` command. +# ``include_directories()`` command. # # Usage:: # -# TRIBITS_INCLUDE_DIRECTORIES( +# tribits_include_directories( # [REQUIRED_DURING_INSTALLATION_TESTING] ... # ) # @@ -56,7 +56,7 @@ INCLUDE(CMakeParseArguments) # in the argument list. # # This function allows overriding the default behavior of -# ``INCLUDE_DIRECTORIES()`` for installation testing, to ensure that include +# ``include_directories()`` for installation testing, to ensure that include # directories will not be inadvertently added to the build lines for tests # during installation testing (see `Installation and Backward Compatibility # Testing`_). Normally we want the include directories to be handled as cmake @@ -67,9 +67,9 @@ INCLUDE(CMakeParseArguments) # needed. For that case ``REQUIRED_DURING_INSTALLATION_TESTING`` must be # passed in to ensure the include paths are added for installation testing. # -MACRO(TRIBITS_INCLUDE_DIRECTORIES) +macro(tribits_include_directories) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -81,16 +81,16 @@ MACRO(TRIBITS_INCLUDE_DIRECTORIES) ${ARGN} ) - IF(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) - _INCLUDE_DIRECTORIES(${PARSE_UNPARSED_ARGUMENTS}) - ENDIF() -ENDMACRO() + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) + _include_directories(${PARSE_UNPARSED_ARGUMENTS}) + endif() +endmacro() -# Deprecated. Use TRIBITS_INCLUDE_DIRECTORIES() instead! -MACRO(INCLUDE_DIRECTORIES) +# Deprecated. Use tribits_include_directories() instead! +macro(include_directories) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -102,12 +102,12 @@ MACRO(INCLUDE_DIRECTORIES) ${ARGN} ) -# IF (PARSE_REQUIRED_DURING_INSTALLATION_TESTING) -# MESSAGE(WARNING "Warning: the override INCLUDE_DIRECTORIES() is deprecated," -# " use TRIBITS_INCLUDE_DIRECTORIES() instead!") -# ENDIF() +# if (PARSE_REQUIRED_DURING_INSTALLATION_TESTING) +# message(WARNING "Warning: the override include_directories() is deprecated," +# " use tribits_include_directories() instead!") +# endif() - IF(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) - _INCLUDE_DIRECTORIES(${PARSE_UNPARSED_ARGUMENTS}) - ENDIF() -ENDMACRO() + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) + _include_directories(${PARSE_UNPARSED_ARGUMENTS}) + endif() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake b/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake index 867c7cc115c7..8f875dfd95d6 100644 --- a/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake +++ b/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake @@ -38,18 +38,18 @@ # @HEADER -INCLUDE(CMakeParseArguments) +include(CMakeParseArguments) # -# @FUNCTION: TRIBITS_INSTALL_HEADERS() +# @FUNCTION: tribits_install_headers() # -# Function used to (optionally) install header files using ``INSTALL()`` +# Function used to (optionally) install header files using ``install()`` # command. # # Usage:: # -# TRIBITS_INSTALL_HEADERS( +# tribits_install_headers( # HEADERS

... # [INSTALL_SUBDIR ] # [COMPONENT ] @@ -75,22 +75,22 @@ INCLUDE(CMakeParseArguments) # ``COMPONENT `` # # If specified, then ``COMPONENT `` will be passed into -# ``INSTALL()``. Otherwise, ``COMPONENT ${PROJECT_NAME}`` will get used. +# ``install()``. Otherwise, ``COMPONENT ${PROJECT_NAME}`` will get used. # # If `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FASLE``, then the # headers will not get installed. # -FUNCTION(TRIBITS_INSTALL_HEADERS) +function(tribits_install_headers) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - SET(TRIBITS_INSTALL_HEADERS_DEBUG_DUMP TRUE) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + set(TRIBITS_INSTALL_HEADERS_DEBUG_DUMP TRUE) + endif() - IF (TRIBITS_INSTALL_HEADERS_DEBUG_DUMP) - MESSAGE("\nTRIBITS_INSTALL_HEADERS: ${ARGN}") - ENDIF() + if (TRIBITS_INSTALL_HEADERS_DEBUG_DUMP) + message("\nTRIBITS_INSTALL_HEADERS: ${ARGN}") + endif() - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #Options @@ -102,33 +102,33 @@ FUNCTION(TRIBITS_INSTALL_HEADERS) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() # ToDo: Assert PARSE_HEADERS has at least one argument! - # ToDo: Assert PARSE_INSTALL_DIR has 0 or 1 argumnets! - # ToDo: Assert PARSE_COMONENT has 0 or 1 argumnets! + # ToDo: Assert PARSE_INSTALL_DIR has 0 or 1 arguments! + # ToDo: Assert PARSE_COMONENT has 0 or 1 arguments! - IF (PARSE_INSTALL_SUBDIR) - SET(INSTALL_DIR "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}/${PARSE_INSTALL_SUBDIR}") - ELSE() - SET(INSTALL_DIR "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") - ENDIF() + if (PARSE_INSTALL_SUBDIR) + set(INSTALL_DIR "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}/${PARSE_INSTALL_SUBDIR}") + else() + set(INSTALL_DIR "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") + endif() - IF (PARSE_COMPONENT) - SET(COMPONENT ${PARSE_COMPONENT}) - ELSE() - SET(COMPONENT ${PROJECT_NAME}) - ENDIF() + if (PARSE_COMPONENT) + set(COMPONENT ${PARSE_COMPONENT}) + else() + set(COMPONENT ${PROJECT_NAME}) + endif() - IF (${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS) - IF (TRIBITS_INSTALL_HEADERS_DEBUG_DUMP) - MESSAGE("\nTRIBITS_INSTALL_HEADERS: Installing headers into '${INSTALL_DIR}'") - ENDIF() - INSTALL( + if (${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS) + if (TRIBITS_INSTALL_HEADERS_DEBUG_DUMP) + message("\nTRIBITS_INSTALL_HEADERS: Installing headers into '${INSTALL_DIR}'") + endif() + install( FILES ${PARSE_HEADERS} DESTINATION "${INSTALL_DIR}" COMPONENT ${COMPONENT} ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsLibraryMacros.cmake b/cmake/tribits/core/package_arch/TribitsLibraryMacros.cmake index 50ab4a0c4727..cc97f07b5e0f 100644 --- a/cmake/tribits/core/package_arch/TribitsLibraryMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsLibraryMacros.cmake @@ -37,18 +37,18 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsCreateClientTemplateHeaders) -INCLUDE(CMakeParseArguments) -INCLUDE(GlobalSet) -INCLUDE(AppendSet) -INCLUDE(AppendGlob) -INCLUDE(AppendGlobalSet) -INCLUDE(AppendStringVar) -INCLUDE(PrependGlobalSet) -INCLUDE(RemoveGlobalDuplicates) -INCLUDE(TribitsGeneralMacros) -INCLUDE(TribitsReportInvalidTribitsUsage) -INCLUDE(SetAndIncDirs) +include(TribitsCreateClientTemplateHeaders) +include(CMakeParseArguments) +include(GlobalSet) +include(AppendSet) +include(AppendGlob) +include(AppendGlobalSet) +include(AppendStringVar) +include(PrependGlobalSet) +include(RemoveGlobalDuplicates) +include(TribitsGeneralMacros) +include(TribitsReportInvalidTribitsUsage) +include(SetAndIncDirs) ### ### WARNING: See "NOTES TO DEVELOPERS" at the bottom of the file @@ -59,28 +59,28 @@ INCLUDE(SetAndIncDirs) # # Macro that configures the package's main config.h file # -FUNCTION(TRIBITS_ADD_CONFIG_DEFINE DEFINE) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "Package ${PARENT_PACKAGE_NAME}: adding compiler" +function(tribits_add_config_define DEFINE) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "Package ${PARENT_PACKAGE_NAME}: adding compiler" " define to config file: ${DEFINE}") - ENDIF() - GLOBAL_SET(${PARENT_PACKAGE_NAME}_CONFIG_DEFINES + endif() + global_set(${PARENT_PACKAGE_NAME}_CONFIG_DEFINES "${${PARENT_PACKAGE_NAME}_CONFIG_DEFINES}\n#define ${DEFINE}") - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- ${${PARENT_PACKAGE_NAME}_CONFIG_DEFINES}") - ENDIF() -ENDFUNCTION() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- ${${PARENT_PACKAGE_NAME}_CONFIG_DEFINES}") + endif() +endfunction() # -# @FUNCTION: TRIBITS_CONFIGURE_FILE() +# @FUNCTION: tribits_configure_file() # # Macro that configures the package's main configured header file (typically # called ``${PACKAGE_NAME}_config.h`` but any name can be used). # # Usage:: # -# TRIBITS_CONFIGURE_FILE() +# tribits_configure_file() # # This function requires the file:: # @@ -90,26 +90,26 @@ ENDFUNCTION() # # ${CMAKE_CURRENT_BINARY_DIR}/ # -# by calling the built-in ``CONFIGURE_FILE()`` command:: +# by calling the built-in ``configure_file()`` command:: # -# CONFIGURE_FILE( +# configure_file( # ${PACKAGE_SOURCE_DIR}/cmake/.in # ${CMAKE_CURRENT_BINARY_DIR}/ # ) # # which does basic substitution of CMake variables (see documentation for -# built-in CMake `CONFIGURE_FILE()`_ command for rules on how it performs +# built-in CMake `configure_file()`_ command for rules on how it performs # substitutions). This command is typically used to configure the package's # main `/cmake/_config.h.in`_ file. # -# In addition to just calling ``CONFIGURE_FILE()``, this function also aids in +# In addition to just calling ``configure_file()``, this function also aids in # creating configured header files adding macros for deprecating code as # described below. # # **Deprecated Code Macros** # # If ``${PARENT_PACKAGE_NAME}_SHOW_DEPRECATED_WARNINGS`` is ``TRUE`` (see -# `TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION()`_), then the local CMake +# `tribits_add_show_deprecated_warnings_option()`_), then the local CMake # variable ``${PARENT_PACKAGE_NAME_UC}_DEPRECATED_DECLARATIONS`` is set which # adds a define ``_DEPRECATED`` (where # ```` is the package name in all upper-case letters) @@ -130,15 +130,15 @@ ENDFUNCTION() # macro is defined to be empty. See `Regulated Backward Compatibility and # Deprecated Code`_ for more details. # -FUNCTION(TRIBITS_CONFIGURE_FILE PACKAGE_NAME_CONFIG_FILE) +function(tribits_configure_file PACKAGE_NAME_CONFIG_FILE) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nPACKAGE_CONFIGURE_FILE: ${PACKAGE_NAME_CONFIG_FILE}") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nPACKAGE_CONFIGURE_FILE: ${PACKAGE_NAME_CONFIG_FILE}") + endif() # Set up the deprecated attribute if showing deprecated warnings - IF (${PARENT_PACKAGE_NAME}_SHOW_DEPRECATED_WARNINGS) - MULTILINE_SET(${PARENT_PACKAGE_NAME_UC}_DEPRECATED_DECLARATIONS + if (${PARENT_PACKAGE_NAME}_SHOW_DEPRECATED_WARNINGS) + multiline_set(${PARENT_PACKAGE_NAME_UC}_DEPRECATED_DECLARATIONS "#ifndef ${PARENT_PACKAGE_NAME_UC}_DEPRECATED\n" "# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))\n" "# define ${PARENT_PACKAGE_NAME_UC}_DEPRECATED __attribute__((__deprecated__))\n" @@ -157,24 +157,24 @@ FUNCTION(TRIBITS_CONFIGURE_FILE PACKAGE_NAME_CONFIG_FILE) "# endif\n" "#endif\n" ) - ELSE() - MULTILINE_SET(${PARENT_PACKAGE_NAME_UC}_DEPRECATED_DECLARATIONS + else() + multiline_set(${PARENT_PACKAGE_NAME_UC}_DEPRECATED_DECLARATIONS "#define ${PARENT_PACKAGE_NAME_UC}_DEPRECATED\n" "#define ${PARENT_PACKAGE_NAME_UC}_DEPRECATED_MSG(MSG)\n" ) - ENDIF() + endif() - IF (${PARENT_PACKAGE_NAME}_HIDE_DEPRECATED_CODE) - APPEND_STRING_VAR(${PARENT_PACKAGE_NAME_UC}_DEPRECATED_DECLARATIONS + if (${PARENT_PACKAGE_NAME}_HIDE_DEPRECATED_CODE) + append_string_var(${PARENT_PACKAGE_NAME_UC}_DEPRECATED_DECLARATIONS "\n#define ${PARENT_PACKAGE_NAME_UC}_HIDE_DEPRECATED_CODE") - ENDIF() + endif() # Set up the macro to create the define for time monitor - SET(TIME_MONITOR_DEFINE_NAME ${PARENT_PACKAGE_NAME_UC}_TEUCHOS_TIME_MONITOR) - SET(FUNC_TIME_MONITOR_MACRO_NAME ${PARENT_PACKAGE_NAME_UC}_FUNC_TIME_MONITOR) - SET(FUNC_TIME_MONITOR_DIFF_MACRO_NAME ${PARENT_PACKAGE_NAME_UC}_FUNC_TIME_MONITOR_DIFF) - IF (${PARENT_PACKAGE_NAME}_ENABLE_TEUCHOS_TIME_MONITOR) - MULTILINE_SET(${PARENT_PACKAGE_NAME_UC}_TEUCHOS_TIME_MONITOR_DECLARATIONS + set(TIME_MONITOR_DEFINE_NAME ${PARENT_PACKAGE_NAME_UC}_TEUCHOS_TIME_MONITOR) + set(FUNC_TIME_MONITOR_MACRO_NAME ${PARENT_PACKAGE_NAME_UC}_FUNC_TIME_MONITOR) + set(FUNC_TIME_MONITOR_DIFF_MACRO_NAME ${PARENT_PACKAGE_NAME_UC}_FUNC_TIME_MONITOR_DIFF) + if (${PARENT_PACKAGE_NAME}_ENABLE_TEUCHOS_TIME_MONITOR) + multiline_set(${PARENT_PACKAGE_NAME_UC}_TEUCHOS_TIME_MONITOR_DECLARATIONS "#ifndef ${FUNC_TIME_MONITOR_MACRO_NAME}\n" "# define ${TIME_MONITOR_DEFINE_NAME}\n" "# define ${FUNC_TIME_MONITOR_MACRO_NAME}(FUNCNAME) \\\n" @@ -183,30 +183,30 @@ FUNCTION(TRIBITS_CONFIGURE_FILE PACKAGE_NAME_CONFIG_FILE) " TEUCHOS_FUNC_TIME_MONITOR_DIFF(FUNCNAME, DIFF)\n" "#endif\n" ) - ELSE() - MULTILINE_SET(${PARENT_PACKAGE_NAME_UC}_TEUCHOS_TIME_MONITOR_DECLARATIONS + else() + multiline_set(${PARENT_PACKAGE_NAME_UC}_TEUCHOS_TIME_MONITOR_DECLARATIONS "#define ${FUNC_TIME_MONITOR_MACRO_NAME}(FUNCNAME)\n" "#define ${FUNC_TIME_MONITOR_DIFF_MACRO_NAME}(FUNCNAME, DIFF)\n" ) - ENDIF() + endif() # Configure the file - CONFIGURE_FILE( + configure_file( ${PACKAGE_SOURCE_DIR}/cmake/${PACKAGE_NAME_CONFIG_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME_CONFIG_FILE} ) -ENDFUNCTION() +endfunction() # -# @FUNCTION: TRIBITS_ADD_LIBRARY() +# @FUNCTION: tribits_add_library() # -# Function used to add a CMake library and target using ``ADD_LIBRARY()``. +# Function used to add a CMake library and target using ``add_library()``. # # Usage:: # -# TRIBITS_ADD_LIBRARY( +# tribits_add_library( # # [HEADERS

...] # [HEADERS_INSTALL_SUBDIR ] @@ -223,15 +223,15 @@ ENDFUNCTION() # # *Sections:* # -# * `Formal Arguments (TRIBITS_ADD_LIBRARY())`_ -# * `Include Directories (TRIBITS_ADD_LIBRARY())`_ -# * `Install Targets (TRIBITS_ADD_LIBRARY())`_ -# * `Additional Library and Source File Properties (TRIBITS_ADD_LIBRARY())`_ -# * `Miscellaneous Notes (TRIBITS_ADD_LIBRARY())`_ +# * `Formal Arguments (tribits_add_library())`_ +# * `Include Directories (tribits_add_library())`_ +# * `Install Targets (tribits_add_library())`_ +# * `Additional Library and Source File Properties (tribits_add_library())`_ +# * `Miscellaneous Notes (tribits_add_library())`_ # -# .. _Formal Arguments (TRIBITS_ADD_LIBRARY()): +# .. _Formal Arguments (tribits_add_library()): # -# **Formal Arguments (TRIBITS_ADD_LIBRARY())** +# **Formal Arguments (tribits_add_library())** # # ```` # @@ -241,13 +241,13 @@ ENDFUNCTION() # # = ${${PROJECT_NAME}_LIBRARY_NAME_PREFIX} # -# This is the name passed to ``ADD_LIBRARY( ...)``. The +# This is the name passed to ``add_library( ...)``. The # name is *not* prefixed by the package name. CMake will of course add # any standard prefix or post-fix to the library file name appropriate for # the platform and if this is a static or shared library build (e.g. on # Linux prefix = ``'lib'``, postfix = ``'.so'`` for shared lib and postfix # = ``'.a'`` static lib) (see documentation for the built-in CMake command -# ``ADD_LIBRARY()``. +# ``add_library()``. # # ``HEADERS

...`` # @@ -255,10 +255,10 @@ ENDFUNCTION() # header files are assumed to be in the current source directory. They # can also contain the relative path or absolute path to the files if they # are not in the current source directory. This list of headers is passed -# into ``ADD_LIBRARY(...)`` as well (which is not strictly needed but is +# into ``add_library(...)`` as well (which is not strictly needed but is # helpful for some build tools, like MS Visual Studio). By default, these # headers will be installed (see `Install Targets -# (TRIBITS_ADD_LIBRARY())`_). +# (tribits_add_library())`_). # # ``HEADERS_INSTALL_SUBDIR `` # @@ -267,27 +267,27 @@ ENDFUNCTION() # headers will be installed under # ``${PROJECT_NAME}_INSTALL_INCLUDE_DIR}/``. Otherwise, # they will be installed under ``${PROJECT_NAME}_INSTALL_INCLUDE_DIR}/``. -# `Install Targets (TRIBITS_ADD_LIBRARY())`_. +# `Install Targets (tribits_add_library())`_. # # ``NOINSTALLHEADERS ...`` # # List of private header files which are used by this library. These # headers are not installed and do not needed to be passed in for any -# purpose other than to pass them into ``ADD_LIBRARY()`` as some build +# purpose other than to pass them into ``add_library()`` as some build # tools like to have these listed (e.g. MS Visual Studio). # # ``SOURCES ...`` # -# List of source files passed into ``ADD_LIBRARY()`` that are compiled +# List of source files passed into ``add_library()`` that are compiled # into header files and included in the library. The compiler used to # compile the files is determined automatically based on the file -# extension (see CMake documentation for ``ADD_LIBRARY()``). +# extension (see CMake documentation for ``add_library()``). # # ``DEPLIBS ...`` # # List of dependent libraries that are built in the current SE package # that this library is dependent on. These libraries are passed into -# ``TARGET_LINK_LIBRARIES( ...)`` so that CMake knows about +# ``target_link_libraries( ...)`` so that CMake knows about # the dependency structure of the libraries within this SE package. # **NOTE:** One must **not** list libraries in other upstream `TriBITS SE # Packages`_ or libraries built externally from this TriBITS CMake project @@ -300,7 +300,7 @@ ENDFUNCTION() # # List of dependent libraries built externally from this TriBITS CMake # project. These libraries are passed into -# ``TARGET_LINK_LIBRARIES( ...)`` so that CMake knows about +# ``target_link_libraries( ...)`` so that CMake knows about # the dependency. However, note that external libraries are often better # handled as `TriBITS TPLs`_. A well constructed TriBITS package and # library should never have to use this option! So far, the only case @@ -332,7 +332,7 @@ ENDFUNCTION() # ``${PACKAGE_NAME}_LIBRARIES`` and an install target for the library will # not be added. In this case, the current include directories will be set # in the global variable ``_INCLUDE_DIR`` which will be -# used in `TRIBITS_ADD_EXECUTABLE()`_ when a test-only library is linked +# used in `tribits_add_executable()`_ when a test-only library is linked # in through its ``DEPLIBS`` argument. # # ``NO_INSTALL_LIB_OR_HEADERS`` @@ -342,45 +342,45 @@ ENDFUNCTION() # # ``CUDALIBRARY`` # -# If specified then ``CUDA_ADD_LIBRARY()`` is used instead of -# ``ADD_LIBRARY()`` where ``CUDA_ADD_LIBRARY()`` is assumed to be defined +# If specified then ``cuda_add_library()`` is used instead of +# ``add_library()`` where ``cuda_add_library()`` is assumed to be defined # by the standard ``FindCUDA.cmake`` module as processed using the # standard TriBITS ``FindTPLCUDA.cmake`` file (see `Standard TriBITS # TPLs`_). For this option to work, this SE package must have an enabled # direct or indirect dependency on the TriBITS CUDA TPL or a # configure-time error may occur about not knowing about -# ``CUDA_ALL_LIBRARY()``. +# ``cuda_all_library()``. # # ``ADDED_LIB_TARGET_NAME_OUT `` # # If specified, then on output the variable ```` will be -# set with the name of the library passed to ``ADD_LIBRARY()``. Having +# set with the name of the library passed to ``add_library()``. Having # this name allows the calling ``CMakeLists.txt`` file access and set # additional target properties (see `Additional Library and Source File -# Properties (TRIBITS_ADD_LIBRARY())`_). +# Properties (tribits_add_library())`_). # -# .. _Include Directories (TRIBITS_ADD_LIBRARY()): +# .. _Include Directories (tribits_add_library()): # -# **Include Directories (TRIBITS_ADD_LIBRARY())** +# **Include Directories (tribits_add_library())** # # Any base directories for the header files listed in the arguments # ``HEADERS`` or ``NOINSTALLHEADERS`` should be passed into the standard CMake -# command ``INCLUDE_DIRECTORIES()`` **before** calling this function. For +# command ``include_directories()`` **before** calling this function. For # example, a CMakeLists.txt file will look like:: # # ... # -# TRIBITS_CONFIGURE_FILE(${PACKAGE_NAME}_config.h) -# CONFIGURE_FILE(...) +# tribits_configure_file(${PACKAGE_NAME}_config.h) +# configure_file(...) # # ... # -# INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -# INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +# include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +# include_directories(${CMAKE_CURRENT_BINARY_DIR}) # # ... # -# TRIBITS_ADD_LIBRARY( +# tribits_add_library( # SOURCES # .c # /.cpp @@ -395,13 +395,13 @@ ENDFUNCTION() # ) # # The include of ``${CMAKE_CURRENT_BINARY_DIR}`` is needed for any generated -# header files (e.g. using raw ``CONFIGURE_FILE()`` or -# `TRIBITS_CONFIGURE_FILE()`_) or any generated Fortran ``*.mod`` module files +# header files (e.g. using raw ``configure_file()`` or +# `tribits_configure_file()`_) or any generated Fortran ``*.mod`` module files # generated as a byproduct of compiling F90+ source files (that contain one or # more Fortran module declarations). # -# The function ``TRIBITS_ADD_LIBRARY()`` will grab the list of all of the -# include directories in scope from prior calls to ``INCLUDE_DIRECTORIES()`` +# The function ``tribits_add_library()`` will grab the list of all of the +# include directories in scope from prior calls to ``include_directories()`` # and will append these to the variable ``${PACKAGE_NAME}_INCLUDE_DIRS``. # This list of include directories is exported to downstream SE packages so # they appear on the compile lines of all downstream object file compiles. @@ -409,12 +409,12 @@ ENDFUNCTION() # up automatically (just by clearing dependencies in # `/cmake/Dependencies.cmake`_ files). # -# .. _Install Targets (TRIBITS_ADD_LIBRARY()): +# .. _Install Targets (tribits_add_library()): # -# **Install Targets (TRIBITS_ADD_LIBRARY())** +# **Install Targets (tribits_add_library())** # # By default, an install target for the library is created using -# ``INSTALL(TARGETS ...)`` to install into the directory +# ``install(TARGETS ...)`` to install into the directory # ``${CMAKE_INSTALL_PREFIX}/lib/`` (actual install directory is given by # ``${PROJECT}_INSTALL_LIB_DIR``, see `Setting the install prefix`_). # However, this install target will not get created if @@ -424,7 +424,7 @@ ENDFUNCTION() # ``TESTONLY`` or ``NO_INSTALL_LIB_OR_HEADERS`` are passed in. # # By default, an install target for the headers listed in ``HEADERS`` will get -# added using ``INSTALL(FILES

...)``, but only if ``TESTONLY`` and +# added using ``install(FILES

...)``, but only if ``TESTONLY`` and # ``NO_INSTALL_LIB_OR_HEADERS`` are not passed in as well. Also, the install # target for the headers will not get added if # `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FASLE``. If this @@ -437,99 +437,99 @@ ENDFUNCTION() # Note that an install target will *not* get created for the headers listed in # ``NOINSTALLHEADERS``. # -# .. _Additional Library and Source File Properties (TRIBITS_ADD_LIBRARY()): +# .. _Additional Library and Source File Properties (tribits_add_library()): # -# **Additional Library and Source File Properties (TRIBITS_ADD_LIBRARY())** +# **Additional Library and Source File Properties (tribits_add_library())** # -# Once ``ADD_LIBRARY( ... ...)`` is called, one +# Once ``add_library( ... ...)`` is called, one # can set and change properties on the ```` library target -# using the built-in CMake command ``SET_TARGET_PROPERTIES()`` as well as set +# using the built-in CMake command ``set_target_properties()`` as well as set # and change properties on any of the source files listed in ``SOURCES`` using -# the built-in CMake command ``SET_SOURCE_FILE_PROPERTIES()`` just like in any +# the built-in CMake command ``set_source_file_properties()`` just like in any # CMake project. For example:: # -# TRIBITS_ADD_LIBRARY( somelib ... +# tribits_add_library( somelib ... # ADDED_LIB_TARGET_NAME_OUT somelib_TARGET_NAME ) # -# SET_TARGET_PROPERTIES( ${somelib_TARGET_NAME} +# set_target_properties( ${somelib_TARGET_NAME} # PROPERTIES LINKER_LANGUAGE CXX ) # -# .. _Miscellaneous Notes (TRIBITS_ADD_LIBRARY()): +# .. _Miscellaneous Notes (tribits_add_library()): # -# **Miscellaneous Notes (TRIBITS_ADD_LIBRARY())** +# **Miscellaneous Notes (tribits_add_library())** # # When the file ``Version.cmake`` exists and the CMake variables # ``${PROJECT_NAME}_VERSION`` and ``${PROJECT_NAME}_MAJOR_VERSION`` are # defined, then produced shared libraries will be given the standard SOVERSION # symlinks (see `/Version.cmake`_). # -# **WARNING:** Do **NOT** use the built-in CMake command ``ADD_DEFINITIONS()`` +# **WARNING:** Do **NOT** use the built-in CMake command ``add_definitions()`` # to add defines ``-D`` to the compile command line that will # affect any of the header files in the package! These CMake-added defines # are only set locally in this directory and child directories. These defines # will **NOT** be set when code in peer directories (e.g. a downstream TriBITS # packages) compiles that may include these header files. To add defines that # affect header files, please use a configured header file (see -# `TRIBITS_CONFIGURE_FILE()`_). +# `tribits_configure_file()`_). # -FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) +function(tribits_add_library LIBRARY_NAME_IN) # # Confirm that package and subpackage macros/functions have been called in the correct order # - IF (CURRENTLY_PROCESSING_SUBPACKAGE) + if (CURRENTLY_PROCESSING_SUBPACKAGE) # This is a subpackage being processed - IF(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_SUBPACKAGE() before TRIBITS_ADD_LIBRARY()" + if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_subpackage() before tribits_add_library()" " in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - IF(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_ADD_LIBRARY() before " - " TRIBITS_SUBPACKAGE_POSTPROCESS() in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_add_library() before " + " tribits_subpackage_postprocess() in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") + endif() - ELSE() + else() # This is a package being processed - IF(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_PACKAGE() or TRIBITS_PACKAGE_DECL() before" - " TRIBITS_ADD_LIBRARY() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + if(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_package() or tribits_package_decl() before" + " tribits_add_library() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() - IF(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_ADD_LIBRARY() before " - " TRIBITS_PACKAGE_POSTPROCESS() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + if(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_add_library() before " + " tribits_package_postprocess() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() - ENDIF() + endif() - SET(LIBRARY_NAME_PREFIX "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}") - SET(LIBRARY_NAME ${LIBRARY_NAME_PREFIX}${LIBRARY_NAME_IN}) + set(LIBRARY_NAME_PREFIX "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}") + set(LIBRARY_NAME ${LIBRARY_NAME_PREFIX}${LIBRARY_NAME_IN}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nTRIBITS_ADD_LIBRARY: ${LIBRARY_NAME}") - IF(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) - MESSAGE("\n${PACKAGE_NAME}_LIBRARIES In installation testing mode," + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nTRIBITS_ADD_LIBRARY: ${LIBRARY_NAME}") + if(${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) + message("\n${PACKAGE_NAME}_LIBRARIES In installation testing mode," " libraries will be found instead of created.") - ENDIF() - ENDIF() + endif() + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PACKAGE_NAME}_INCLUDE_DIRS) - PRINT_VAR(${PACKAGE_NAME}_LIBRARY_DIRS) - PRINT_VAR(${PACKAGE_NAME}_LIBRARIES) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${PACKAGE_NAME}_INCLUDE_DIRS) + print_var(${PACKAGE_NAME}_LIBRARY_DIRS) + print_var(${PACKAGE_NAME}_LIBRARIES) + endif() - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #Options @@ -541,31 +541,31 @@ FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() # ToDo: Assert that HEADERS_INSTALL_SUBDIR has 0 or 1 entries! # ToDo: Assert that ADDED_LIB_TARGET_NAME_OUT as 0 or 1 entries! - IF(PARSE_HEADERS) - LIST(REMOVE_DUPLICATES PARSE_HEADERS) - ENDIF() - IF(PARSE_SOURCES) - LIST(REMOVE_DUPLICATES PARSE_SOURCES) - ENDIF() + if(PARSE_HEADERS) + list(REMOVE_DUPLICATES PARSE_HEADERS) + endif() + if(PARSE_SOURCES) + list(REMOVE_DUPLICATES PARSE_SOURCES) + endif() - IF(PARSE_ADDED_LIB_TARGET_NAME_OUT) - SET(${PARSE_ADDED_LIB_TARGET_NAME_OUT} PARENT_SCOPE) - ENDIF() + if(PARSE_ADDED_LIB_TARGET_NAME_OUT) + set(${PARSE_ADDED_LIB_TARGET_NAME_OUT} PARENT_SCOPE) + endif() # ToDo: Deprecate and remove the usage of DEFINES! People should be putting # defines into configured header files, not adding -D to the # compile lines! - IF (NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_TESTONLY) + if (NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_TESTONLY) # Add the link directory for this library. - SET_PROPERTY(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS + set_property(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS ${CMAKE_CURRENT_BINARY_DIR}) # NOTE: Above, this link path not really used here for anything. @@ -575,25 +575,25 @@ FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) # Add whatever include directories have been defined so far - INCLUDE_DIRECTORIES(AFTER ${${PACKAGE_NAME}_INCLUDE_DIRS}) + include_directories(AFTER ${${PACKAGE_NAME}_INCLUDE_DIRS}) # Add whatever link directories have been added so far - SET_PROPERTY(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS + set_property(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS ${${PACKAGE_NAME}_LIBRARY_DIRS}) # Local variable to hold all of the libraries that will be directly linked # to this library. - SET(LINK_LIBS) + set(LINK_LIBS) # Add dependent libraries passed directly in - IF (PARSE_DEPLIBS AND ${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "DEPLIBS = ${PARSE_DEPLIBS}") - ENDIF() - IF (PARSE_IMPORTEDLIBS AND ${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "IMPORTEDLIBS = ${PARSE_IMPORTEDLIBS}") - ENDIF() + if (PARSE_DEPLIBS AND ${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "DEPLIBS = ${PARSE_DEPLIBS}") + endif() + if (PARSE_IMPORTEDLIBS AND ${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "IMPORTEDLIBS = ${PARSE_IMPORTEDLIBS}") + endif() # # Add the DEPLIBS to the LINK_LIBS, assert correct usage of DEPLIBS, and @@ -617,55 +617,55 @@ FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) # give enough time for people to clean up their codes. # - SET(ADD_DEP_PACKAGE_AND_TPL_LIBS TRUE) + set(ADD_DEP_PACKAGE_AND_TPL_LIBS TRUE) - SET(PREFIXED_DEPLIBS) + set(PREFIXED_DEPLIBS) - FOREACH(LIB ${PARSE_DEPLIBS}) + foreach(LIB ${PARSE_DEPLIBS}) - SET(PREFIXED_LIB "${LIBRARY_NAME_PREFIX}${LIB}") + set(PREFIXED_LIB "${LIBRARY_NAME_PREFIX}${LIB}") # LIB_IN_SE_PKG? - LIST(FIND ${PACKAGE_NAME}_LIBRARIES ${PREFIXED_LIB} FOUND_IDX) - IF (FOUND_IDX GREATER -1) - SET(LIB_IN_SE_PKG TRUE) - ELSE() - SET(LIB_IN_SE_PKG FALSE) - ENDIF() + list(FIND ${PACKAGE_NAME}_LIBRARIES ${PREFIXED_LIB} FOUND_IDX) + if (FOUND_IDX GREATER -1) + set(LIB_IN_SE_PKG TRUE) + else() + set(LIB_IN_SE_PKG FALSE) + endif() # PREFIXED_LIB_IS_TESTONLY? - IF (${PREFIXED_LIB}_INCLUDE_DIRS) - SET(LIB_TESTONLY TRUE) - ELSE() - SET(LIB_TESTONLY FALSE) - ENDIF() + if (${PREFIXED_LIB}_INCLUDE_DIRS) + set(LIB_TESTONLY TRUE) + else() + set(LIB_TESTONLY FALSE) + endif() # Check for valid usage (sorted by most common to least common) - IF (LIB_IN_SE_PKG AND NOT LIB_TESTONLY) #PARSE_TESTONLY=TRUE/FASLE + if (LIB_IN_SE_PKG AND NOT LIB_TESTONLY) #PARSE_TESTONLY=TRUE/FASLE # The library being created here is a library dependent on a regular # (non-TESTONLY) lib in this SE package. This is valid usage of # DEPLIBS. There is no need to link this new lib to the SE package's # upstream dependent SE package and TPL libraries because thse are # already linked into the lib ${LIB}. - SET(ADD_DEP_PACKAGE_AND_TPL_LIBS FALSE) - ELSEIF (PARSE_TESTONLY AND LIB_IN_SE_PKG AND NOT LIB_TESTONLY) + set(ADD_DEP_PACKAGE_AND_TPL_LIBS FALSE) + elseif (PARSE_TESTONLY AND LIB_IN_SE_PKG AND NOT LIB_TESTONLY) # The library being created here is TESTONLY library and is # dependent on a regular (non-TESTONLY) lib. This is valid usage of # DEPLIBS. In the case of test-only libraries, we always link in # the upstream libs. - ELSEIF (PARSE_TESTONLY AND LIB_TESTONLY) # LIB_IN_SE_PKG=TRUE/FASLE + elseif (PARSE_TESTONLY AND LIB_TESTONLY) # LIB_IN_SE_PKG=TRUE/FASLE # The library being created here is TESTONLY library and is dependent # on another TESTONLY library. This is valid usage of DEPLIBS. In # this case we just hope that this SE package correctly specified a # TEST dependency on the upstream SE package that owns this upstream # TESTONLY library. - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "Adding include directories for TESTONLY ${PREFIXED_LIB}_INCLUDE_DIRS ...") - ENDIF() - INCLUDE_DIRECTORIES(${${PREFIXED_LIB}_INCLUDE_DIRS}) - ELSEIF (NOT PARSE_TESTONLY AND LIB_TESTONLY) # LIB_IN_SE_PKG=TRUE/FASLE - MESSAGE(WARNING "WARNING: '${LIB}' in DEPLIBS is a TESTONLY lib" + endif() + include_directories(${${PREFIXED_LIB}_INCLUDE_DIRS}) + elseif (NOT PARSE_TESTONLY AND LIB_TESTONLY) # LIB_IN_SE_PKG=TRUE/FASLE + message(WARNING "WARNING: '${LIB}' in DEPLIBS is a TESTONLY lib" " and it is illegal to link to this non-TESTONLY library '${LIBRARY_NAME}'." " Such usage is deprecated (and this warning will soon become an error)!" " If this is a regular library in this SE package or in an dependent upstream SE" @@ -674,8 +674,8 @@ FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) " this SE package's dependencies file" " ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/Dependencies.cmake") # ToDo: Turn the above to FATAL_ERROR after dropping deprecated code - ELSEIF (NOT LIB_IN_SE_PKG AND TARGET ${PREFIXED_LIB} ) # PARSE_TESTONLY=TRUE/FALSE - MESSAGE(WARNING "WARNING: '${LIB}' in DEPLIBS is not" + elseif (NOT LIB_IN_SE_PKG AND TARGET ${PREFIXED_LIB} ) # PARSE_TESTONLY=TRUE/FALSE + message(WARNING "WARNING: '${LIB}' in DEPLIBS is not" " a lib in this SE package but is a library defined in the current" " cmake project! Such usage is deprecated (and" " will result in a configure error soon). If this is a library in" @@ -685,57 +685,57 @@ FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) " not link, then you need to add a new SE package dependency to" " this SE package's dependencies file" " ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/Dependencies.cmake") - ELSEIF (NOT LIB_IN_SE_PKG AND NOT TARGET ${PREFIXED_LIB} ) - MESSAGE(WARNING "WARNING: '${LIB}' in DEPLIBS is not" + elseif (NOT LIB_IN_SE_PKG AND NOT TARGET ${PREFIXED_LIB} ) + message(WARNING "WARNING: '${LIB}' in DEPLIBS is not" " a lib defined in the current cmake project! Such usage is deprecated (and" " will result in a configure error soon). If this is an external" " lib you are trying to link in, it should likely be handled as a TriBITS" " TPL. Otherwise, it should be passed in through IMPORTEDLIBS. However," " the only case we have found where IMPORTEDLIBS had to be used instead of" " through a proper TriBITS TPL is the C math library 'm'.") - ELSE() - MESSAGE(WARNING "WARNING: The case PARSE_TESTONLY=${PARSE_TESTONLY}," + else() + message(WARNING "WARNING: The case PARSE_TESTONLY=${PARSE_TESTONLY}," " LIB_IN_SE_PKG=${LIB_IN_SE_PKG}, LIB_TESTONLY=${LIB_TESTONLY}, has" " not yet been handled!") - ENDIF() + endif() - LIST(APPEND PREFIXED_DEPLIBS "${LIBRARY_NAME_PREFIX}${LIB}") + list(APPEND PREFIXED_DEPLIBS "${LIBRARY_NAME_PREFIX}${LIB}") - ENDFOREACH() + endforeach() - APPEND_SET(LINK_LIBS ${PREFIXED_DEPLIBS}) + append_set(LINK_LIBS ${PREFIXED_DEPLIBS}) # # Check IMPORTEDLIBS # - FOREACH(IMPORTEDLIB ${PARSE_IMPORTEDLIBS}) - SET(PREFIXED_LIB "${LIBRARY_NAME_PREFIX}${IMPORTEDLIB}") - LIST(FIND ${PACKAGE_NAME}_LIBRARIES ${PREFIXED_LIB} FOUND_IDX) - IF (${PREFIXED_LIB}_INCLUDE_DIRS) - MESSAGE(WARNING "WARNING: '${IMPORTEDLIB}' in IMPORTEDLIBS is a TESTONLY lib" + foreach(IMPORTEDLIB ${PARSE_IMPORTEDLIBS}) + set(PREFIXED_LIB "${LIBRARY_NAME_PREFIX}${IMPORTEDLIB}") + list(FIND ${PACKAGE_NAME}_LIBRARIES ${PREFIXED_LIB} FOUND_IDX) + if (${PREFIXED_LIB}_INCLUDE_DIRS) + message(WARNING "WARNING: '${IMPORTEDLIB}' in IMPORTEDLIBS is a TESTONLY lib" " and it is illegal to pass in through IMPORTEDLIBS!" " Such usage is deprecated (and this warning will soon become an error)!" " Should '${IMPORTEDLIB}' instead be passed through DEPLIBS?") # ToDo: Turn the above to FATAL_ERROR after dropping deprecated code - ELSEIF (FOUND_IDX GREATER -1) - MESSAGE(WARNING "WARNING: Lib '${IMPORTEDLIB}' in IMPORTEDLIBS is in" + elseif (FOUND_IDX GREATER -1) + message(WARNING "WARNING: Lib '${IMPORTEDLIB}' in IMPORTEDLIBS is in" " this SE package and is *not* an external lib!" " TriBITS takes care of linking against libs the current" " SE package automatically. Please remove it from IMPORTEDLIBS!") - ELSEIF (TARGET ${PREFIXED_LIB}) - MESSAGE(WARNING "WARNING: Lib '${IMPORTEDLIB}' being passed through" + elseif (TARGET ${PREFIXED_LIB}) + message(WARNING "WARNING: Lib '${IMPORTEDLIB}' being passed through" " IMPORTEDLIBS is *not* an external library but instead is a library" " defined in this CMake project!" " TriBITS takes care of linking against libraries in dependent upstream" " SE packages. If you want to link to a library in an upstream SE" " package then add the SE package name to the appropriate category" - " in this SE package's depencencies file: " + " in this SE package's dependencies file: " " ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/Dependencies.cmake") - ENDIF() + endif() # ToDo: Assert that this is not a test-only lib - LIST(APPEND LINK_LIBS ${IMPORTEDLIB}) - ENDFOREACH() + list(APPEND LINK_LIBS ${IMPORTEDLIB}) + endforeach() # # Link in the upstream TEST SE package and TPL libs @@ -745,78 +745,78 @@ FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) # should not really matter but it looks better on the link line. # - IF (PARSE_TESTONLY) + if (PARSE_TESTONLY) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "Pulling in header and libraries dependencies" + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "Pulling in header and libraries dependencies" " for TEST dependencies ...") - ENDIF() + endif() - TRIBITS_SORT_AND_APPEND_PACKAGE_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_package_include_and_link_dirs_and_libs( ${PACKAGE_NAME} TEST LINK_LIBS) - TRIBITS_SORT_AND_APPEND_TPL_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_tpl_include_and_link_dirs_and_libs( ${PACKAGE_NAME} TEST LINK_LIBS) - ENDIF() + endif() # # Add the dependent LIB SE package and TPL libs # - IF (ADD_DEP_PACKAGE_AND_TPL_LIBS) + if (ADD_DEP_PACKAGE_AND_TPL_LIBS) # If there are no dependent libs passed in, then this library can not # possibly depend on the package's other libraries so we must link to # the dependent libraries in dependent libraries and TPLs. - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "Pulling in header and libraries dependencies" + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "Pulling in header and libraries dependencies" " for LIB dependencies ...") - ENDIF() + endif() # - # Call INCLUDE_DIRECTORIES() and LINK_DIRECTORIES(...) for all upstream + # Call include_directories() and link_directories(...) for all upstream # dependent Packages and TPLs and accumulate the libraries to link against. # # NOTE: Adding these directories serves two purposes. First, so that the includes # get added the the sources that get built for this library. Second, so # that list full list of include directories can be extracted as a - # propery and set on ${PACKAGE_NAME}_INCLUDE_DIRS + # property and set on ${PACKAGE_NAME}_INCLUDE_DIRS # - TRIBITS_SORT_AND_APPEND_PACKAGE_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_package_include_and_link_dirs_and_libs( ${PACKAGE_NAME} LIB LINK_LIBS) - TRIBITS_SORT_AND_APPEND_TPL_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_tpl_include_and_link_dirs_and_libs( ${PACKAGE_NAME} LIB LINK_LIBS) - ENDIF() + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(LINK_LIBS) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(LINK_LIBS) + endif() # Add the library and all the dependencies - IF (PARSE_DEFINES) - ADD_DEFINITIONS(${PARSE_DEFINES}) - ENDIF() + if (PARSE_DEFINES) + add_definitions(${PARSE_DEFINES}) + endif() - If (PARSE_STATIC) - SET(STATIC_KEYWORD "STATIC") - ELSE() - SET(STATIC_KEYWORD) - ENDIF() + if (PARSE_STATIC) + set(STATIC_KEYWORD "STATIC") + else() + set(STATIC_KEYWORD) + endif() - If (PARSE_SHARED) - SET(SHARED_KEYWORD "SHARED") - ELSE() - SET(SHARED_KEYWORD) - ENDIF() + if (PARSE_SHARED) + set(SHARED_KEYWORD "SHARED") + else() + set(SHARED_KEYWORD) + endif() - IF (NOT PARSE_CUDALIBRARY) - ADD_LIBRARY( + if (NOT PARSE_CUDALIBRARY) + add_library( ${LIBRARY_NAME} ${STATIC_KEYWORD} ${SHARED_KEYWORD} @@ -824,92 +824,92 @@ FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) ${PARSE_NOINSTALLHEADERS} ${PARSE_SOURCES} ) - ELSE() - CUDA_ADD_LIBRARY( + else() + cuda_add_library( ${LIBRARY_NAME} ${PARSE_HEADERS} ${PARSE_NOINSTALLHEADERS} ${PARSE_SOURCES} ) - ENDIF() + endif() - IF(PARSE_ADDED_LIB_TARGET_NAME_OUT) - SET(${PARSE_ADDED_LIB_TARGET_NAME_OUT} ${LIBRARY_NAME} PARENT_SCOPE) - ENDIF() + if(PARSE_ADDED_LIB_TARGET_NAME_OUT) + set(${PARSE_ADDED_LIB_TARGET_NAME_OUT} ${LIBRARY_NAME} PARENT_SCOPE) + endif() - SET_PROPERTY( + set_property( TARGET ${LIBRARY_NAME} APPEND PROPERTY LABELS ${PACKAGE_NAME}Libs ${PARENT_PACKAGE_NAME}Libs ) - IF (NOT "${${PROJECT_NAME}_VERSION}" STREQUAL "" AND + if (NOT "${${PROJECT_NAME}_VERSION}" STREQUAL "" AND NOT "${${PROJECT_NAME}_MAJOR_VERSION}" STREQUAL "" ) - SET_TARGET_PROPERTIES( + set_target_properties( ${LIBRARY_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION} ) - ENDIF() + endif() - PREPEND_GLOBAL_SET(${PARENT_PACKAGE_NAME}_LIB_TARGETS ${LIBRARY_NAME}) - PREPEND_GLOBAL_SET(${PARENT_PACKAGE_NAME}_ALL_TARGETS ${LIBRARY_NAME}) + prepend_global_set(${PARENT_PACKAGE_NAME}_LIB_TARGETS ${LIBRARY_NAME}) + prepend_global_set(${PARENT_PACKAGE_NAME}_ALL_TARGETS ${LIBRARY_NAME}) - IF (${PROJECT_NAME}_DUMP_LINK_LIBS) - MESSAGE("-- ${LIBRARY_NAME_IN}:LINK_LIBS='${LINK_LIBS}'") - ENDIF() + if (${PROJECT_NAME}_DUMP_LINK_LIBS) + message("-- ${LIBRARY_NAME_IN}:LINK_LIBS='${LINK_LIBS}'") + endif() - TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${LINK_LIBS}) + target_link_libraries(${LIBRARY_NAME} PUBLIC ${LINK_LIBS}) - IF (${PROJECT_NAME}_CXX_STANDARD_FEATURE) - TARGET_COMPILE_FEATURES(${LIBRARY_NAME} PUBLIC "${${PROJECT_NAME}_CXX_STANDARD_FEATURE}") + if (${PROJECT_NAME}_CXX_STANDARD_FEATURE) + target_compile_features(${LIBRARY_NAME} PUBLIC "${${PROJECT_NAME}_CXX_STANDARD_FEATURE}") ENDIF () # Add to the install target - SET(INSTALL_LIB ON) - SET(INSTALL_HEADERS ON) - SET(APPEND_LIB_AND_HEADERS_TO_PACKAGE ON) + set(INSTALL_LIB ON) + set(INSTALL_HEADERS ON) + set(APPEND_LIB_AND_HEADERS_TO_PACKAGE ON) - IF (PARSE_TESTONLY) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "Skipping installation hooks for this library" + if (PARSE_TESTONLY) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "Skipping installation hooks for this library" " because 'TESTONLY' was passed in ...") - ENDIF() - SET(INSTALL_LIB OFF) - SET(INSTALL_HEADERS OFF) - SET(APPEND_LIB_AND_HEADERS_TO_PACKAGE OFF) - ELSEIF (PARSE_NO_INSTALL_LIB_OR_HEADERS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "Skipping installation hooks for this library" + endif() + set(INSTALL_LIB OFF) + set(INSTALL_HEADERS OFF) + set(APPEND_LIB_AND_HEADERS_TO_PACKAGE OFF) + elseif (PARSE_NO_INSTALL_LIB_OR_HEADERS) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "Skipping installation hooks for this library" " because 'NO_INSTALL_LIB_OR_HEADERS' was passed in ...") - ENDIF() - SET(INSTALL_LIB OFF) - SET(INSTALL_HEADERS OFF) - ELSEIF (NOT ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS AND NOT BUILD_SHARED_LIBS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "Skipping installation of headers and libraries" + endif() + set(INSTALL_LIB OFF) + set(INSTALL_HEADERS OFF) + elseif (NOT ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS AND NOT BUILD_SHARED_LIBS) + 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 ...") - ENDIF() - SET(INSTALL_LIB OFF) - SET(INSTALL_HEADERS OFF) - ELSEIF (NOT ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS AND BUILD_SHARED_LIBS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "Skipping installation of headers but installing libraries" + endif() + set(INSTALL_LIB OFF) + set(INSTALL_HEADERS OFF) + elseif (NOT ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS AND BUILD_SHARED_LIBS) + 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 ...") - ENDIF() - SET(INSTALL_HEADERS OFF) - ENDIF() + endif() + set(INSTALL_HEADERS OFF) + endif() - IF (INSTALL_LIB OR INSTALL_HEADERS) - SET_PROPERTY(GLOBAL PROPERTY ${PROJECT_NAME}_HAS_INSTALL_TARGETS ON) - SET_PROPERTY(GLOBAL PROPERTY ${PACKAGE_NAME}_HAS_INSTALL_TARGETS ON) - ENDIF() + if (INSTALL_LIB OR INSTALL_HEADERS) + set_property(GLOBAL PROPERTY ${PROJECT_NAME}_HAS_INSTALL_TARGETS ON) + set_property(GLOBAL PROPERTY ${PACKAGE_NAME}_HAS_INSTALL_TARGETS ON) + endif() - IF (INSTALL_LIB) - INSTALL( + if (INSTALL_LIB) + install( TARGETS ${LIBRARY_NAME} EXPORT ${PACKAGE_NAME} RUNTIME DESTINATION "${${PROJECT_NAME}_INSTALL_RUNTIME_DIR}" @@ -917,89 +917,89 @@ FUNCTION(TRIBITS_ADD_LIBRARY LIBRARY_NAME_IN) ARCHIVE DESTINATION "${${PROJECT_NAME}_INSTALL_LIB_DIR}" COMPONENT ${PACKAGE_NAME} ) - ENDIF() + endif() - IF (INSTALL_HEADERS) - TRIBITS_INSTALL_HEADERS( + if (INSTALL_HEADERS) + tribits_install_headers( HEADERS ${PARSE_HEADERS} INSTALL_SUBDIR ${PARSE_HEADERS_INSTALL_SUBDIR} COMPONENT ${PACKAGE_NAME} ) - ENDIF() + endif() # Append the new include dirs, library dirs, and libraries to this package's lists - GET_DIRECTORY_PROPERTY(INCLUDE_DIRS_CURRENT INCLUDE_DIRECTORIES) - GET_DIRECTORY_PROPERTY(LIBRARY_DIRS_CURRENT PACKAGE_LIBRARY_DIRS) + get_directory_property(INCLUDE_DIRS_CURRENT INCLUDE_DIRECTORIES) + get_directory_property(LIBRARY_DIRS_CURRENT PACKAGE_LIBRARY_DIRS) - IF (APPEND_LIB_AND_HEADERS_TO_PACKAGE) + if (APPEND_LIB_AND_HEADERS_TO_PACKAGE) - PREPEND_GLOBAL_SET(${PACKAGE_NAME}_INCLUDE_DIRS ${INCLUDE_DIRS_CURRENT}) - PREPEND_GLOBAL_SET(${PACKAGE_NAME}_LIBRARY_DIRS ${LIBRARY_DIRS_CURRENT}) - PREPEND_GLOBAL_SET(${PACKAGE_NAME}_LIBRARIES ${LIBRARY_NAME}) + prepend_global_set(${PACKAGE_NAME}_INCLUDE_DIRS ${INCLUDE_DIRS_CURRENT}) + prepend_global_set(${PACKAGE_NAME}_LIBRARY_DIRS ${LIBRARY_DIRS_CURRENT}) + prepend_global_set(${PACKAGE_NAME}_LIBRARIES ${LIBRARY_NAME}) - REMOVE_GLOBAL_DUPLICATES(${PACKAGE_NAME}_INCLUDE_DIRS) - REMOVE_GLOBAL_DUPLICATES(${PACKAGE_NAME}_LIBRARY_DIRS) - REMOVE_GLOBAL_DUPLICATES(${PACKAGE_NAME}_LIBRARIES) + remove_global_duplicates(${PACKAGE_NAME}_INCLUDE_DIRS) + remove_global_duplicates(${PACKAGE_NAME}_LIBRARY_DIRS) + remove_global_duplicates(${PACKAGE_NAME}_LIBRARIES) - IF (INSTALL_LIB) - GLOBAL_SET(${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES_TO_INSTALL TRUE) - ENDIF() + if (INSTALL_LIB) + global_set(${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES_TO_INSTALL TRUE) + endif() - ELSE() + else() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "Skipping augmentation of package's lists of include" + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "Skipping augmentation of package's lists of include" " directories and libraries! ...") - ENDIF() + endif() - LIST(REMOVE_DUPLICATES INCLUDE_DIRS_CURRENT) - GLOBAL_SET(${LIBRARY_NAME}_INCLUDE_DIRS ${INCLUDE_DIRS_CURRENT}) + list(REMOVE_DUPLICATES INCLUDE_DIRS_CURRENT) + global_set(${LIBRARY_NAME}_INCLUDE_DIRS ${INCLUDE_DIRS_CURRENT}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${LIBRARY_NAME}_INCLUDE_DIRS) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${LIBRARY_NAME}_INCLUDE_DIRS) + endif() - ENDIF() - ENDIF() #if not in installation testing mode + endif() + endif() #if not in installation testing mode # # Adjust for installation testing # - IF (${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) + if (${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING) - LIST(FIND ${PROJECT_NAME}_INSTALLATION_PACKAGE_LIST ${PACKAGE_NAME} + list(FIND ${PROJECT_NAME}_INSTALLATION_PACKAGE_LIST ${PACKAGE_NAME} ${PACKAGE_NAME}_WAS_INSTALLED) - IF(${${PACKAGE_NAME}_WAS_INSTALLED} EQUAL -1) - MESSAGE(FATAL_ERROR + if(${${PACKAGE_NAME}_WAS_INSTALLED} EQUAL -1) + message(FATAL_ERROR "The package ${PACKAGE_NAME} was not installed with ${PROJECT_NAME}!" " Please disable package ${PACKAGE_NAME} or install it.") - ENDIF() + endif() - INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING BEFORE + include_directories(REQUIRED_DURING_INSTALLATION_TESTING BEFORE ${${PACKAGE_NAME}_INSTALLATION_INCLUDE_DIRS} ${${TRIBITS_PACKAGE}_INSTALLATION_TPL_INCLUDE_DIRS}) - SET_PROPERTY(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS + set_property(DIRECTORY APPEND PROPERTY PACKAGE_LIBRARY_DIRS ${${PACKAGE_NAME}_INSTALLATION_LIBRARY_DIRS}) - GET_DIRECTORY_PROPERTY(INCLUDE_DIRS_CURRENT INCLUDE_DIRECTORIES) - GET_DIRECTORY_PROPERTY(LIBRARY_DIRS_CURRENT PACKAGE_LIBRARY_DIRS) + get_directory_property(INCLUDE_DIRS_CURRENT INCLUDE_DIRECTORIES) + get_directory_property(LIBRARY_DIRS_CURRENT PACKAGE_LIBRARY_DIRS) - GLOBAL_SET(${PACKAGE_NAME}_INCLUDE_DIRS ${INCLUDE_DIRS_CURRENT}) - GLOBAL_SET(${PACKAGE_NAME}_LIBRARY_DIRS ${LIBRARY_DIRS_CURRENT}) - GLOBAL_SET(${PACKAGE_NAME}_LIBRARIES ${${PACKAGE_NAME}_INSTALLATION_LIBRARIES}) + global_set(${PACKAGE_NAME}_INCLUDE_DIRS ${INCLUDE_DIRS_CURRENT}) + global_set(${PACKAGE_NAME}_LIBRARY_DIRS ${LIBRARY_DIRS_CURRENT}) + global_set(${PACKAGE_NAME}_LIBRARIES ${${PACKAGE_NAME}_INSTALLATION_LIBRARIES}) - ENDIF() #installation testing mode + endif() #installation testing mode # # Print the updates to the linkage variables # - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PACKAGE_NAME}_INCLUDE_DIRS) - PRINT_VAR(${PACKAGE_NAME}_LIBRARY_DIRS) - PRINT_VAR(${PACKAGE_NAME}_LIBRARIES) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${PACKAGE_NAME}_INCLUDE_DIRS) + print_var(${PACKAGE_NAME}_LIBRARY_DIRS) + print_var(${PACKAGE_NAME}_LIBRARIES) + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsListHelpers.cmake b/cmake/tribits/core/package_arch/TribitsListHelpers.cmake index 29d6cc36158a..f500bf863364 100644 --- a/cmake/tribits/core/package_arch/TribitsListHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsListHelpers.cmake @@ -38,7 +38,7 @@ # @HEADER -INCLUDE(TribitsHostType) +include(TribitsHostType) # @@ -53,42 +53,42 @@ INCLUDE(TribitsHostType) # -SET(PLH_NUM_FIELDS_PER_PACKAGE 3) -SET(PLH_NUM_PACKAGE_DIR_OFFSET 1) -SET(PLH_NUM_PACKAGE_CLASSIFICATION_OFFSET 2) +set(PLH_NUM_FIELDS_PER_PACKAGE 3) +set(PLH_NUM_PACKAGE_DIR_OFFSET 1) +set(PLH_NUM_PACKAGE_CLASSIFICATION_OFFSET 2) -MACRO(TRIBITS_SET_PACKAGE_TO_EX PACKAGE_NAME) - LIST(FIND ${PROJECT_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS +macro(tribits_set_package_to_ex PACKAGE_NAME) + list(FIND ${PROJECT_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS ${PACKAGE_NAME} PACKAGE_NAME_IDX) - IF (PACKAGE_NAME_IDX EQUAL -1) - MESSAGE( + if (PACKAGE_NAME_IDX EQUAL -1) + message( "\n***" "\n*** NOTE: Package ${PACKAGE_NAME} not found in list of packages!" "\n***\n" ) - ELSE() - MATH(EXPR PACKAGE_CLASSIFICATION_IDX + else() + math(EXPR PACKAGE_CLASSIFICATION_IDX "${PACKAGE_NAME_IDX}+${PLH_NUM_PACKAGE_CLASSIFICATION_OFFSET}") - LIST(INSERT ${PROJECT_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS + list(INSERT ${PROJECT_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS ${PACKAGE_CLASSIFICATION_IDX} EX ) - MATH(EXPR PACKAGE_CLASSIFICATION_IDX_PLUS_1 + math(EXPR PACKAGE_CLASSIFICATION_IDX_PLUS_1 "${PACKAGE_CLASSIFICATION_IDX}+1") - LIST(REMOVE_AT ${PROJECT_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS + list(REMOVE_AT ${PROJECT_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS ${PACKAGE_CLASSIFICATION_IDX_PLUS_1} ) - ENDIF() + endif() -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS() +# @MACRO: tribits_disable_package_on_platforms() # # Disable a package automatically for a list of platforms. # # Usage:: # -# TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS( +# tribits_disable_package_on_platforms( # ...) # # If any of the host-type arguments ```` matches the @@ -98,66 +98,66 @@ ENDMACRO() # disabled by default (see `EX SE packages disabled by default`_). However, # an explicit enable can still enable the package. # -MACRO( TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS PACKAGE_NAME ) - #MESSAGE("TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS: ${PACKAGE_NAME}") - #PRINT_VAR(${PROJECT_NAME}_HOSTTYPE) - FOREACH(HOSTTYPE ${ARGN}) - #PRINT_VAR(HOSTTYPE) - IF (${PROJECT_NAME}_HOSTTYPE STREQUAL ${HOSTTYPE}) - #MESSAGE("${${PROJECT_NAME}_HOSTTYPE} == ${HOSTTYPE}") - TRIBITS_SET_PACKAGE_TO_EX(${PACKAGE_NAME}) - #PRINT_VAR(${PROJECT_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS) - IF (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - MESSAGE( +macro( tribits_disable_package_on_platforms PACKAGE_NAME ) + #message("TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS: ${PACKAGE_NAME}") + #print_var(${PROJECT_NAME}_HOSTTYPE) + foreach(HOSTTYPE ${ARGN}) + #print_var(HOSTTYPE) + if (${PROJECT_NAME}_HOSTTYPE STREQUAL ${HOSTTYPE}) + #message("${${PROJECT_NAME}_HOSTTYPE} == ${HOSTTYPE}") + tribits_set_package_to_ex(${PACKAGE_NAME}) + #print_var(${PROJECT_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS) + if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + message( "\n***" "\n*** NOTE: User has set ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=ON but the" "\n*** package ${PACKAGE_NAME} is not supported on this platform type '${HOSTTYPE}'!" "\n***\n" ) - ENDIF() - ENDIF() - ENDFOREACH() -ENDMACRO() + endif() + endif() + endforeach() +endmacro() -MACRO( PACKAGE_DISABLE_ON_PLATFORMS PACKAGE_NAME_IN_ ) - MESSAGE(WARNING "PACKAGE_DISABLE_ON_PLATFORMS() is deprecated!" - " Use TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS() instead!") - TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS(${PACKAGE_NAME_IN_} ${ARGN}) -ENDMACRO() +macro( package_disable_on_platforms PACKAGE_NAME_IN_ ) + message(WARNING "package_disable_on_platforms() is deprecated!" + " Use tribits_disable_package_on_platforms() instead!") + tribits_disable_package_on_platforms(${PACKAGE_NAME_IN_} ${ARGN}) +endmacro() -FUNCTION(TRIBITS_UPDATE_PS_PT_SS_ST THING_TYPE THING_NAME TESTGROUP_VAR) +function(tribits_update_ps_pt_ss_st THING_TYPE THING_NAME TESTGROUP_VAR) - #MESSAGE("TRIBITS_UPDATE_PS_PT_SS_ST: ${THING_TYPE} ${THING_NAME} ${TESTGROUP_VAR}") + #message("TRIBITS_UPDATE_PS_PT_SS_ST: ${THING_TYPE} ${THING_NAME} ${TESTGROUP_VAR}") - SET(TESTGROUP_IN ${${TESTGROUP_VAR}}) - #PRINT_VAR(TESTGROUP_IN) + set(TESTGROUP_IN ${${TESTGROUP_VAR}}) + #print_var(TESTGROUP_IN) - IF (TESTGROUP_IN STREQUAL PS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'PS' is depricated." + if (TESTGROUP_IN STREQUAL PS) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'PS' is deprecated." " Use 'PT' instead!") - ENDIF() - SET(TESTGROUP_OUT PT) - ELSEIF (TESTGROUP_IN STREQUAL SS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'SS' is depricated." + endif() + set(TESTGROUP_OUT PT) + elseif (TESTGROUP_IN STREQUAL SS) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'SS' is deprecated." " Use 'ST' instead!") - ENDIF() - SET(TESTGROUP_OUT ST) - ELSEIF (TESTGROUP_IN STREQUAL TS) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'TS' is depricated." + endif() + set(TESTGROUP_OUT ST) + elseif (TESTGROUP_IN STREQUAL TS) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'TS' is deprecated." " Use 'TT' instead!") - ENDIF() - SET(TESTGROUP_OUT TT) - ELSE() - SET(TESTGROUP_OUT ${TESTGROUP_IN}) - ENDIF() - #PRINT_VAR(TESTGROUP_OUT) + endif() + set(TESTGROUP_OUT TT) + else() + set(TESTGROUP_OUT ${TESTGROUP_IN}) + endif() + #print_var(TESTGROUP_OUT) - SET(${TESTGROUP_VAR} ${TESTGROUP_OUT} PARENT_SCOPE) + set(${TESTGROUP_VAR} ${TESTGROUP_OUT} PARENT_SCOPE) -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake b/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake index 3489ef1c61d1..d66d1bbe58e6 100644 --- a/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake +++ b/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake @@ -37,10 +37,10 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsGeneralMacros) +include(TribitsGeneralMacros) -# @MACRO: TRIBITS_PACKAGE_DEFINE_DEPENDENCIES() +# @MACRO: tribits_package_define_dependencies() # # Define the dependencies for a given `TriBITS SE Package`_ (i.e. a top-level # `TriBITS Package`_ or a `TriBITS Subpackage`_) in the package's @@ -48,7 +48,7 @@ INCLUDE(TribitsGeneralMacros) # # Usage:: # -# TRIBITS_PACKAGE_DEFINE_DEPENDENCIES( +# tribits_package_define_dependencies( # [LIB_REQUIRED_PACKAGES ...] # [LIB_OPTIONAL_PACKAGES ...] # [TEST_REQUIRED_PACKAGES ...] @@ -124,7 +124,7 @@ INCLUDE(TribitsGeneralMacros) # of some type. # # Only upstream SE packages can be listed (as defined by the order the SE -# packages are listed in `TRIBITS_REPOSITORY_DEFINE_PACKAGES()`_ in the +# packages are listed in `tribits_repository_define_packages()`_ in the # `/PackagesList.cmake`_ file). Otherwise an error will occur and # processing will stop. Misspelled SE package names are caught as well. # @@ -158,7 +158,7 @@ INCLUDE(TribitsGeneralMacros) # Likewise the order that dependent TPLs are listed is not significant. # # If some upstream SE packages are allowed to be missing, this can be specified -# by calling the macro `TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES()`_. +# by calling the macro `tribits_allow_missing_external_packages()`_. # # A top-level `TriBITS Package`_ can also be broken down into `TriBITS # Subpackages`_. In this case, the following argument must be passed in: @@ -186,7 +186,7 @@ INCLUDE(TribitsGeneralMacros) # ``GRS``, ``GPG``, ``GPM``, and ``UM``, separated by a coma ',' with no # spaces in between (e.g. ``"PT,GPM"``). These have exactly the same # meaning as for full packages (see -# `TRIBITS_REPOSITORY_DEFINE_PACKAGES()`_). +# `tribits_repository_define_packages()`_). # # * **OPTREQ** (Column 3): Determines if the outer parent package has an # ``OPTIONAL`` or ``REQUIRED`` dependence on this subpackage. @@ -220,9 +220,9 @@ INCLUDE(TribitsGeneralMacros) # This is an error checking property of the TriBITS system to avoid misspelling # the names of these variables. # -MACRO(TRIBITS_PACKAGE_DEFINE_DEPENDENCIES) +macro(tribits_package_define_dependencies) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -234,18 +234,18 @@ MACRO(TRIBITS_PACKAGE_DEFINE_DEPENDENCIES) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - SET(LIB_REQUIRED_DEP_PACKAGES ${PARSE_LIB_REQUIRED_PACKAGES}) - SET(LIB_OPTIONAL_DEP_PACKAGES ${PARSE_LIB_OPTIONAL_PACKAGES}) - SET(TEST_REQUIRED_DEP_PACKAGES ${PARSE_TEST_REQUIRED_PACKAGES}) - SET(TEST_OPTIONAL_DEP_PACKAGES ${PARSE_TEST_OPTIONAL_PACKAGES}) - SET(LIB_REQUIRED_DEP_TPLS ${PARSE_LIB_REQUIRED_TPLS}) - SET(LIB_OPTIONAL_DEP_TPLS ${PARSE_LIB_OPTIONAL_TPLS}) - SET(TEST_REQUIRED_DEP_TPLS ${PARSE_TEST_REQUIRED_TPLS}) - SET(TEST_OPTIONAL_DEP_TPLS ${PARSE_TEST_OPTIONAL_TPLS}) - SET(REGRESSION_EMAIL_LIST ${PARSE_REGRESSION_EMAIL_LIST}) - SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS + set(LIB_REQUIRED_DEP_PACKAGES ${PARSE_LIB_REQUIRED_PACKAGES}) + set(LIB_OPTIONAL_DEP_PACKAGES ${PARSE_LIB_OPTIONAL_PACKAGES}) + set(TEST_REQUIRED_DEP_PACKAGES ${PARSE_TEST_REQUIRED_PACKAGES}) + set(TEST_OPTIONAL_DEP_PACKAGES ${PARSE_TEST_OPTIONAL_PACKAGES}) + set(LIB_REQUIRED_DEP_TPLS ${PARSE_LIB_REQUIRED_TPLS}) + set(LIB_OPTIONAL_DEP_TPLS ${PARSE_LIB_OPTIONAL_TPLS}) + set(TEST_REQUIRED_DEP_TPLS ${PARSE_TEST_REQUIRED_TPLS}) + set(TEST_OPTIONAL_DEP_TPLS ${PARSE_TEST_OPTIONAL_TPLS}) + set(REGRESSION_EMAIL_LIST ${PARSE_REGRESSION_EMAIL_LIST}) + set(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${PARSE_SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS}) # ToDo: @@ -253,4 +253,4 @@ MACRO(TRIBITS_PACKAGE_DEFINE_DEPENDENCIES) # * Assert that SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS is divisible # by the number of columns! -ENDMACRO() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake b/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake index 82d7813c0dd3..615830b9b94b 100644 --- a/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake @@ -37,26 +37,26 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsPackageSetupCompilerFlags) -INCLUDE(TribitsWriteClientExportFiles) -INCLUDE(TribitsGeneralMacros) - -INCLUDE(CMakeParseArguments) -INCLUDE(GlobalNullSet) -INCLUDE(AppendGlobalSet) -INCLUDE(PrintVar) -INCLUDE(PrependSet) -INCLUDE(PrependGlobalSet) -INCLUDE(RemoveGlobalDuplicates) - -INCLUDE(TribitsAddOptionAndDefine) -INCLUDE(TribitsLibraryMacros) -INCLUDE(TribitsAddExecutable) -INCLUDE(TribitsAddExecutableAndTest) -INCLUDE(TribitsAddTest) -INCLUDE(TribitsAddAdvancedTest) -INCLUDE(TribitsCopyFilesToBinaryDir) -INCLUDE(TribitsReportInvalidTribitsUsage) +include(TribitsPackageSetupCompilerFlags) +include(TribitsWriteClientExportFiles) +include(TribitsGeneralMacros) + +include(CMakeParseArguments) +include(GlobalNullSet) +include(AppendGlobalSet) +include(PrintVar) +include(PrependSet) +include(PrependGlobalSet) +include(RemoveGlobalDuplicates) + +include(TribitsAddOptionAndDefine) +include(TribitsLibraryMacros) +include(TribitsAddExecutable) +include(TribitsAddExecutableAndTest) +include(TribitsAddTest) +include(TribitsAddAdvancedTest) +include(TribitsCopyFilesToBinaryDir) +include(TribitsReportInvalidTribitsUsage) ### @@ -70,56 +70,56 @@ INCLUDE(TribitsReportInvalidTribitsUsage) # -# Macro that defines the package architecture system varaibles used to link +# Macro that defines the package architecture system variables used to link # different SE packages together # -# See README.DEPENDENCIES for information on what these varaibles mean and how +# See README.DEPENDENCIES for information on what these variables mean and how # they are used. # -MACRO(TRIBITS_DEFINE_LINKAGE_VARS PACKAGE_NAME_IN) - GLOBAL_NULL_SET(${PACKAGE_NAME_IN}_INCLUDE_DIRS) - GLOBAL_NULL_SET(${PACKAGE_NAME_IN}_LIBRARY_DIRS) - GLOBAL_NULL_SET(${PACKAGE_NAME_IN}_LIBRARIES) - GLOBAL_SET(${PACKAGE_NAME_IN}_HAS_NATIVE_LIBRARIES_TO_INSTALL FALSE) -ENDMACRO() +macro(tribits_define_linkage_vars PACKAGE_NAME_IN) + global_null_set(${PACKAGE_NAME_IN}_INCLUDE_DIRS) + global_null_set(${PACKAGE_NAME_IN}_LIBRARY_DIRS) + global_null_set(${PACKAGE_NAME_IN}_LIBRARIES) + global_set(${PACKAGE_NAME_IN}_HAS_NATIVE_LIBRARIES_TO_INSTALL FALSE) +endmacro() # -# Macro that defines varaibles that create global targets +# Macro that defines variables that create global targets # -MACRO(TRIBITS_DEFINE_TARGET_VARS PARENT_PACKAGE_NAME_IN) - GLOBAL_NULL_SET(${PARENT_PACKAGE_NAME_IN}_LIB_TARGETS) - GLOBAL_NULL_SET(${PARENT_PACKAGE_NAME_IN}_ALL_TARGETS) -ENDMACRO() +macro(tribits_define_target_vars PARENT_PACKAGE_NAME_IN) + global_null_set(${PARENT_PACKAGE_NAME_IN}_LIB_TARGETS) + global_null_set(${PARENT_PACKAGE_NAME_IN}_ALL_TARGETS) +endmacro() # -# Set up some common varaibles used in the creation of an SE package +# Set up some common variables used in the creation of an SE package # -MACRO(TRIBITS_SET_COMMON_VARS PACKAGE_NAME_IN) +macro(tribits_set_common_vars PACKAGE_NAME_IN) - STRING(TOUPPER ${PACKAGE_NAME_IN} PACKAGE_NAME_UC) + string(TOUPPER ${PACKAGE_NAME_IN} PACKAGE_NAME_UC) # Write TRIBITS_PACKAGE versions of common variables - SET(PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - SET(PACKAGE_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") + set(PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(PACKAGE_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") # Get the name of the directory this ${PROJECT_NAME} package is in - FILE(TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR} STANDARD_PACKAGE_SOURCE_DIR) - STRING(REGEX REPLACE "/.+/(.+)" "\\1" PACKAGE_DIR_NAME "${STANDARD_PACKAGE_SOURCE_DIR}") + file(TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR} STANDARD_PACKAGE_SOURCE_DIR) + string(REGEX REPLACE "/.+/(.+)" "\\1" PACKAGE_DIR_NAME "${STANDARD_PACKAGE_SOURCE_DIR}") -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_PACKAGE_DECL() +# @MACRO: tribits_package_decl() # # Macro called at the very beginning of a package's top-level # `/CMakeLists.txt`_ file when a package has subpackages. # # Usage:: # -# TRIBITS_PACKAGE_DECL( +# tribits_package_decl( # # [ENABLE_SHADOWING_WARNINGS] # [DISABLE_STRONG_WARNINGS] @@ -158,7 +158,7 @@ ENDMACRO() # ``DISABLE_CIRCULAR_REF_DETECTION_FAILURE`` # # If specified, then the standard grep looking for RCPNode circular -# references in `TRIBITS_ADD_TEST()`_ and `TRIBITS_ADD_ADVANCED_TEST()`_ +# references in `tribits_add_test()`_ and `tribits_add_advanced_test()`_ # that causes tests to fail will be disabled. Note that if these warnings # are being produced then it means that the test is leaking memory and # user like may also be leaking memory. @@ -177,43 +177,43 @@ ENDMACRO() # # * This packages's cmake subdir ``${PACKAGE_SOURCE_DIR}/cmake`` is added to # ``CMAKE_MODULE_PATH`` locally so that the package's try-compile modules -# can be read in with just a raw ``INCLUDE()`` leaving off the full path and +# can be read in with just a raw ``include()`` leaving off the full path and # the ``*.cmake`` extension. # -# If the package does not have subpackages, just call `TRIBITS_PACKAGE()`_ +# If the package does not have subpackages, just call `tribits_package()`_ # which calls this macro. # -MACRO(TRIBITS_PACKAGE_DECL PACKAGE_NAME_IN) +macro(tribits_package_decl PACKAGE_NAME_IN) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nTRIBITS_PACKAGE_DECL: ${PACKAGE_NAME_IN}") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + 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" + 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() + 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 expicitly called more than once or" + 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" + " 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() + endif() # Set flag to check that macros are called in the correct order - SET(${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED TRUE) + set(${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED TRUE) # # A) Parse the input arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -225,60 +225,60 @@ MACRO(TRIBITS_PACKAGE_DECL PACKAGE_NAME_IN) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() # # B) Assert that the global and local package names are the same! # - IF (DEFINED PACKAGE_NAME) - IF (NOT ${PACKAGE_NAME_IN} STREQUAL ${PACKAGE_NAME}) - MESSAGE(FATAL_ERROR "Error, the package-defined package name" + if (DEFINED PACKAGE_NAME) + if (NOT ${PACKAGE_NAME_IN} STREQUAL ${PACKAGE_NAME}) + message(FATAL_ERROR "Error, the package-defined package name" " '${PACKAGE_NAME_IN}' is not the same as the package name" " defined at the global level '${PACKAGE_NAME}'") - ENDIF() - ENDIF() + endif() + endif() # # C) Set up the CMake support for this ${PROJECT_NAME} package and define some - # top-level varaibles. + # top-level variables. # - TRIBITS_SET_COMMON_VARS(${PACKAGE_NAME_IN}) + tribits_set_common_vars(${PACKAGE_NAME_IN}) - SET(${PACKAGE_NAME_IN}_DISABLE_STRONG_WARNINGS OFF + set(${PACKAGE_NAME_IN}_DISABLE_STRONG_WARNINGS OFF CACHE BOOL "If set to true, then strong warnings for package ${PACKAGE_NAME_IN} will be disabled." ) # Set up the compile flags for the package - TRIBITS_SETUP_COMPILER_FLAGS(${PACKAGE_NAME_IN}) + tribits_setup_compiler_flags(${PACKAGE_NAME_IN}) # Set up circular reference detection test failure - IF (PARSE_DISABLE_CIRCULAR_REF_DETECTION_FAILURE) - SET(${PACKAGE_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE OFF) - ELSE() - SET(${PACKAGE_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE ON) - ENDIF() + if (PARSE_DISABLE_CIRCULAR_REF_DETECTION_FAILURE) + set(${PACKAGE_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE OFF) + else() + set(${PACKAGE_NAME}_ENABLE_CIRCULAR_REF_DETECTION_FAILURE ON) + endif() - # Set up parent package linkage varaibles - TRIBITS_DEFINE_TARGET_VARS(${PACKAGE_NAME}) + # Set up parent package linkage variables + tribits_define_target_vars(${PACKAGE_NAME}) # Define this as a CMake/CTest "Subproject" - SET_DIRECTORY_PROPERTIES(PROPERTIES LABELS "${PACKAGE_NAME}") + set_directory_properties(PROPERTIES LABELS "${PACKAGE_NAME}") # # Append the local package's cmake directory in order to help pull in # configure-time testing macros # - PREPEND_SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + prepend_set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_PACKAGE_DEF() +# @MACRO: tribits_package_def() # # Macro called in `/CMakeLists.txt`_ after subpackages are # processed in order to handle the libraries, tests, and examples of the @@ -286,9 +286,9 @@ ENDMACRO() # # Usage:: # -# TRIBITS_PACKAGE_DEF() +# tribits_package_def() # -# If the package does not have subpackages, just call `TRIBITS_PACKAGE()`_ +# If the package does not have subpackages, just call `tribits_package()`_ # which calls this macro. # # This macro has several side effects: @@ -299,59 +299,59 @@ ENDMACRO() # * The intra-package dependency variables (i.e. list of include directories, # list of libraries, etc.) are initialized to empty. # -MACRO(TRIBITS_PACKAGE_DEF) +macro(tribits_package_def) # check that this is not being called from a subpackage - IF(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) - IF (CURRENTLY_PROCESSING_SUBPACKAGE) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Cannot call TRIBITS_PACKAGE_DEF() in a subpackage." - " Use TRIBITS_SUBPACKAGE() instead" + if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + if (CURRENTLY_PROCESSING_SUBPACKAGE) + tribits_report_invalid_tribits_usage( + "Cannot call tribits_package_def() in a subpackage." + " Use tribits_subpackage() instead" " error in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() - ENDIF() + endif() + endif() # Reset since it was changed by the subpackages - SET(PACKAGE_NAME ${PARENT_PACKAGE_NAME}) + set(PACKAGE_NAME ${PARENT_PACKAGE_NAME}) # check that this is not called morethan once in a package - IF (${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "TRIBITS_PACKAGE_DEF was called more than once in" + if (${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED) + tribits_report_invalid_tribits_usage( + "tribits_package_def() was called more than once in" "${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nTRIBITS_PACKAGE_DEF: ${PACKAGE_NAME}") - 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() + 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}) + tribits_set_common_vars(${PACKAGE_NAME}) - # Define package linkage varaibles - TRIBITS_DEFINE_LINKAGE_VARS(${PACKAGE_NAME}) + # Define package linkage variables + tribits_define_linkage_vars(${PACKAGE_NAME}) - SET(${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED TRUE) + set(${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED TRUE) -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_PACKAGE() +# @MACRO: tribits_package() # # Macro called at the very beginning of a package's top-level # `/CMakeLists.txt`_ file. # # Usage:: # -# TRIBITS_PACKAGE( +# tribits_package( # # [ENABLE_SHADOWING_WARNINGS] # [DISABLE_STRONG_WARNINGS] @@ -359,52 +359,52 @@ ENDMACRO() # [DISABLE_CIRCULAR_REF_DETECTION_FAILURE] # ) # -# See `TRIBITS_PACKAGE_DECL()`_ for the documentation for the arguments and -# `TRIBITS_PACKAGE_DECL()`_ and `TRIBITS_PACKAGE()`_ for a description the +# See `tribits_package_decl()`_ for the documentation for the arguments and +# `tribits_package_decl()`_ and `tribits_package()`_ for a description the # side-effects (and variables set) after calling this macro. # -MACRO(TRIBITS_PACKAGE PACKAGE_NAME_IN) +macro(tribits_package PACKAGE_NAME_IN) - IF (CURRENTLY_PROCESSING_SUBPACKAGE) - IF (NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Cannot call TRIBITS_PACKAGE() in a subpackage." - " Use TRIBITS_SUBPACKAGE() instead" + if (CURRENTLY_PROCESSING_SUBPACKAGE) + if (NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Cannot call tribits_package() in a subpackage." + " Use tribits_subpackage() instead" " error in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() - ENDIF() + endif() + endif() - IF(${PACKAGE_NAME}_SUBPACKAGES) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "This package has subpackages so you cannot use TRIBITS_PACKAGE()" + if(${PACKAGE_NAME}_SUBPACKAGES) + tribits_report_invalid_tribits_usage( + "This package has subpackages so you cannot use tribits_package()" "\n Instead use the following call order:" - "\n TRIBITS_PROJECT_DECL(${PACKAGE_NAME})" - "\n TRIBITS_PROCESS_SUBPACKAGES()" + "\n tribits_project_decl(${PACKAGE_NAME})" + "\n tribits_process_subpackages()" "\n [do other things you want to do]" - "\n TRIBITS_PACKAGE_DEF()" - "\n TRIBITS_PACKAGE_POSTPROCESS()" ) - ENDIF() + "\n tribits_package_def()" + "\n tribits_package_postprocess()" ) + endif() - IF(${PACKAGE_NAME}_TRIBITS_PACKAGE_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( + if(${PACKAGE_NAME}_TRIBITS_PACKAGE_CALLED) + tribits_report_invalid_tribits_usage( "Package ${PACKAGE_NAME} declared more than once!") - ENDIF() + endif() - SET(${PACKAGE_NAME}_TRIBITS_PACKAGE_CALLED TRUE) + set(${PACKAGE_NAME}_TRIBITS_PACKAGE_CALLED TRUE) - TRIBITS_PACKAGE_DECL(${PACKAGE_NAME_IN} ${ARGN}) - TRIBITS_PACKAGE_DEF() -ENDMACRO() + tribits_package_decl(${PACKAGE_NAME_IN} ${ARGN}) + tribits_package_def() +endmacro() # -# @MACRO: TRIBITS_ADD_TEST_DIRECTORIES() +# @MACRO: tribits_add_test_directories() # # Macro called to add a set of test directories for an SE package. # # Usage:: # -# TRIBITS_ADD_TEST_DIRECTORIES( ...) +# tribits_add_test_directories( ...) # # This macro only needs to be called from the top most ``CMakeLists.txt`` file # for which all subdirectories are all "tests". @@ -412,57 +412,58 @@ ENDMACRO() # This macro can be called several times within a package and it will have the # right effect. # -# Currently, all this macro does macro is to call ``ADD_SUBDIRECTORY()`` +# Currently, all this macro does macro is to call ``add_subdirectory()`` # if ``${PACKAGE_NAME}_ENABLE_TESTS`` or # ``${PARENT_PACKAGE_NAME}_ENABLE_TESTS`` are ``TRUE``. However, this macro # may be extended in the future in order to modify behavior related to adding # tests and examples in a uniform way. # -MACRO(TRIBITS_ADD_TEST_DIRECTORIES) +macro(tribits_add_test_directories) - IF (CURRENTLY_PROCESSING_SUBPACKAGE) + if (CURRENTLY_PROCESSING_SUBPACKAGE) # This is a subpackage being processed - IF(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_SUBPACKAGE() before TRIBITS_ADD_TEST_DIRECTORIES()" + if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_subpackage() before tribits_add_test_directories()" " in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - IF(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_ADD_TEST_DIRECTORIES() before " - " TRIBITS_SUBPACKAGE_POSTPROCESS() in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_add_test_directories() before" + " tribits_subpackage_postprocess() in" + " ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") + endif() - ELSE() + else() # This is a package being processed - IF(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_PACKAGE() or TRIBITS_PACKAGE_DECL() before" - " TRIBITS_ADD_TEST_DIRECTORIES() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + if(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_package() or tribits_package_decl() before" + " tribits_add_test_directories() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() - IF(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_ADD_TEST_DIRECTORIES() before " - " TRIBITS_PACKAGE_POSTPROCESS() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + if(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_add_test_directories() before " + " tribits_package_postprocess() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() - ENDIF() + endif() - IF(${PACKAGE_NAME}_ENABLE_TESTS OR ${PARENT_PACKAGE_NAME}_ENABLE_TESTS) - FOREACH(TEST_DIR ${ARGN}) - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE ADD_SUBDIR + if(${PACKAGE_NAME}_ENABLE_TESTS OR ${PARENT_PACKAGE_NAME}_ENABLE_TESTS) + foreach(TEST_DIR ${ARGN}) + tribits_trace_file_processing(PACKAGE ADD_SUBDIR "${CMAKE_CURRENT_SOURCE_DIR}/${TEST_DIR}/CMakeLists.txt") - ADD_SUBDIRECTORY(${TEST_DIR}) - ENDFOREACH() - ENDIF() + add_subdirectory(${TEST_DIR}) + endforeach() + endif() -ENDMACRO() +endmacro() # @@ -471,94 +472,94 @@ ENDMACRO() # -# @MACRO: TRIBITS_ADD_DEBUG_OPTION() +# @MACRO: tribits_add_debug_option() # # Add the standard cache variable option ``${PACKAGE_NAME}_ENABLE_DEBUG`` for # the package. # # Usage:: # -# TRIBITS_ADD_DEBUG_OPTION() +# tribits_add_debug_option() # # This option is given the default ``${${PROJECT_NAME}_ENABLE_DEBUG}`` and if # true, will set the variable ``HAVE_${PACKAGE_NAME_UC}_DEBUG`` (to be used in # the package's configured header file). This macro is typically called in # the package's `/CMakeLists.txt`_ file. # -MACRO(TRIBITS_ADD_DEBUG_OPTION) - TRIBITS_ADD_OPTION_AND_DEFINE( +macro(tribits_add_debug_option) + tribits_add_option_and_define( ${PACKAGE_NAME}_ENABLE_DEBUG HAVE_${PACKAGE_NAME_UC}_DEBUG "Enable a host of runtime debug checking." ${${PROJECT_NAME}_ENABLE_DEBUG} ) -ENDMACRO() +endmacro() -MACRO(TRIBITS_ADD_ENABLE_TEUCHOS_TIME_MONITOR_OPTION) - OPTION( +macro(tribits_add_enable_teuchos_time_monitor_option) + option( ${PACKAGE_NAME}_ENABLE_TEUCHOS_TIME_MONITOR "Enable Teuchos time monitors for package ${PACKAGE_NAME}" ${${PROJECT_NAME}_ENABLE_TEUCHOS_TIME_MONITOR} ) -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION() +# @MACRO: tribits_add_show_deprecated_warnings_option() # # Add the standard option ``${PACKAGE_NAME}_SHOW_DEPRECATED_WARNINGS`` for the # package. # # Usage:: # -# TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION() +# tribits_add_show_deprecated_warnings_option() # # This macro should be called in the package's /CMakeLists.txt`_ # file. This option is given the default value # ``${${PROJECT_NAME}_SHOW_DEPRECATED_WARNINGS}``. This option is then looked -# for in `TRIBITS_CONFIGURE_FILE()`_ to add macros to add deprecated warnings +# for in `tribits_configure_file()`_ to add macros to add deprecated warnings # to deprecated parts of a package. # -MACRO(TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION) - ADVANCED_SET( +macro(tribits_add_show_deprecated_warnings_option) + advanced_set( ${PACKAGE_NAME}_SHOW_DEPRECATED_WARNINGS ${${PROJECT_NAME}_SHOW_DEPRECATED_WARNINGS} CACHE BOOL "Show warnings about deprecated code in ${PACKAGE_NAME}" ) - ADVANCED_SET( + advanced_set( ${PACKAGE_NAME}_HIDE_DEPRECATED_CODE ${${PROJECT_NAME}_HIDE_DEPRECATED_CODE} CACHE BOOL "Fully exclude deprecated code in ${PACKAGE_NAME}" ) -ENDMACRO() +endmacro() -MACRO(TRIBITS_ADD_EXPLICIT_INSTANTIATION_OPTION) - TRIBITS_ADD_OPTION_AND_DEFINE( +macro(tribits_add_explicit_instantiation_option) + tribits_add_option_and_define( ${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION HAVE_${PACKAGE_NAME_UC}_EXPLICIT_INSTANTIATION "Enable the use of explicit template instantiation." ${${PROJECT_NAME}_ENABLE_EXPLICIT_INSTANTIATION} ) -ENDMACRO() +endmacro() -MACRO(TRIBITS_ADD_ETI_SUPPORT) - APPEND_GLOBAL_SET(${PROJECT_NAME}_ETI_PACKAGES ${PACKAGE_NAME}) - GLOBAL_NULL_SET(${PACKAGE_NAME}_ETI_LIBRARYSET) -ENDMACRO() +macro(tribits_add_eti_support) + append_global_set(${PROJECT_NAME}_ETI_PACKAGES ${PACKAGE_NAME}) + global_null_set(${PACKAGE_NAME}_ETI_LIBRARYSET) +endmacro() # -# @MACRO: TRIBITS_ADD_EXAMPLE_DIRECTORIES() +# @MACRO: tribits_add_example_directories() # # Macro called to conditionally add a set of example directories for an SE # package. # # Usage:: # -# TRIBITS_ADD_EXAMPLE_DIRECTORIES( ...) +# tribits_add_example_directories( ...) # # This macro typically is called from the top-level # `/CMakeLists.txt`_ file for which all subdirectories are all @@ -567,55 +568,55 @@ ENDMACRO() # This macro can be called several times within a package as desired to break # up example directories any way one would like. # -# Currently, all it does macro does is to call ``ADD_SUBDIRECTORY()`` if +# Currently, all it does macro does is to call ``add_subdirectory()`` if # ``${PACKAGE_NAME}_ENABLE_EXAMPLES`` or # ``${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES`` are true. However, this macro may # be extended in the future in order to modify behavior related to adding # tests and examples in a uniform way. # -MACRO(TRIBITS_ADD_EXAMPLE_DIRECTORIES) +macro(tribits_add_example_directories) - IF (CURRENTLY_PROCESSING_SUBPACKAGE) + if (CURRENTLY_PROCESSING_SUBPACKAGE) # This is a subpackage being processed - IF(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_SUBPACKAGE() before TRIBITS_ADD_EXAMPLE_DIRECTORIES()" + if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_subpackage() before tribits_add_example_directories()" " in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - IF(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_ADD_EXAMPLE_DIRECTORIES() before " - " TRIBITS_SUBPACKAGE_POSTPROCESS() in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_add_example_directories() before " + " tribits_subpackage_postprocess() in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") + endif() - ELSE() + else() # This is a package being processed - IF(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_PACKAGE() or TRIBITS_PACKAGE_DECL() before" - " TRIBITS_ADD_EXAMPLE_DIRECTORIES() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() - - IF(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_ADD_EXAMPLE_DIRECTORIES() before " - " TRIBITS_PACKAGE_POSTPROCESS() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() - - ENDIF() - - IF(${PACKAGE_NAME}_ENABLE_EXAMPLES OR ${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES) - FOREACH(EXAMPLE_DIR ${ARGN}) - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE ADD_SUBDIR + if(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_package() or tribits_package_decl() before" + " tribits_add_example_directories() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() + + if(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_add_example_directories() before " + " tribits_package_postprocess() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() + + endif() + + if(${PACKAGE_NAME}_ENABLE_EXAMPLES OR ${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES) + foreach(EXAMPLE_DIR ${ARGN}) + tribits_trace_file_processing(PACKAGE ADD_SUBDIR "${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_DIR}/CMakeLists.txt") - ADD_SUBDIRECTORY(${EXAMPLE_DIR}) - ENDFOREACH() - ENDIF() + add_subdirectory(${EXAMPLE_DIR}) + endforeach() + endif() -ENDMACRO() +endmacro() # @@ -623,105 +624,105 @@ ENDMACRO() # package has no libraries. # -FUNCTION(TRIBITS_PACKAGE_FINALIZE_DEPENDENCY_VARS) +function(tribits_package_finalize_dependency_vars) - IF(${PACKAGE_NAME}_SUBPACKAGES) + if(${PACKAGE_NAME}_SUBPACKAGES) # A package with subpackages should get all of its dependency vars from # its enabled subpackages. - SET(PARENT_PACKAGE_INCLUDE_DIRS) - SET(PARENT_PACKAGE_LIBRARY_DIRS) - SET(PARENT_PACKAGE_LIBRARIES) + set(PARENT_PACKAGE_INCLUDE_DIRS) + set(PARENT_PACKAGE_LIBRARY_DIRS) + set(PARENT_PACKAGE_LIBRARIES) - SET(SUBPACKAGE_IDX 0) - FOREACH(TRIBITS_SUBPACKAGE ${${PARENT_PACKAGE_NAME}_SUBPACKAGES}) + set(SUBPACKAGE_IDX 0) + foreach(TRIBITS_SUBPACKAGE ${${PARENT_PACKAGE_NAME}_SUBPACKAGES}) - SET(SUBPACKAGE_NAME ${TRIBITS_SUBPACKAGE}) - SET(SUBPACKAGE_FULLNAME ${PARENT_PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + set(SUBPACKAGE_NAME ${TRIBITS_SUBPACKAGE}) + set(SUBPACKAGE_FULLNAME ${PARENT_PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - IF (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - PREPEND_SET(PARENT_PACKAGE_INCLUDE_DIRS + if (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + prepend_set(PARENT_PACKAGE_INCLUDE_DIRS ${${SUBPACKAGE_FULLNAME}_INCLUDE_DIRS}) - PREPEND_SET(PARENT_PACKAGE_LIBRARY_DIRS + prepend_set(PARENT_PACKAGE_LIBRARY_DIRS ${${SUBPACKAGE_FULLNAME}_LIBRARY_DIRS}) - PREPEND_SET(PARENT_PACKAGE_LIBRARIES + prepend_set(PARENT_PACKAGE_LIBRARIES ${${SUBPACKAGE_FULLNAME}_LIBRARIES}) - ENDIF() + endif() - MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") + math(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") - ENDFOREACH() + endforeach() - IF (PARENT_PACKAGE_INCLUDE_DIRS) - LIST(REMOVE_DUPLICATES PARENT_PACKAGE_INCLUDE_DIRS) - ENDIF() - IF (PARENT_PACKAGE_LIBRARY_DIRS) - LIST(REMOVE_DUPLICATES PARENT_PACKAGE_LIBRARY_DIRS) - ENDIF() + if (PARENT_PACKAGE_INCLUDE_DIRS) + list(REMOVE_DUPLICATES PARENT_PACKAGE_INCLUDE_DIRS) + endif() + if (PARENT_PACKAGE_LIBRARY_DIRS) + list(REMOVE_DUPLICATES PARENT_PACKAGE_LIBRARY_DIRS) + endif() # NOTE: Above, in the rare case that none of the subpackages contain any # libraries or any include directories, we need to not call - # LIST(REMOVE_DUPLICATES ...). + # list(REMOVE_DUPLICATES ...). - # NOTE: There can't be any dupicate libraries in PARENT_PACKAGE_LIBRARIES + # NOTE: There can't be any duplicate libraries in PARENT_PACKAGE_LIBRARIES # so no need to remove them. - GLOBAL_SET(${PACKAGE_NAME}_INCLUDE_DIRS "${PARENT_PACKAGE_INCLUDE_DIRS}") - GLOBAL_SET(${PACKAGE_NAME}_LIBRARY_DIRS "${PARENT_PACKAGE_LIBRARY_DIRS}") - GLOBAL_SET(${PACKAGE_NAME}_LIBRARIES "${PARENT_PACKAGE_LIBRARIES}") + global_set(${PACKAGE_NAME}_INCLUDE_DIRS "${PARENT_PACKAGE_INCLUDE_DIRS}") + global_set(${PACKAGE_NAME}_LIBRARY_DIRS "${PARENT_PACKAGE_LIBRARY_DIRS}") + global_set(${PACKAGE_NAME}_LIBRARIES "${PARENT_PACKAGE_LIBRARIES}") - ELSEIF(NOT ${PACKAGE_NAME}_INCLUDE_DIRS) + elseif(NOT ${PACKAGE_NAME}_INCLUDE_DIRS) # No libraries have been defined for this package so we are going to set # them based on this package's dependencies. - TRIBITS_SORT_AND_APPEND_PACKAGE_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_package_include_and_link_dirs_and_libs( ${PACKAGE_NAME} LIB LINK_LIBS) - TRIBITS_SORT_AND_APPEND_TPL_INCLUDE_AND_LINK_DIRS_AND_LIBS( + tribits_sort_and_append_tpl_include_and_link_dirs_and_libs( ${PACKAGE_NAME} LIB LINK_LIBS) - GET_DIRECTORY_PROPERTY(INCLUDE_DIRS_CURRENT INCLUDE_DIRECTORIES) - GET_DIRECTORY_PROPERTY(LIBRARY_DIRS_CURRENT PACKAGE_LIBRARY_DIRS) + get_directory_property(INCLUDE_DIRS_CURRENT INCLUDE_DIRECTORIES) + get_directory_property(LIBRARY_DIRS_CURRENT PACKAGE_LIBRARY_DIRS) - PREPEND_GLOBAL_SET(${PACKAGE_NAME}_INCLUDE_DIRS ${INCLUDE_DIRS_CURRENT}) - PREPEND_GLOBAL_SET(${PACKAGE_NAME}_LIBRARY_DIRS ${LIBRARY_DIRS_CURRENT}) - PREPEND_GLOBAL_SET(${PACKAGE_NAME}_LIBRARIES ${LINK_LIBS}) + prepend_global_set(${PACKAGE_NAME}_INCLUDE_DIRS ${INCLUDE_DIRS_CURRENT}) + prepend_global_set(${PACKAGE_NAME}_LIBRARY_DIRS ${LIBRARY_DIRS_CURRENT}) + prepend_global_set(${PACKAGE_NAME}_LIBRARIES ${LINK_LIBS}) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # -# Helper macro for [SUB]TRIBITS_PACKAGE_POSTPROCESS() +# Helper macro for [SUB]tribits_package_postprocess() # -MACRO(TRIBITS_PACKAGE_POSTPROCESS_COMMON) +macro(tribits_package_postprocess_common) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nTRIBITS_PACKAGE_POSTPROCESS_COMMON: ${PACKAGE_NAME}") - PRINT_VAR(${PACKAGE_NAME}_INCLUDE_DIRS) - PRINT_VAR(${PACKAGE_NAME}_LIBRARY_DIRS) - PRINT_VAR(${PACKAGE_NAME}_LIBRARIES) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nTRIBITS_PACKAGE_POSTPROCESS_COMMON: ${PACKAGE_NAME}") + print_var(${PACKAGE_NAME}_INCLUDE_DIRS) + print_var(${PACKAGE_NAME}_LIBRARY_DIRS) + print_var(${PACKAGE_NAME}_LIBRARIES) + endif() - IF (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES OR + if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES OR ${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES ) # Create the configure file so external projects can find packages with a # call to find_package(). This also creates the # Makefile.export.* files. - TRIBITS_WRITE_PACKAGE_CLIENT_EXPORT_FILES(${PACKAGE_NAME}) - ENDIF() + tribits_write_package_client_export_files(${PACKAGE_NAME}) + endif() - SET(${PACKAGE_NAME}_FINISHED_FIRST_CONFIGURE TRUE + set(${PACKAGE_NAME}_FINISHED_FIRST_CONFIGURE TRUE CACHE INTERNAL "") -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_PACKAGE_POSTPROCESS() +# @MACRO: tribits_package_postprocess() # # Macro called at the very end of a package's top-level # `/CMakeLists.txt`_ file that performs some critical @@ -729,106 +730,106 @@ ENDMACRO() # # Usage:: # -# TRIBITS_PACKAGE_POSTPROCESS() +# tribits_package_postprocess() # # NOTE: It is unfortunate that this macro must be called in a packages's # top-level ``CMakeLists.txt`` file but limitations of the CMake language make # it necessary to do so. # -MACRO(TRIBITS_PACKAGE_POSTPROCESS) +macro(tribits_package_postprocess) # check that this is not being called from inside a subpackage - IF (CURRENTLY_PROCESSING_SUBPACKAGE) - IF(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Cannot call TRIBITS_PACKAGE_POSTPROCESS() in a subpackage." - " Use TRIBITS_SUBPACKAGE_POSTPROCESS() instead" + if (CURRENTLY_PROCESSING_SUBPACKAGE) + if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Cannot call tribits_package_postprocess() in a subpackage." + " Use tribits_subpackage_postprocess() instead" " ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() - ENDIF() + endif() + endif() - IF(${PACKAGE_NAME}_SUBPACKAGES) + if(${PACKAGE_NAME}_SUBPACKAGES) # This is a package that has subpackages - IF(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED OR + if(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED OR NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED OR NOT ${PACKAGE_NAME}_TRIBITS_PROCESS_SUBPACKAGES_CALLED ) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "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()" + tribits_report_invalid_tribits_usage( + "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:" - " TRIBITS_PACKAGE_DECL" - " TRIBITS_PROCESS_SUBPACKAGES" - " TRIBITS_PACKAGE_DEF" - " TRIBITS_PACKAGE_POSTPROCESS" - " in file: " + " tribits_package_decl()" + " tribits_process_subpackages()" + " tribits_package_def()" + " tribits_package_postprocess()" + " in: " "${TRIBITS_PACKAGE_CMAKELIST_FILE}" ) - ENDIF() + endif() - ELSE() + else() # This is a package without subpackages - IF ( + if ( (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()" + 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}" ) - ENDIF() + endif() - ENDIF() + endif() - IF(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_PACKAGE() before TRIBITS_PACKAGE_POSTPROCESS()" - "Or if your package has subpackages you must first call TRIBITS_PACKAGE_DECL, " - "then TRIBITS_PROCESS_SUBPACKAGES, then TRIBITS_PACKAGE_DEF, then" - " TRIBITS_PACKAGE_POSTPROCESS" + if(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_package() before tribits_package_postprocess()." + " Or if your package has subpackages you must first call tribits_package_decl()," + " then tribits_process_subpackages(), then tribits_package_def(), then" + " tribits_package_postprocess() in" " ${TRIBITS_PACKAGE_CMAKELIST_FILE}" ) - ENDIF() + endif() - IF(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "TRIBITS_PACKAGE_POSTPROCESS() has been called more than once in" + if(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "tribits_package_postprocess() has been called more than once in" " ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() # Only parent packages have the targets (${PACKAGE_NAME}_libs and # (${PACKAGE_NAME}_all - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nTRIBITS_PACKAGE_POSTPROCESS: ${PACKAGE_NAME}") - PRINT_VAR(${PACKAGE_NAME}_LIB_TARGETS) - PRINT_VAR(${PACKAGE_NAME}_ALL_TARGETS) - ENDIF() - ADD_CUSTOM_TARGET(${PACKAGE_NAME}_libs DEPENDS ${${PACKAGE_NAME}_LIB_TARGETS}) - ADD_CUSTOM_TARGET(${PACKAGE_NAME}_all DEPENDS ${${PACKAGE_NAME}_ALL_TARGETS}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nTRIBITS_PACKAGE_POSTPROCESS: ${PACKAGE_NAME}") + print_var(${PACKAGE_NAME}_LIB_TARGETS) + print_var(${PACKAGE_NAME}_ALL_TARGETS) + endif() + add_custom_target(${PACKAGE_NAME}_libs DEPENDS ${${PACKAGE_NAME}_LIB_TARGETS}) + add_custom_target(${PACKAGE_NAME}_all DEPENDS ${${PACKAGE_NAME}_ALL_TARGETS}) - TRIBITS_PACKAGE_FINALIZE_DEPENDENCY_VARS() - TRIBITS_PACKAGE_POSTPROCESS_COMMON() + tribits_package_finalize_dependency_vars() + tribits_package_postprocess_common() - IF (${PACKAGE_NAME}_SOURCE_DIR STREQUAL ${PROJECT_NAME}_SOURCE_DIR) - SET(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS TRUE) - ELSE() - SET(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS TRUE PARENT_SCOPE) - ENDIF() + if (${PACKAGE_NAME}_SOURCE_DIR STREQUAL ${PROJECT_NAME}_SOURCE_DIR) + set(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS TRUE) + else() + set(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS TRUE PARENT_SCOPE) + endif() - SET(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED TRUE) + set(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED TRUE) -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_PROCESS_SUBPACKAGES() +# @MACRO: tribits_process_subpackages() # # Macro that processes the `TriBITS Subpackages`_ for a parent `TriBITS # package`_ for packages that are broken down into subpackages. This is @@ -836,86 +837,86 @@ ENDMACRO() # # Usage:: # -# TRIBITS_PROCESS_SUBPACKAGES() +# tribits_process_subpackages() # -# This macro must be called after `TRIBITS_PACKAGE_DECL()`_ but before -# `TRIBITS_PACKAGE_DEF()`_. +# This macro must be called after `tribits_package_decl()`_ but before +# `tribits_package_def()`_. # -MACRO(TRIBITS_PROCESS_SUBPACKAGES) +macro(tribits_process_subpackages) - IF (CURRENTLY_PROCESSING_SUBPACKAGE) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Cannot call TRIBITS_PROCESS_SUBPACKAGES() in a subpackage." + if (CURRENTLY_PROCESSING_SUBPACKAGE) + tribits_report_invalid_tribits_usage( + "Cannot call tribits_process_subpackages() in a subpackage." " subpackages cannot contain other subpackages" " ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - IF (${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_PROCESS_SUBPACKAGES() before TRIBITS_PACKAGE_POSTPROCESS()" + if (${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_process_subpackages() before tribits_package_postprocess()" " in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - IF (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_PACKAGE_DECL() before TRIBITS_PROCESS_SUBPACKAGES()" - "in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + if (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_package_decl() before tribits_process_subpackages()" + " in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") + endif() - IF (${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Must call TRIBITS_PACKAGE_DEF() after TRIBITS_PROCESS_SUBPACKAGES()" + if (${PACKAGE_NAME}_TRIBITS_PACKAGE_DEF_CALLED) + tribits_report_invalid_tribits_usage( + "Must call tribits_package_def() after tribits_process_subpackages()" " in ${TRIBITS_PACKAGE_CMAKELIST_FILE}") - ENDIF() + endif() - IF (NOT ${PARENT_PACKAGE_NAME}_SUBPACKAGES) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( + if (NOT ${PARENT_PACKAGE_NAME}_SUBPACKAGES) + tribits_report_invalid_tribits_usage( "The TriBITS Package '${PACKAGE_NAME}' does not have any subpackages." - " Therefore, you are not allowed to call TRIBITS_PROCESS_SUBPACKAGES()!") - ENDIF() + " Therefore, you are not allowed to call tribits_process_subpackages()!") + endif() - SET(SUBPACKAGE_IDX 0) - FOREACH(TRIBITS_SUBPACKAGE ${${PARENT_PACKAGE_NAME}_SUBPACKAGES}) + set(SUBPACKAGE_IDX 0) + foreach(TRIBITS_SUBPACKAGE ${${PARENT_PACKAGE_NAME}_SUBPACKAGES}) - #MESSAGE("") - #PRINT_VAR(SUBPACKAGE_IDX) - #PRINT_VAR(TRIBITS_SUBPACKAGE) + #message("") + #print_var(SUBPACKAGE_IDX) + #print_var(TRIBITS_SUBPACKAGE) - SET(SUBPACKAGE_NAME ${TRIBITS_SUBPACKAGE}) - SET(SUBPACKAGE_FULLNAME ${PARENT_PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - #PRINT_VAR(SUBPACKAGE_FULLNAME) + set(SUBPACKAGE_NAME ${TRIBITS_SUBPACKAGE}) + set(SUBPACKAGE_FULLNAME ${PARENT_PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + #print_var(SUBPACKAGE_FULLNAME) - IF (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) + if (${PROJECT_NAME}_ENABLE_${SUBPACKAGE_FULLNAME}) - LIST(GET ${PARENT_PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_IDX} SUBPACKAGE_DIR) - #PRINT_VAR(SUBPACKAGE_DIR) + list(GET ${PARENT_PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_IDX} SUBPACKAGE_DIR) + #print_var(SUBPACKAGE_DIR) - IF (NOT ${PROJECT_NAME}_BINARY_DIR STREQUAL ${PARENT_PACKAGE_NAME}_BINARY_DIR) - DUAL_SCOPE_SET(${SUBPACKAGE_FULLNAME}_BINARY_DIR + if (NOT ${PROJECT_NAME}_BINARY_DIR STREQUAL ${PARENT_PACKAGE_NAME}_BINARY_DIR) + dual_scope_set(${SUBPACKAGE_FULLNAME}_BINARY_DIR ${${PARENT_PACKAGE_NAME}_BINARY_DIR}/${SUBPACKAGE_DIR}) - ELSE() - SET(${SUBPACKAGE_FULLNAME}_BINARY_DIR + else() + set(${SUBPACKAGE_FULLNAME}_BINARY_DIR ${${PARENT_PACKAGE_NAME}_BINARY_DIR}/${SUBPACKAGE_DIR}) - ENDIF() + endif() - SET(CURRENT_SUBPACKAGE_CMAKELIST_FILE + set(CURRENT_SUBPACKAGE_CMAKELIST_FILE "${${SUBPACKAGE_FULLNAME}_SOURCE_DIR}/CMakeLists.txt") - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE ADD_SUBDIR + tribits_trace_file_processing(PACKAGE ADD_SUBDIR ${CURRENT_SUBPACKAGE_CMAKELIST_FILE} ) - SET(CURRENTLY_PROCESSING_SUBPACKAGE ${SUBPACKAGE_FULLNAME}) - ADD_SUBDIRECTORY(${${SUBPACKAGE_FULLNAME}_SOURCE_DIR} + set(CURRENTLY_PROCESSING_SUBPACKAGE ${SUBPACKAGE_FULLNAME}) + add_subdirectory(${${SUBPACKAGE_FULLNAME}_SOURCE_DIR} ${${SUBPACKAGE_FULLNAME}_BINARY_DIR}) - ENDIF() + endif() - MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") + math(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") - ENDFOREACH() + endforeach() - SET(CURRENTLY_PROCESSING_SUBPACKAGE FALSE) - SET(${PACKAGE_NAME}_TRIBITS_PROCESS_SUBPACKAGES_CALLED TRUE) + set(CURRENTLY_PROCESSING_SUBPACKAGE FALSE) + set(${PACKAGE_NAME}_TRIBITS_PROCESS_SUBPACKAGES_CALLED TRUE) -ENDMACRO() +endmacro() ################################################################## @@ -933,7 +934,7 @@ ENDMACRO() # ${PARENT_PACKAGE_NAME}_LIB_TARGETS # ${PARENT_PACKAGE_NAME}_ALL_TARGETS # -# without carefully studying the documentation in README.DEPENENCIES and then +# without carefully studying the documentation in README.DEPENDENCIES and then # carefully studying all of the code and issues that modify these variables! # # ToDo: Write some good unit tests that pin down the behavior of all of this! diff --git a/cmake/tribits/core/package_arch/TribitsPackageSetupCompilerFlags.cmake b/cmake/tribits/core/package_arch/TribitsPackageSetupCompilerFlags.cmake index 87eaf3ee88b9..8646b83e04cf 100644 --- a/cmake/tribits/core/package_arch/TribitsPackageSetupCompilerFlags.cmake +++ b/cmake/tribits/core/package_arch/TribitsPackageSetupCompilerFlags.cmake @@ -38,9 +38,9 @@ # @HEADER -INCLUDE(TribitsSetupStrongCompileWarnings) -INCLUDE(PrependCmndlineArgs) -INCLUDE(DualScopeAppendCmndlineArgs) +include(TribitsSetupStrongCompileWarnings) +include(PrependCmndlineArgs) +include(DualScopeAppendCmndlineArgs) # @@ -48,66 +48,66 @@ INCLUDE(DualScopeAppendCmndlineArgs) # -MACRO(TRIBITS_APPLY_WARNINGS_AS_ERROR_FLAGS_LANG LANG) - PREPEND_CMNDLINE_ARGS(CMAKE_${LANG}_FLAGS +macro(tribits_apply_warnings_as_error_flags_lang LANG) + prepend_cmndline_args(CMAKE_${LANG}_FLAGS "${${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS}") - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Setting up for ${LANG} warnings as errors just in this package ...") - PRINT_VAR(CMAKE_${LANG}_FLAGS) - ENDIF() -ENDMACRO() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Setting up for ${LANG} warnings as errors just in this package ...") + print_var(CMAKE_${LANG}_FLAGS) + endif() +endmacro() -MACRO(TRIBITS_SET_PACKAGE_LANGUAGE_FLAGS LANG) +macro(tribits_set_package_language_flags LANG) - #MESSAGE("Entering TRIBITS_SET_PACKAGE_LANGUAGE_FLAGS(${LANG})") - #PRINT_VAR(${PROJECT_NAME}_ENABLE_STRONG_${LANG}_COMPILE_WARNINGS) + #message("Entering tribits_set_package_language_flags(${LANG})") + #print_var(${PROJECT_NAME}_ENABLE_STRONG_${LANG}_COMPILE_WARNINGS) - IF (${PACKAGE_NAME}_${LANG}_FLAGS) - DUAL_SCOPE_APPEND_CMNDLINE_ARGS(CMAKE_${LANG}_FLAGS + if (${PACKAGE_NAME}_${LANG}_FLAGS) + dual_scope_append_cmndline_args(CMAKE_${LANG}_FLAGS "${${PACKAGE_NAME}_${LANG}_FLAGS}") - ENDIF() + endif() - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Adding strong ${LANG} warning flags \"${${LANG}_STRONG_COMPILE_WARNING_FLAGS}\"") - PRINT_VAR(CMAKE_${LANG}_FLAGS) - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Adding strong ${LANG} warning flags \"${${LANG}_STRONG_COMPILE_WARNING_FLAGS}\"") + print_var(CMAKE_${LANG}_FLAGS) + endif() -ENDMACRO() +endmacro() -FUNCTION(TRIBITS_SETUP_ADD_PACKAGE_COMPILE_FLAGS) +function(tribits_setup_add_package_compile_flags) - #MESSAGE("Entering TRIBITS_SETUP_ADD_PACKAGE_COMPILE_FLAGS()") + #message("Entering tribits_setup_add_package_compile_flags()") # # C compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_C CMAKE_C_COMPILER_ID) - IF (${PROJECT_NAME}_ENABLE_C) - TRIBITS_SET_PACKAGE_LANGUAGE_FLAGS(C) - ENDIF() + assert_defined(${PROJECT_NAME}_ENABLE_C CMAKE_C_COMPILER_ID) + if (${PROJECT_NAME}_ENABLE_C) + tribits_set_package_language_flags(C) + endif() # # C++ compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_CXX CMAKE_CXX_COMPILER_ID) - IF (${PROJECT_NAME}_ENABLE_CXX) - TRIBITS_SET_PACKAGE_LANGUAGE_FLAGS(CXX) - ENDIF() + assert_defined(${PROJECT_NAME}_ENABLE_CXX CMAKE_CXX_COMPILER_ID) + if (${PROJECT_NAME}_ENABLE_CXX) + tribits_set_package_language_flags(CXX) + endif() # # Fortran compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_Fortran) - IF (${PROJECT_NAME}_ENABLE_Fortran) - TRIBITS_SET_PACKAGE_LANGUAGE_FLAGS(Fortran) - ENDIF() + assert_defined(${PROJECT_NAME}_ENABLE_Fortran) + if (${PROJECT_NAME}_ENABLE_Fortran) + tribits_set_package_language_flags(Fortran) + endif() -ENDFUNCTION() +endfunction() @@ -127,39 +127,39 @@ ENDFUNCTION() # This CMake code is broken out in order to allow it to be unit tested. # -MACRO(TRIBITS_SETUP_COMPILER_FLAGS PACKAGE_NAME_IN) +macro(tribits_setup_compiler_flags PACKAGE_NAME_IN) # Set up strong warning flags - IF (NOT PARSE_DISABLE_STRONG_WARNINGS AND NOT ${PACKAGE_NAME_IN}_DISABLE_STRONG_WARNINGS) - TRIBITS_SETUP_STRONG_COMPILE_WARNINGS(${PARSE_ENABLE_SHADOWING_WARNINGS}) - ENDIF() + if (NOT PARSE_DISABLE_STRONG_WARNINGS AND NOT ${PACKAGE_NAME_IN}_DISABLE_STRONG_WARNINGS) + tribits_setup_strong_compile_warnings(${PARSE_ENABLE_SHADOWING_WARNINGS}) + endif() # Set up for warnings as errors if requested - ASSERT_DEFINED(PARSE_CLEANED) + assert_defined(PARSE_CLEANED) - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_C ${PROJECT_NAME}_ENABLE_C_DEBUG_COMPILE_FLAGS) - IF (PARSE_CLEANED AND ${PROJECT_NAME}_ENABLE_STRONG_C_COMPILE_WARNINGS) - TRIBITS_APPLY_WARNINGS_AS_ERROR_FLAGS_LANG(C) - ENDIF() + assert_defined(${PROJECT_NAME}_ENABLE_C ${PROJECT_NAME}_ENABLE_C_DEBUG_COMPILE_FLAGS) + if (PARSE_CLEANED AND ${PROJECT_NAME}_ENABLE_STRONG_C_COMPILE_WARNINGS) + tribits_apply_warnings_as_error_flags_lang(C) + endif() - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_CXX ${PROJECT_NAME}_ENABLE_CXX_DEBUG_COMPILE_FLAGS) - IF (PARSE_CLEANED AND ${PROJECT_NAME}_ENABLE_STRONG_CXX_COMPILE_WARNINGS) - TRIBITS_APPLY_WARNINGS_AS_ERROR_FLAGS_LANG(CXX) - ENDIF() + assert_defined(${PROJECT_NAME}_ENABLE_CXX ${PROJECT_NAME}_ENABLE_CXX_DEBUG_COMPILE_FLAGS) + if (PARSE_CLEANED AND ${PROJECT_NAME}_ENABLE_STRONG_CXX_COMPILE_WARNINGS) + tribits_apply_warnings_as_error_flags_lang(CXX) + endif() # Append package specific options - TRIBITS_SETUP_ADD_PACKAGE_COMPILE_FLAGS() - - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("Final compiler flags:") - PRINT_VAR(CMAKE_CXX_FLAGS) - PRINT_VAR(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}) - PRINT_VAR(CMAKE_C_FLAGS) - PRINT_VAR(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}) - PRINT_VAR(CMAKE_Fortran_FLAGS) - PRINT_VAR(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}) - ENDIF() - -ENDMACRO() + tribits_setup_add_package_compile_flags() + + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Final compiler flags:") + print_var(CMAKE_CXX_FLAGS) + print_var(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}) + print_var(CMAKE_C_FLAGS) + print_var(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}) + print_var(CMAKE_Fortran_FLAGS) + print_var(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}) + endif() + +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsPrintDependencyInfo.cmake b/cmake/tribits/core/package_arch/TribitsPrintDependencyInfo.cmake index 408d7567e8d6..52a39a3c93cb 100644 --- a/cmake/tribits/core/package_arch/TribitsPrintDependencyInfo.cmake +++ b/cmake/tribits/core/package_arch/TribitsPrintDependencyInfo.cmake @@ -38,83 +38,83 @@ # @HEADER -# @FUNCTION: TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() +# @FUNCTION: tribits_print_initial_dependency_info() # # Usage:: # -# TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() +# tribits_print_initial_dependency_info() # # Function that prints whatever initial dependency information that is # available that is requested by the user after the initial construction of # the package dependency graph but **before** the call of -# `TRIBITS_ADJUST_PACKAGE_ENABLES()`_. +# `tribits_adjust_package_enables()`_. # # Calls: # -# * `TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS()`_ -# * `TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO()`_ +# * `tribits_print_tentatively_enabled_tpls()`_ +# * `tribits_dump_package_dependencies_info()`_ # -FUNCTION(TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO) - TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() - TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() -ENDFUNCTION() +function(tribits_print_initial_dependency_info) + tribits_print_tentatively_enabled_tpls() + tribits_dump_package_dependencies_info() +endfunction() -# @FUNCTION: TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() +# @FUNCTION: tribits_print_tentatively_enabled_tpls() # # Usage:: # -# TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS() +# tribits_print_tentatively_enabled_tpls() # # Function that print the set of tentatively enabled TPLs. # # Does **not** modify any state! # -FUNCTION(TRIBITS_PRINT_TENTATIVELY_ENABLED_TPLS) - FOREACH(TPL ${${PROJECT_NAME}_TPLS}) - IF (TPL_TENTATIVE_ENABLE_${TPL}) - MESSAGE("-- Tentatively enabling TPL '${TPL}'") - #PRINT_VAR(TPL_ENABLE_${TPL}) - ENDIF() - ENDFOREACH() -ENDFUNCTION() +function(tribits_print_tentatively_enabled_tpls) + foreach(TPL ${${PROJECT_NAME}_TPLS}) + if (TPL_TENTATIVE_ENABLE_${TPL}) + message("-- Tentatively enabling TPL '${TPL}'") + #print_var(TPL_ENABLE_${TPL}) + endif() + endforeach() +endfunction() -# @FUNCTION: TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() +# @FUNCTION: tribits_dump_package_dependencies_info() # # Usage: # -# TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO() +# tribits_dump_package_dependencies_info() # # Function that dumps (prints to STDOUT) the package dependency info if # ``${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES==TRUE``. # # Does **not** modify state! # -FUNCTION(TRIBITS_DUMP_PACKAGE_DEPENDENCIES_INFO) +function(tribits_dump_package_dependencies_info) - ADVANCED_OPTION(${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES + advanced_option(${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES "Dump the package dependency information." "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) - ADVANCED_OPTION(${PROJECT_NAME}_DUMP_FORWARD_PACKAGE_DEPENDENCIES + advanced_option(${PROJECT_NAME}_DUMP_FORWARD_PACKAGE_DEPENDENCIES "Dump the package forward dependency information." "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) - IF (${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES) - MESSAGE("") - MESSAGE("Printing package dependencies ...") - MESSAGE("") - PRINT_NONEMPTY_VAR_WITH_SPACES(${PROJECT_NAME}_PACKAGES DUMMY_OUT) - MESSAGE("") - PRINT_NONEMPTY_VAR_WITH_SPACES(${PROJECT_NAME}_SE_PACKAGES DUMMY_OUT) - MESSAGE("") - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) - TRIBITS_PRINT_PACKAGE_DEPENDENCIES(${TRIBITS_PACKAGE}) - MESSAGE("") - ENDFOREACH() - ENDIF() + if (${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES) + message("") + message("Printing package dependencies ...") + message("") + print_nonempty_var_with_spaces(${PROJECT_NAME}_PACKAGES DUMMY_OUT) + message("") + print_nonempty_var_with_spaces(${PROJECT_NAME}_SE_PACKAGES DUMMY_OUT) + message("") + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_SE_PACKAGES}) + tribits_print_package_dependencies(${TRIBITS_PACKAGE}) + message("") + endforeach() + endif() -ENDFUNCTION() +endfunction() # LocalWords: TRIBITS diff --git a/cmake/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake b/cmake/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake index 6e8a2a0ca5d0..dd4eece4a5cf 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake @@ -39,86 +39,86 @@ # Standard TriBITS Includes -INCLUDE(TribitsTplFindIncludeDirsAndLibraries) -INCLUDE(TribitsGeneralMacros) +include(TribitsTplFindIncludeDirsAndLibraries) +include(TribitsGeneralMacros) # Standard TriBITS utilities includes -INCLUDE(AppendStringVar) -INCLUDE(TribitsStandardizePaths) +include(AppendStringVar) +include(TribitsStandardizePaths) # -# @FUNCTION: TRIBITS_PROCESS_ENABLED_TPL() +# @FUNCTION: tribits_process_enabled_tpl() # # Process an enabled TPL's FindTPL${TPL_NAME}.cmake module. # -FUNCTION(TRIBITS_PROCESS_ENABLED_TPL TPL_NAME) +function(tribits_process_enabled_tpl TPL_NAME) # Setup the processing string - SET(PROCESSING_MSG_STRING "Processing enabled TPL: ${TPL_NAME} (") - IF (TPL_${TPL_NAME}_ENABLING_PKG) - APPEND_STRING_VAR(PROCESSING_MSG_STRING + set(PROCESSING_MSG_STRING "Processing enabled TPL: ${TPL_NAME} (") + if (TPL_${TPL_NAME}_ENABLING_PKG) + append_string_var(PROCESSING_MSG_STRING "enabled by ${TPL_${TPL_NAME}_ENABLING_PKG}," ) - ELSE() - APPEND_STRING_VAR(PROCESSING_MSG_STRING + else() + append_string_var(PROCESSING_MSG_STRING "enabled explicitly," ) - ENDIF() - APPEND_STRING_VAR(PROCESSING_MSG_STRING + endif() + append_string_var(PROCESSING_MSG_STRING " disable with -DTPL_ENABLE_${TPL_NAME}=OFF)" ) # Print the processing header - MESSAGE("${PROCESSING_MSG_STRING}") + message("${PROCESSING_MSG_STRING}") - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) # Locate the FindTPL${TPL_NAME}.cmake module - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${TPL_NAME}_FINDMOD) - ENDIF() - #PRINT_VAR(${TPL_NAME}_FINDMOD) - IF (${TPL_NAME}_FINDMOD STREQUAL "TRIBITS_PKG") - SET(TPL_${TPL_NAME}_PARTS_ALREADY_SET FALSE) # ToDo: Take out? - IF (NOT TPL_${TPL_NAME}_PARTS_ALREADY_SET) - FIND_PACKAGE(${TPL_NAME} CONFIG REQUIRED) - #PRINT_VAR(${TPL_NAME}_INCLUDE_DIRS) - #PRINT_VAR(${TPL_NAME}_LIBRARIES) - TRIBITS_STANDARDIZE_ABS_PATHS(THIS_TPL_INCLUDE_DIRS + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${TPL_NAME}_FINDMOD) + endif() + #print_var(${TPL_NAME}_FINDMOD) + if (${TPL_NAME}_FINDMOD STREQUAL "TRIBITS_PKG") + set(TPL_${TPL_NAME}_PARTS_ALREADY_SET FALSE) # ToDo: Take out? + if (NOT TPL_${TPL_NAME}_PARTS_ALREADY_SET) + find_package(${TPL_NAME} CONFIG REQUIRED) + #print_var(${TPL_NAME}_INCLUDE_DIRS) + #print_var(${TPL_NAME}_LIBRARIES) + tribits_standardize_abs_paths(THIS_TPL_INCLUDE_DIRS ${${TPL_NAME}_INCLUDE_DIRS} ${${TPL_NAME}_TPL_INCLUDE_DIRS}) - GLOBAL_SET(TPL_${TPL_NAME}_INCLUDE_DIRS ${THIS_TPL_INCLUDE_DIRS}) - GLOBAL_SET(TPL_${TPL_NAME}_LIBRARIES + global_set(TPL_${TPL_NAME}_INCLUDE_DIRS ${THIS_TPL_INCLUDE_DIRS}) + global_set(TPL_${TPL_NAME}_LIBRARIES "${${TPL_NAME}_LIBRARIES}" "${${TPL_NAME}_TPL_LIBRARIES}") - GLOBAL_SET(TPL_${TPL_NAME}_PARTS_ALREADY_SET TRUE) - ENDIF() - #PRINT_VAR(TPL_${TPL_NAME}_INCLUDE_DIRS) - #PRINT_VAR(TPL_${TPL_NAME}_LIBRARIES) - RETURN() - ELSEIF (IS_ABSOLUTE ${${TPL_NAME}_FINDMOD}) - #MESSAGE("${${TPL_NAME}_FINDMOD} is absolute!") - SET(CURRENT_TPL_PATH "${${TPL_NAME}_FINDMOD}") - ELSE() - #MESSAGE("${${TPL_NAME}_FINDMOD} is *NOT* absolute!") - SET(CURRENT_TPL_PATH "${PROJECT_SOURCE_DIR}/${${TPL_NAME}_FINDMOD}") - ENDIF() - #PRINT_VAR(CURRENT_TPL_PATH) + global_set(TPL_${TPL_NAME}_PARTS_ALREADY_SET TRUE) + endif() + #print_var(TPL_${TPL_NAME}_INCLUDE_DIRS) + #print_var(TPL_${TPL_NAME}_LIBRARIES) + return() + elseif (IS_ABSOLUTE ${${TPL_NAME}_FINDMOD}) + #message("${${TPL_NAME}_FINDMOD} is absolute!") + set(CURRENT_TPL_PATH "${${TPL_NAME}_FINDMOD}") + else() + #message("${${TPL_NAME}_FINDMOD} is *NOT* absolute!") + set(CURRENT_TPL_PATH "${PROJECT_SOURCE_DIR}/${${TPL_NAME}_FINDMOD}") + endif() + #print_var(CURRENT_TPL_PATH) # Process the FindTPL${TPL_NAME}.cmake module - TRIBITS_TRACE_FILE_PROCESSING(TPL INCLUDE "${CURRENT_TPL_PATH}") - INCLUDE("${CURRENT_TPL_PATH}") + tribits_trace_file_processing(TPL INCLUDE "${CURRENT_TPL_PATH}") + include("${CURRENT_TPL_PATH}") - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(TPL_${TPL_NAME}_NOT_FOUND) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(TPL_${TPL_NAME}_NOT_FOUND) + endif() # Address failed find of the TPL - IF (TPL_${TPL_NAME}_NOT_FOUND AND NOT TPL_TENTATIVE_ENABLE_${TPL_NAME}) - MESSAGE( + if (TPL_${TPL_NAME}_NOT_FOUND AND NOT TPL_TENTATIVE_ENABLE_${TPL_NAME}) + message( "-- NOTE: The find module file for this failed TPL '${TPL_NAME}' is:\n" " ${CURRENT_TPL_PATH}\n" " which is pointed to in the file:\n" " ${${TPL_NAME}_TPLS_LIST_FILE}\n" ) - IF (TPL_${TPL_NAME}_ENABLING_PKG) - MESSAGE( + if (TPL_${TPL_NAME}_ENABLING_PKG) + message( "TIP: One way to get past the configure failure for the\n" "TPL '${TPL_NAME}' is to simply disable it with:\n" " -DTPL_ENABLE_${TPL_NAME}=OFF\n" @@ -129,8 +129,8 @@ FUNCTION(TRIBITS_PROCESS_ENABLED_TPL TPL_NAME) "and then follow the disables that occur as a result to see what impact\n" "this TPL disable has on the configuration of ${PROJECT_NAME}.\n" ) - ELSE() - MESSAGE( + else() + message( "TIP: Even though the TPL '${TPL_NAME}' was explicitly enabled in input,\n" "it can be disabled with:\n" " -DTPL_ENABLE_${TPL_NAME}=OFF\n" @@ -140,18 +140,18 @@ FUNCTION(TRIBITS_PROCESS_ENABLED_TPL TPL_NAME) "and then follow the disables that occur as a result to see what impact\n" "this TPL disable has on the configuration of ${PROJECT_NAME}.\n" ) - ENDIF() - MESSAGE(FATAL_ERROR + endif() + message(FATAL_ERROR "ERROR: TPL_${TPL_NAME}_NOT_FOUND=${TPL_${TPL_NAME}_NOT_FOUND}, aborting!") - ENDIF() + endif() - # Assert that the TPL correctly defined all of these varaibles. - ASSERT_DEFINED(TPL_${TPL_NAME}_INCLUDE_DIRS) - ASSERT_DEFINED(TPL_${TPL_NAME}_LIBRARIES) - ASSERT_DEFINED(TPL_${TPL_NAME}_LIBRARY_DIRS) + # Assert that the TPL correctly defined all of these variables + assert_defined(TPL_${TPL_NAME}_INCLUDE_DIRS) + assert_defined(TPL_${TPL_NAME}_LIBRARIES) + assert_defined(TPL_${TPL_NAME}_LIBRARY_DIRS) # ToDo: Make TPL_${TPL_NAME}_LIBRARY_DIRS go away. It is not needed for # anything. - ENDIF() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsProcessExtraRepositoriesList.cmake b/cmake/tribits/core/package_arch/TribitsProcessExtraRepositoriesList.cmake index 0acd90917397..01b7b5274cb1 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessExtraRepositoriesList.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessExtraRepositoriesList.cmake @@ -38,24 +38,24 @@ # @HEADER -INCLUDE(SetCacheOnOffEmpty) -INCLUDE(MultilineSet) -INCLUDE(AdvancedOption) -INCLUDE(AssertDefined) -INCLUDE(Split) -INCLUDE(MessageWrapper) -INCLUDE(TribitsSortListAccordingToMasterList) +include(SetCacheOnOffEmpty) +include(MultilineSet) +include(AdvancedOption) +include(AssertDefined) +include(Split) +include(MessageWrapper) +include(TribitsSortListAccordingToMasterList) # -# @MACRO: TRIBITS_PROJECT_DEFINE_EXTRA_REPOSITORIES() +# @MACRO: tribits_project_define_extra_repositories() # # Declare a set of extra repositories for the `TriBITS Project`_ (i.e. in the # project's `/cmake/ExtraRepositoriesList.cmake`_ file). # # Usage:: # -# TRIBITS_PROJECT_DEFINE_EXTRA_REPOSITORIES( +# tribits_project_define_extra_repositories( # # # ... @@ -80,7 +80,7 @@ INCLUDE(TribitsSortListAccordingToMasterList) # empty ``""`` (in which case ```` must be empty as well). # WARNING: Only VC repos of type ``GIT`` can fully participate in the # TriBITS development tool workflows. The other VC types are only -# supported for basic cloning and updating using `TRIBITS_CTEST_DRIVER()`_ +# supported for basic cloning and updating using `tribits_ctest_driver()`_ # scripts. # # 3. **REPO_URL** (````): The URL of the VC repo. This info is @@ -156,45 +156,45 @@ INCLUDE(TribitsSortListAccordingToMasterList) # # * The variable name can change in the future as an implementation detail. # -MACRO(TRIBITS_PROJECT_DEFINE_EXTRA_REPOSITORIES) - ASSERT_DEFINED(PROJECT_NAME) - IF ("${ARGN}" STREQUAL "") - SET(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) - ELSE() - SET(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY "${ARGN}") - ENDIF() -ENDMACRO() +macro(tribits_project_define_extra_repositories) + assert_defined(PROJECT_NAME) + if ("${ARGN}" STREQUAL "") + set(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) + else() + set(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY "${ARGN}") + endif() +endmacro() # # Field offsets # -SET(ERP_REPO_NAME_OFFSET 0) -SET(ERP_REPO_DIR_OFFSET 1) -SET(ERP_REPO_VCTYPE_OFFSET 2) -SET(ERP_REPO_REPOURL_OFFSET 3) -SET(ERP_REPO_PACKSTAT_OFFSET 4) -SET(ERP_REPO_CLASSIFICATION_OFFSET 5) +set(ERP_REPO_NAME_OFFSET 0) +set(ERP_REPO_DIR_OFFSET 1) +set(ERP_REPO_VCTYPE_OFFSET 2) +set(ERP_REPO_REPOURL_OFFSET 3) +set(ERP_REPO_PACKSTAT_OFFSET 4) +set(ERP_REPO_CLASSIFICATION_OFFSET 5) -SET(ERP_NUM_FIELDS_PER_REPO 6) +set(ERP_NUM_FIELDS_PER_REPO 6) # # Dump the list of extra repos in verbose mode # -FUNCTION(TRIBITS_DUMP_EXTRA_REPOSITORIES_LIST) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE OR TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT) - PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) - PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES) - PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS) - PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) - PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS) - PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES) - PRINT_VAR(${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT) - PRINT_VAR(${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT) - ENDIF() -ENDFUNCTION() +function(tribits_dump_extra_repositories_list) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE OR TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT) + print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) + print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES) + print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS) + print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) + print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS) + print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES) + print_var(${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT) + print_var(${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT) + endif() +endfunction() # @@ -202,48 +202,48 @@ ENDFUNCTION() # ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY and returns # HASPKGS and PREPOST. # -FUNCTION(TRIBITS_PARSE_EXTRAREPO_PACKSTAT PACKSTAT_IN +function(tribits_parse_extrarepo_packstat PACKSTAT_IN HASPKGS_OUT PREPOST_OUT ) - #PRINT_VAR(PACKSTAT_IN) - SPLIT("${PACKSTAT_IN}" "," PACKSTAT_IN_ARRAY) + #print_var(PACKSTAT_IN) + split("${PACKSTAT_IN}" "," PACKSTAT_IN_ARRAY) # Set the defaults - SET(HASPKGS "HASPACKAGES") - SET(PREPOST "POST") - - FOREACH(PACKSTAT_ELE ${PACKSTAT_IN_ARRAY}) - #PRINT_VAR(PACKSTAT_ELE) - STRING(STRIP "${PACKSTAT_ELE}" PACKSTAT_ELE) - #PRINT_VAR(PACKSTAT_ELE) - IF (PACKSTAT_ELE STREQUAL "HASPACKAGES") - SET(HASPKGS "HASPACKAGES") - ELSEIF (PACKSTAT_ELE STREQUAL "NOPACKAGES") - SET(HASPKGS "NOPACKAGES") - ELSEIF (PACKSTAT_ELE STREQUAL "PRE") - SET(PREPOST "PRE") - ELSEIF (PACKSTAT_ELE STREQUAL "POST") - SET(PREPOST "POST") - ELSE() - MESSAGE_WRAPPER(FATAL_ERROR "Error, the value of 'PACKSTAT' element" + set(HASPKGS "HASPACKAGES") + set(PREPOST "POST") + + foreach(PACKSTAT_ELE ${PACKSTAT_IN_ARRAY}) + #print_var(PACKSTAT_ELE) + string(STRIP "${PACKSTAT_ELE}" PACKSTAT_ELE) + #print_var(PACKSTAT_ELE) + if (PACKSTAT_ELE STREQUAL "HASPACKAGES") + set(HASPKGS "HASPACKAGES") + elseif (PACKSTAT_ELE STREQUAL "NOPACKAGES") + set(HASPKGS "NOPACKAGES") + elseif (PACKSTAT_ELE STREQUAL "PRE") + set(PREPOST "PRE") + elseif (PACKSTAT_ELE STREQUAL "POST") + set(PREPOST "POST") + else() + message_wrapper(FATAL_ERROR "Error, the value of 'PACKSTAT' element" " '${PACKSTAT_ELE}' is not valid! Valid choices are '' (empty)," " 'HASPACKAGES', 'NOPACKAGES', 'PRE', and 'POST'. The defaults if all" " fields are empty are 'HASPACKAGES' and 'POST'") - ENDIF() - ENDFOREACH() - # NOTE: In the above FOREACH(PACKSTAT_ELE ${PACKSTAT_IN_ARRAY}) loop, empty + endif() + endforeach() + # NOTE: In the above foreach(PACKSTAT_ELE ${PACKSTAT_IN_ARRAY}) loop, empty # elements are skipped! # Set the output arguments - SET(${HASPKGS_OUT} "${HASPKGS}" PARENT_SCOPE) - SET(${PREPOST_OUT} "${PREPOST}" PARENT_SCOPE) + set(${HASPKGS_OUT} "${HASPKGS}" PARENT_SCOPE) + set(${PREPOST_OUT} "${PREPOST}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() # -# Macro that processes the list varaible contents in -# ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY into sperate arrays: +# Macro that processes the list variable contents in +# ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY into separate arrays: # # ${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT # ${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT @@ -258,211 +258,211 @@ ENDFUNCTION() # The macro responds to ${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE # to match the categories. # -MACRO(TRIBITS_PROCESS_EXTRAREPOS_LISTS) +macro(tribits_process_extrarepos_lists) - IF ( + if ( ("${${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY}" STREQUAL "") AND (NOT "${${PROJECT_NAME}_EXTRAREPOS_DIR_REPOTYPE_REPOURL_PACKSTAT_CATEGORY}" STREQUAL "") ) - MESSAGE(WARNING "Warning! Usage of the variable" + message(WARNING "Warning! Usage of the variable" " '${PROJECT_NAME}_EXTRAREPOS_DIR_REPOTYPE_REPOURL_PACKSTAT_CATEGORY'" - " is deprecated. Please use the macro TRIBITS_PROJECT_DEFINE_EXTRA_REPOSITORIES()" + " is deprecated. Please use the macro tribits_project_define_extra_repositories()" " instead!") - SET( ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY + set( ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY "${${PROJECT_NAME}_EXTRAREPOS_DIR_REPOTYPE_REPOURL_PACKSTAT_CATEGORY}" ) - ENDIF() + endif() # A) Get the total number of extrarepos defined - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) - ENDIF() - ASSERT_DEFINED(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) - LIST(LENGTH ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) + endif() + assert_defined(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) + list(LENGTH ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY ${PROJECT_NAME}_NUM_EXTRAREPOS_AND_FIELDS ) - MATH(EXPR ${PROJECT_NAME}_NUM_EXTRAREPOS + math(EXPR ${PROJECT_NAME}_NUM_EXTRAREPOS "${${PROJECT_NAME}_NUM_EXTRAREPOS_AND_FIELDS}/${ERP_NUM_FIELDS_PER_REPO}") - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(${PROJECT_NAME}_NUM_EXTRAREPOS) - ENDIF() - MATH(EXPR ${PROJECT_NAME}_LAST_EXTRAREPO_IDX "${${PROJECT_NAME}_NUM_EXTRAREPOS}-1") - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(${PROJECT_NAME}_LAST_EXTRAREPO_IDX) - ENDIF() + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(${PROJECT_NAME}_NUM_EXTRAREPOS) + endif() + math(EXPR ${PROJECT_NAME}_LAST_EXTRAREPO_IDX "${${PROJECT_NAME}_NUM_EXTRAREPOS}-1") + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(${PROJECT_NAME}_LAST_EXTRAREPO_IDX) + endif() # B) Process the list of extra repos - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES) - SET(${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT) - SET(${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT) + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT) + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES) + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS) + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS) + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES) + set(${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT) + set(${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT) - SET(PROCESSED_POST_EXTRAREPO FALSE) + set(PROCESSED_POST_EXTRAREPO FALSE) - FOREACH(EXTRAREPO_IDX RANGE ${${PROJECT_NAME}_LAST_EXTRAREPO_IDX}) + foreach(EXTRAREPO_IDX RANGE ${${PROJECT_NAME}_LAST_EXTRAREPO_IDX}) # B.1) Extract the fields for the current extrarepo row # NAME - MATH(EXPR EXTRAREPO_NAME_IDX + math(EXPR EXTRAREPO_NAME_IDX "${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_NAME_OFFSET}") - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_NAME_IDX) - ENDIF() - LIST(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_NAME_IDX) + endif() + list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY ${EXTRAREPO_NAME_IDX} EXTRAREPO_NAME ) - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_NAME) - ENDIF() + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_NAME) + endif() # DIR - MATH(EXPR EXTRAREPO_DIR_IDX + math(EXPR EXTRAREPO_DIR_IDX "${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_DIR_OFFSET}") - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_DIR_IDX) - ENDIF() - LIST(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_DIR_IDX) + endif() + list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY ${EXTRAREPO_DIR_IDX} EXTRAREPO_DIR ) - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_DIR) - ENDIF() - IF (EXTRAREPO_DIR STREQUAL "") - SET(EXTRAREPO_DIR ${EXTRAREPO_NAME}) - ENDIF() - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_DIR) - ENDIF() + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_DIR) + endif() + if (EXTRAREPO_DIR STREQUAL "") + set(EXTRAREPO_DIR ${EXTRAREPO_NAME}) + endif() + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_DIR) + endif() # VCTYPE - MATH(EXPR EXTRAREPO_VCTYPE_IDX + math(EXPR EXTRAREPO_VCTYPE_IDX "${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_VCTYPE_OFFSET}") - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_VCTYPE_IDX) - ENDIF() - LIST(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_VCTYPE_IDX) + endif() + list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY ${EXTRAREPO_VCTYPE_IDX} EXTRAREPO_VCTYPE ) - IF (EXTRAREPO_VCTYPE STREQUAL GIT + if (EXTRAREPO_VCTYPE STREQUAL GIT OR EXTRAREPO_VCTYPE STREQUAL SVN ) # Okay - ELSEIF (EXTRAREPO_VCTYPE STREQUAL HG) + elseif (EXTRAREPO_VCTYPE STREQUAL HG) # not quite okay - MESSAGE(WARNING "Warning: the repo ${EXTRAREPO_NAME} is a Mercurial repo: these are tolerated, but not fully supported.") - ELSEIF (EXTRAREPO_VCTYPE STREQUAL "") + message(WARNING "Warning: the repo ${EXTRAREPO_NAME} is a Mercurial repo: these are tolerated, but not fully supported.") + elseif (EXTRAREPO_VCTYPE STREQUAL "") # We are okay with no VC type - ELSE() - MESSAGE(FATAL_ERROR "Error, the repo type of '${EXTRAREPO_VCTYPE}' for" + else() + message(FATAL_ERROR "Error, the repo type of '${EXTRAREPO_VCTYPE}' for" " extra repo ${EXTRAREPO_NAME} is *not* valid. Valid choices are 'GIT', 'HG' and 'SVN'!") - ENDIF() - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_VCTYPE) - ENDIF() + endif() + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_VCTYPE) + endif() # REPOURL - MATH(EXPR EXTRAREPO_REPOURL_IDX + math(EXPR EXTRAREPO_REPOURL_IDX "${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_REPOURL_OFFSET}") - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_REPOURL_IDX) - ENDIF() - LIST(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_REPOURL_IDX) + endif() + list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY ${EXTRAREPO_REPOURL_IDX} EXTRAREPO_REPOURL ) - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_REPOURL) - ENDIF() + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_REPOURL) + endif() # PACKSTAT (PACKSTAT and PREPOST) - MATH(EXPR EXTRAREPO_PACKSTAT_IDX + math(EXPR EXTRAREPO_PACKSTAT_IDX "${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_PACKSTAT_OFFSET}") - LIST(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY + list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY ${EXTRAREPO_PACKSTAT_IDX} EXTRAREPO_PACKSTAT ) - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_PACKSTAT) - ENDIF() - TRIBITS_PARSE_EXTRAREPO_PACKSTAT("${EXTRAREPO_PACKSTAT}" + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_PACKSTAT) + endif() + tribits_parse_extrarepo_packstat("${EXTRAREPO_PACKSTAT}" EXTRAREPO_HASPKGS EXTRAREPO_PREPOST ) # CLASSIFICATION - MATH(EXPR EXTRAREPO_CLASSIFICATION_IDX + math(EXPR EXTRAREPO_CLASSIFICATION_IDX "${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_CLASSIFICATION_OFFSET}") - LIST(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY + list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY ${EXTRAREPO_CLASSIFICATION_IDX} EXTRAREPO_CLASSIFICATION ) - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(EXTRAREPO_CLASSIFICATION) - ENDIF() + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(EXTRAREPO_CLASSIFICATION) + endif() # Assert that PRE repos never come after a POST repo - IF (NOT PROCESSED_POST_EXTRAREPO AND EXTRAREPO_PREPOST STREQUAL "POST") - SET(PROCESSED_POST_EXTRAREPO TRUE) - ELSEIF (PROCESSED_POST_EXTRAREPO AND EXTRAREPO_PREPOST STREQUAL "PRE") - MESSAGE_WRAPPER(FATAL_ERROR "Error, the 'PRE' extra repo '${EXTRAREPO_NAME}'" + if (NOT PROCESSED_POST_EXTRAREPO AND EXTRAREPO_PREPOST STREQUAL "POST") + set(PROCESSED_POST_EXTRAREPO TRUE) + elseif (PROCESSED_POST_EXTRAREPO AND EXTRAREPO_PREPOST STREQUAL "PRE") + message_wrapper(FATAL_ERROR "Error, the 'PRE' extra repo '${EXTRAREPO_NAME}'" " specified in the PACKSTAT field '${EXTRAREPO_PACKSTAT}' came directly after" " a 'POST' extra repo! All 'PRE' extra repos must be listed before all" " 'POST' extra repos!" ) - ENDIF() + endif() # B.2) Unconditionally add the extrarepo to the list - LIST(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) - LIST(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_DIR}) - LIST(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${EXTRAREPO_VCTYPE}) - LIST(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${EXTRAREPO_REPOURL}) - LIST(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_HASPKGS}) - LIST(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${EXTRAREPO_PREPOST}) - LIST(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES + list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) + list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_DIR}) + list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${EXTRAREPO_VCTYPE}) + list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${EXTRAREPO_REPOURL}) + list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_HASPKGS}) + list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${EXTRAREPO_PREPOST}) + list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES ${EXTRAREPO_CLASSIFICATION}) - IF (EXTRAREPO_PREPOST STREQUAL "PRE") - LIST(APPEND ${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) - ELSEIF (EXTRAREPO_PREPOST STREQUAL "POST") - LIST(APPEND ${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) - ELSE() - MESSAGE(FATAL_ERROR "Error, bad value for EXTRAREPO_PREPOST!") - ENDIF() + if (EXTRAREPO_PREPOST STREQUAL "PRE") + list(APPEND ${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) + elseif (EXTRAREPO_PREPOST STREQUAL "POST") + list(APPEND ${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) + else() + message(FATAL_ERROR "Error, bad value for EXTRAREPO_PREPOST!") + endif() - ENDFOREACH() + endforeach() # C) Get the actual number of active extra repos - LIST(LENGTH ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT ${PROJECT_NAME}_NUM_EXTRAREPOS ) - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(${PROJECT_NAME}_NUM_EXTRAREPOS) - ENDIF() - MATH(EXPR ${PROJECT_NAME}_LAST_EXTRAREPO_IDX "${${PROJECT_NAME}_NUM_EXTRAREPOS}-1") + list(LENGTH ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT ${PROJECT_NAME}_NUM_EXTRAREPOS ) + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(${PROJECT_NAME}_NUM_EXTRAREPOS) + endif() + math(EXPR ${PROJECT_NAME}_LAST_EXTRAREPO_IDX "${${PROJECT_NAME}_NUM_EXTRAREPOS}-1") # D) Print the final set of extrarepos in verbose mode - TRIBITS_DUMP_EXTRA_REPOSITORIES_LIST() + tribits_dump_extra_repositories_list() -ENDMACRO() +endmacro() # -# Assert the existance and the order of the list of extra repositories in +# Assert the existence and the order of the list of extra repositories in # ${PROJECT_NAME}_PRE_REPOSITORIES listed in # ${PROJECT_NAME}_EXTRA_REPOSITORIES according to the list read in from the -# extra repos file as determined by the varaible +# extra repos file as determined by the variable # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT. # -FUNCTION(TRIBITS_EXTRA_REPOSITORIES_ASSERT_SUBSET_AND_ORDER_WRT_FILE) - SET(ALL_EXTRA_REPOSITORIES_IN +function(tribits_extra_repositories_assert_subset_and_order_wrt_file) + set(ALL_EXTRA_REPOSITORIES_IN ${${PROJECT_NAME}_PRE_REPOSITORIES} ${${PROJECT_NAME}_EXTRA_REPOSITORIES}) - SET(ALL_EXTRA_REPOSITORIES_SORTED ${ALL_EXTRA_REPOSITORIES_IN}) - TRIBITS_SORT_LIST_ACCORDING_TO_MASTER_LIST( + set(ALL_EXTRA_REPOSITORIES_SORTED ${ALL_EXTRA_REPOSITORIES_IN}) + tribits_sort_list_according_to_master_list( "${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT}" ALL_EXTRA_REPOSITORIES_SORTED) - IF (NOT "${ALL_EXTRA_REPOSITORIES_IN}" STREQUAL "${ALL_EXTRA_REPOSITORIES_SORTED}") - MESSAGE(FATAL_ERROR + if (NOT "${ALL_EXTRA_REPOSITORIES_IN}" STREQUAL "${ALL_EXTRA_REPOSITORIES_SORTED}") + message(FATAL_ERROR "ERROR! The list of extra repos passed in '${ALL_EXTRA_REPOSITORIES_IN}'" " is not a subset and in the same order as read in from extra repos file" " '${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT}'" ) - ENDIF() -ENDFUNCTION() + endif() +endfunction() # @@ -491,14 +491,14 @@ ENDFUNCTION() # If ${PROJECT_NAME}_PRE_REPOSITORIES or ${PROJECT_NAME}_EXTRA_REPOSITORIES # are non-empty (it is assumed that the extra repos listed are a subset of # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT, which can be asserted so by -# calling TRIBITS_EXTRA_REPOSITORIES_ASSERT_SUBSET_AND_ORDER_WRT_FILE()), then +# calling tribits_extra_repositories_assert_subset_and_order_wrt_file()), then # the set of repos and the associated data will be filtered based on # ${PROJECT_NAME}_PRE_REPOSITORIES and ${PROJECT_NAME}_EXTRA_REPOSITORIES. # # If ${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES==TRUE, then the set of # repos will be filtered based on what repos are present. If # ${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES==FALSE, then all of the -# repos must exist or MESSSAGE(FATAL_ERROR ...) is called and will fail the +# repos must exist or message(FATAL_ERROR ...) is called and will fail the # configure. # # On output the variables: @@ -516,199 +516,199 @@ ENDFUNCTION() # will be set according to the logic described above and the other extra repo # variables will be filtered in a consistent way. # -FUNCTION(TRIBITS_FILTER_OR_ASSERT_EXTRA_REPOS) +function(tribits_filter_or_assert_extra_repos) # Get the list of repos to filter - IF ("${${PROJECT_NAME}_PRE_REPOSITORIES}" STREQUAL "") - SET(${PROJECT_NAME}_PRE_REPOSITORIES_IN ${${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT}) - ELSE() - SET(${PROJECT_NAME}_PRE_REPOSITORIES_IN ${${PROJECT_NAME}_PRE_REPOSITORIES}) - ENDIF() + if ("${${PROJECT_NAME}_PRE_REPOSITORIES}" STREQUAL "") + set(${PROJECT_NAME}_PRE_REPOSITORIES_IN ${${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT}) + else() + set(${PROJECT_NAME}_PRE_REPOSITORIES_IN ${${PROJECT_NAME}_PRE_REPOSITORIES}) + endif() - IF ("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" STREQUAL "") - SET(${PROJECT_NAME}_EXTRA_REPOSITORIES_IN ${${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT}) - ELSE() - SET(${PROJECT_NAME}_EXTRA_REPOSITORIES_IN ${${PROJECT_NAME}_EXTRA_REPOSITORIES}) - ENDIF() + if ("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" STREQUAL "") + set(${PROJECT_NAME}_EXTRA_REPOSITORIES_IN ${${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT}) + else() + set(${PROJECT_NAME}_EXTRA_REPOSITORIES_IN ${${PROJECT_NAME}_EXTRA_REPOSITORIES}) + endif() - SET(ALL_EXTRA_REPOSITORIES_IN + set(ALL_EXTRA_REPOSITORIES_IN ${${PROJECT_NAME}_PRE_REPOSITORIES_IN} ${${PROJECT_NAME}_EXTRA_REPOSITORIES_IN}) # Get out of function if there are no pre-extra or post-extra repos - IF ("${ALL_EXTRA_REPOSITORIES_IN}" STREQUAL "") - RETURN() - ENDIF() + if ("${ALL_EXTRA_REPOSITORIES_IN}" STREQUAL "") + return() + endif() # A) Loop through and copy info for existing repos to temp arrays - SET(PRE_REPOSITORIES_TMP) - SET(EXTRA_REPOSITORIES_TMP) - SET(ALL_EXTRA_REPOSITORIES_TMP) - SET(ALL_EXTRA_REPOSITORIES_DIRS_TMP) - SET(ALL_EXTRA_REPOSITORIES_VCTYPES_TMP) - SET(ALL_EXTRA_REPOSITORIES_REPOURLS_TMP) - SET(ALL_EXTRA_REPOSITORIES_HASPKGS_TMP) - SET(ALL_EXTRA_REPOSITORIES_PREPOSTS_TMP) - SET(ALL_EXTRA_REPOSITORIES_CATEGORIES_TMP) + set(PRE_REPOSITORIES_TMP) + set(EXTRA_REPOSITORIES_TMP) + set(ALL_EXTRA_REPOSITORIES_TMP) + set(ALL_EXTRA_REPOSITORIES_DIRS_TMP) + set(ALL_EXTRA_REPOSITORIES_VCTYPES_TMP) + set(ALL_EXTRA_REPOSITORIES_REPOURLS_TMP) + set(ALL_EXTRA_REPOSITORIES_HASPKGS_TMP) + set(ALL_EXTRA_REPOSITORIES_PREPOSTS_TMP) + set(ALL_EXTRA_REPOSITORIES_CATEGORIES_TMP) # Set-up for filtering based on ALL_EXTRA_REPOSITORIES_IN != "" - LIST(LENGTH ALL_EXTRA_REPOSITORIES_IN ALL_EXTRA_REPOSITORIES_IN_LEN) - #PRINT_VAR(ALL_EXTRA_REPOSITORIES_IN_LEN) - SET(EXTRAREPO_IN_IDX 0) - LIST(GET ALL_EXTRA_REPOSITORIES_IN ${EXTRAREPO_IN_IDX} EXTRAREPO_IN) + list(LENGTH ALL_EXTRA_REPOSITORIES_IN ALL_EXTRA_REPOSITORIES_IN_LEN) + #print_var(ALL_EXTRA_REPOSITORIES_IN_LEN) + set(EXTRAREPO_IN_IDX 0) + list(GET ALL_EXTRA_REPOSITORIES_IN ${EXTRAREPO_IN_IDX} EXTRAREPO_IN) # Loop over full list of extra repos from extra repos file - SET(EXTRAREPO_IDX 0) - FOREACH(EXTRAREPO_NAME ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT}) + set(EXTRAREPO_IDX 0) + foreach(EXTRAREPO_NAME ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT}) - #PRINT_VAR(EXTRAREPO_NAME) - #PRINT_VAR(EXTRAREPO_IN) + #print_var(EXTRAREPO_NAME) + #print_var(EXTRAREPO_IN) # A.1) Extract the data for current extra repo from file - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_IDX} EXTRAREPO_DIR ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${EXTRAREPO_IDX} EXTRAREPO_VCTYPE ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${EXTRAREPO_IDX} EXTRAREPO_REPOURL ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_IDX} EXTRAREPO_HASPKGS ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${EXTRAREPO_IDX} EXTRAREPO_PREPOST ) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES ${EXTRAREPO_IDX} + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES ${EXTRAREPO_IDX} EXTRAREPO_CATEGORY ) # A.2) Determine if to add the extra repo EXTRAREPO_NAME - IF (EXTRAREPO_IN_IDX EQUAL ALL_EXTRA_REPOSITORIES_IN_LEN) + if (EXTRAREPO_IN_IDX EQUAL ALL_EXTRA_REPOSITORIES_IN_LEN) # All of the extra repos in ALL_EXTRA_REPOSITORIES_IN have already # been processed. - SET(ADD_EXTRAREPO FALSE) - ELSEIF (EXTRAREPO_IN STREQUAL EXTRAREPO_NAME) + set(ADD_EXTRAREPO FALSE) + elseif (EXTRAREPO_IN STREQUAL EXTRAREPO_NAME) # We have a match, add the extra repo! - SET(ADD_EXTRAREPO TRUE) + set(ADD_EXTRAREPO TRUE) # Update EXTRAREPO_IN to look for next! - MATH(EXPR EXTRAREPO_IN_IDX "${EXTRAREPO_IN_IDX}+1") - IF (EXTRAREPO_IN_IDX LESS ALL_EXTRA_REPOSITORIES_IN_LEN) - LIST(GET ALL_EXTRA_REPOSITORIES_IN ${EXTRAREPO_IN_IDX} EXTRAREPO_IN) - ELSE() + math(EXPR EXTRAREPO_IN_IDX "${EXTRAREPO_IN_IDX}+1") + if (EXTRAREPO_IN_IDX LESS ALL_EXTRA_REPOSITORIES_IN_LEN) + list(GET ALL_EXTRA_REPOSITORIES_IN ${EXTRAREPO_IN_IDX} EXTRAREPO_IN) + else() # We have found the last repo already so move on - SET(EXTRAREPO_IN "") - ENDIF() - ELSE() + set(EXTRAREPO_IN "") + endif() + else() # We are not at the end of the list in ALL_EXTRA_REPOSITORIES_IN yet # and have not reached the next entry in the list so don't add. - SET(ADD_EXTRAREPO FALSE) - ENDIF() + set(ADD_EXTRAREPO FALSE) + endif() - #PRINT_VAR(ADD_EXTRAREPO) + #print_var(ADD_EXTRAREPO) # A.3) Determine the match of the category - IF (ADD_EXTRAREPO) + if (ADD_EXTRAREPO) - SET(ADD_EXTRAREPO FALSE) + set(ADD_EXTRAREPO FALSE) - #ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) - IF (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) - PRINT_VAR(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) - ENDIF() + #assert_defined(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) + if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) + print_var(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) + endif() - IF (${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE STREQUAL "Continuous" AND + if (${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE STREQUAL "Continuous" AND EXTRAREPO_CATEGORY STREQUAL "Continuous" ) - SET(ADD_EXTRAREPO TRUE) - ELSEIF (${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE STREQUAL "Nightly" AND + set(ADD_EXTRAREPO TRUE) + elseif (${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE STREQUAL "Nightly" AND (EXTRAREPO_CATEGORY STREQUAL "Continuous" OR EXTRAREPO_CATEGORY STREQUAL "Nightly") ) - SET(ADD_EXTRAREPO TRUE) - ENDIF() + set(ADD_EXTRAREPO TRUE) + endif() - ENDIF() + endif() # A.3) Determine if the repo exists - SET(EXTRAREPO_EXISTS TRUE) - IF (ADD_EXTRAREPO AND ${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST + set(EXTRAREPO_EXISTS TRUE) + if (ADD_EXTRAREPO AND ${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST AND NOT UNITTEST_SKIP_FILTER_OR_ASSERT_EXTRA_REPOS ) - ASSERT_DEFINED(PROJECT_SOURCE_DIR) - SET(EXTRAREPO_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${EXTRAREPO_DIR}") - IF (EXISTS "${EXTRAREPO_SOURCE_DIR}") - SET(EXTRAREPO_EXISTS TRUE) - ELSE() - SET(EXTRAREPO_EXISTS FALSE) - ENDIF() - #PRINT_VAR(EXTRAREPO_EXISTS) - - IF (NOT EXTRAREPO_EXISTS) - SET(ADD_EXTRAREPO FALSE) - IF (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) - MESSAGE("-- " + assert_defined(PROJECT_SOURCE_DIR) + set(EXTRAREPO_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${EXTRAREPO_DIR}") + if (EXISTS "${EXTRAREPO_SOURCE_DIR}") + set(EXTRAREPO_EXISTS TRUE) + else() + set(EXTRAREPO_EXISTS FALSE) + endif() + #print_var(EXTRAREPO_EXISTS) + + if (NOT EXTRAREPO_EXISTS) + set(ADD_EXTRAREPO FALSE) + if (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) + message("-- " "NOTE: Ignoring missing extra repo '${EXTRAREPO_NAME}'" " as requested since ${EXTRAREPO_SOURCE_DIR} does not exist" ) - ELSE() - MESSAGE( FATAL_ERROR + else() + message( FATAL_ERROR "ERROR! Skipping missing extra repo '${EXTRAREPO_NAME}'" " since ${EXTRAREPO_SOURCE_DIR} does not exist!\n") - ENDIF() - ENDIF() + endif() + endif() - ENDIF() + endif() - #PRINT_VAR(ADD_EXTRAREPO) + #print_var(ADD_EXTRAREPO) # A.4) Conditionally copy the info for the extra repo - IF (ADD_EXTRAREPO) - MESSAGE("-- " "Adding ${EXTRAREPO_PREPOST} extra ${EXTRAREPO_CATEGORY} repository ${EXTRAREPO_NAME} ...") - IF (EXTRAREPO_PREPOST STREQUAL "PRE") - LIST(APPEND PRE_REPOSITORIES_TMP ${EXTRAREPO_NAME}) - ELSEIF (EXTRAREPO_PREPOST STREQUAL "POST") - LIST(APPEND EXTRA_REPOSITORIES_TMP ${EXTRAREPO_NAME}) - ENDIF() - LIST(APPEND ALL_EXTRA_REPOSITORIES_TMP ${EXTRAREPO_NAME}) - LIST(APPEND ALL_EXTRA_REPOSITORIES_DIRS_TMP ${EXTRAREPO_DIR}) - LIST(APPEND ALL_EXTRA_REPOSITORIES_VCTYPES_TMP ${EXTRAREPO_VCTYPE}) - LIST(APPEND ALL_EXTRA_REPOSITORIES_REPOURLS_TMP ${EXTRAREPO_REPOURL}) - LIST(APPEND ALL_EXTRA_REPOSITORIES_HASPKGS_TMP ${EXTRAREPO_HASPKGS}) - LIST(APPEND ALL_EXTRA_REPOSITORIES_PREPOSTS_TMP ${EXTRAREPO_PREPOST}) - LIST(APPEND ALL_EXTRA_REPOSITORIES_CATEGORIES_TMP ${EXTRAREPO_CATEGORY}) - ELSE() - LIST(APPEND CPACK_SOURCE_IGNORE_FILES + if (ADD_EXTRAREPO) + message("-- " "Adding ${EXTRAREPO_PREPOST} extra ${EXTRAREPO_CATEGORY} repository ${EXTRAREPO_NAME} ...") + if (EXTRAREPO_PREPOST STREQUAL "PRE") + list(APPEND PRE_REPOSITORIES_TMP ${EXTRAREPO_NAME}) + elseif (EXTRAREPO_PREPOST STREQUAL "POST") + list(APPEND EXTRA_REPOSITORIES_TMP ${EXTRAREPO_NAME}) + endif() + list(APPEND ALL_EXTRA_REPOSITORIES_TMP ${EXTRAREPO_NAME}) + list(APPEND ALL_EXTRA_REPOSITORIES_DIRS_TMP ${EXTRAREPO_DIR}) + list(APPEND ALL_EXTRA_REPOSITORIES_VCTYPES_TMP ${EXTRAREPO_VCTYPE}) + list(APPEND ALL_EXTRA_REPOSITORIES_REPOURLS_TMP ${EXTRAREPO_REPOURL}) + list(APPEND ALL_EXTRA_REPOSITORIES_HASPKGS_TMP ${EXTRAREPO_HASPKGS}) + list(APPEND ALL_EXTRA_REPOSITORIES_PREPOSTS_TMP ${EXTRAREPO_PREPOST}) + list(APPEND ALL_EXTRA_REPOSITORIES_CATEGORIES_TMP ${EXTRAREPO_CATEGORY}) + else() + list(APPEND CPACK_SOURCE_IGNORE_FILES "${${PROJECT_NAME}_SOURCE_DIR}/${EXTRAREPO_DIR}/") - IF (EXTRAREPO_EXISTS) - MESSAGE("-- " "*NOT* adding ${EXTRAREPO_PREPOST} extra ${EXTRAREPO_CATEGORY} repository ${EXTRAREPO_NAME}!") - ENDIF() - ENDIF() + if (EXTRAREPO_EXISTS) + message("-- " "*NOT* adding ${EXTRAREPO_PREPOST} extra ${EXTRAREPO_CATEGORY} repository ${EXTRAREPO_NAME}!") + endif() + endif() - MATH(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") + math(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") - ENDFOREACH() + endforeach() # B) Copy over extra repos arrays with filtered arrays - SET(${PROJECT_NAME}_PRE_REPOSITORIES + set(${PROJECT_NAME}_PRE_REPOSITORIES ${PRE_REPOSITORIES_TMP} PARENT_SCOPE) - SET(${PROJECT_NAME}_EXTRA_REPOSITORIES + set(${PROJECT_NAME}_EXTRA_REPOSITORIES ${EXTRA_REPOSITORIES_TMP} PARENT_SCOPE) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES ${ALL_EXTRA_REPOSITORIES_TMP} PARENT_SCOPE) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${ALL_EXTRA_REPOSITORIES_DIRS_TMP} PARENT_SCOPE) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${ALL_EXTRA_REPOSITORIES_VCTYPES_TMP} PARENT_SCOPE) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${ALL_EXTRA_REPOSITORIES_REPOURLS_TMP} PARENT_SCOPE) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${ALL_EXTRA_REPOSITORIES_HASPKGS_TMP} PARENT_SCOPE) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${ALL_EXTRA_REPOSITORIES_PREPOSTS_TMP} PARENT_SCOPE) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES ${ALL_EXTRA_REPOSITORIES_CATEGORIES_TMP} PARENT_SCOPE) - TRIBITS_DUMP_EXTRA_REPOSITORIES_LIST() + tribits_dump_extra_repositories_list() -ENDFUNCTION() +endfunction() # @@ -727,7 +727,7 @@ ENDFUNCTION() # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES # -# On output, the following varaibles are set: +# On output, the following variables are set: # # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS @@ -736,72 +736,72 @@ ENDFUNCTION() # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES # -MACRO(TRIBITS_GET_AND_PROCESS_EXTRA_REPOSITORIES_LISTS) +macro(tribits_get_and_process_extra_repositories_lists) - IF (${PROJECT_NAME}_EXTRAREPOS_FILE AND ${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) + if (${PROJECT_NAME}_EXTRAREPOS_FILE AND ${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) # # A) Read in the extra repos list variable and process the list # - MESSAGE("") - MESSAGE("Reading the list of extra repositories from ${${PROJECT_NAME}_EXTRAREPOS_FILE}") - MESSAGE("") + message("") + message("Reading the list of extra repositories from ${${PROJECT_NAME}_EXTRAREPOS_FILE}") + message("") - INCLUDE(${${PROJECT_NAME}_EXTRAREPOS_FILE}) + include(${${PROJECT_NAME}_EXTRAREPOS_FILE}) - TRIBITS_PROCESS_EXTRAREPOS_LISTS() + tribits_process_extrarepos_lists() # Above sets ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT (and DIRS # ... CATEGORIES) # # B) Sort and assert the list of extra repos according to the list read into the file # - IF ( + if ( (${PROJECT_NAME}_PRE_REPOSITORIES OR ${PROJECT_NAME}_EXTRA_REPOSITORIES) AND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT ) - TRIBITS_EXTRA_REPOSITORIES_ASSERT_SUBSET_AND_ORDER_WRT_FILE() - ENDIF() + tribits_extra_repositories_assert_subset_and_order_wrt_file() + endif() # # C) Filter out the missing extra repos or assert errors # - IF (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) - SET(SELECT_REPOS_MSG_SUFFIX "(ignoring missing repos)") - ELSE() - SET(SELECT_REPOS_MSG_SUFFIX "(asserting all selected repos exist)") - ENDIF() - MESSAGE("") - MESSAGE("Selecting the set of '${${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}' extra repos ${SELECT_REPOS_MSG_SUFFIX} ...") - MESSAGE("") - TRIBITS_FILTER_OR_ASSERT_EXTRA_REPOS() - - ELSE() - - IF (${PROJECT_NAME}_PRE_REPOSITORIES OR ${PROJECT_NAME}_EXTRA_REPOSITORIES) - MESSAGE("") - IF (${PROJECT_NAME}_PRE_REPOSITORIES) - MESSAGE("Processing list of PRE extra repos from ${PROJECT_NAME}_PRE_REPOSITORIES" + if (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) + set(SELECT_REPOS_MSG_SUFFIX "(ignoring missing repos)") + else() + set(SELECT_REPOS_MSG_SUFFIX "(asserting all selected repos exist)") + endif() + message("") + message("Selecting the set of '${${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}' extra repos ${SELECT_REPOS_MSG_SUFFIX} ...") + message("") + tribits_filter_or_assert_extra_repos() + + else() + + if (${PROJECT_NAME}_PRE_REPOSITORIES OR ${PROJECT_NAME}_EXTRA_REPOSITORIES) + message("") + if (${PROJECT_NAME}_PRE_REPOSITORIES) + message("Processing list of PRE extra repos from ${PROJECT_NAME}_PRE_REPOSITORIES" "='${${PROJECT_NAME}_PRE_REPOSITORIES}' ...") - ENDIF() - IF (${PROJECT_NAME}_EXTRA_REPOSITORIES) - MESSAGE("Processing list of POST extra repos from ${PROJECT_NAME}_EXTRA_REPOSITORIES" + endif() + if (${PROJECT_NAME}_EXTRA_REPOSITORIES) + message("Processing list of POST extra repos from ${PROJECT_NAME}_EXTRA_REPOSITORIES" "='${${PROJECT_NAME}_EXTRA_REPOSITORIES}' ...") - ENDIF() - MESSAGE("") - ENDIF() + endif() + message("") + endif() - ENDIF() + endif() -ENDMACRO() +endmacro() # # Extract the final name of the extra repo # -FUNCTION(TRIBITS_GET_EXTRAREPO_BASE_NAME EXTRAREPO_NAME EXTRAREPO_NAME_OUT) - GET_FILENAME_COMPONENT(EXTRAREPO_NAME "${EXTRAREPO_NAME}" NAME) - SET(${EXTRAREPO_NAME_OUT} "${EXTRAREPO_NAME}" PARENT_SCOPE) -ENDFUNCTION() +function(tribits_get_extrarepo_base_name EXTRAREPO_NAME EXTRAREPO_NAME_OUT) + get_filename_component(EXTRAREPO_NAME "${EXTRAREPO_NAME}" NAME) + set(${EXTRAREPO_NAME_OUT} "${EXTRAREPO_NAME}" PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake b/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake index 6435cd7c95e7..0987844d45e8 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake @@ -38,14 +38,14 @@ # @HEADER -INCLUDE(SetCacheOnOffEmpty) -INCLUDE(MultilineSet) -INCLUDE(AdvancedOption) -INCLUDE(AdvancedSet) -INCLUDE(AssertDefined) -INCLUDE(PrintVar) -INCLUDE(MessageWrapper) -INCLUDE(TribitsListHelpers) +include(SetCacheOnOffEmpty) +include(MultilineSet) +include(AdvancedOption) +include(AdvancedSet) +include(AssertDefined) +include(PrintVar) +include(MessageWrapper) +include(TribitsListHelpers) # @@ -53,7 +53,7 @@ INCLUDE(TribitsListHelpers) # -# @MACRO: TRIBITS_REPOSITORY_DEFINE_PACKAGES() +# @MACRO: tribits_repository_define_packages() # # Define the set of packages for a given `TriBITS Repository`_. This macro is # typically called from inside of a `/PackagesList.cmake`_ file for a @@ -61,7 +61,7 @@ INCLUDE(TribitsListHelpers) # # Usage:: # -# TRIBITS_REPOSITORY_DEFINE_PACKAGES( +# tribits_repository_define_packages( # # # ... @@ -99,7 +99,7 @@ INCLUDE(TribitsListHelpers) # treats this a one field in the array. The maturity level can be left off # in which case it is assumed to be ``UM`` for "Unspecified Maturity". # This classification for individual packages can be changed to ``EX`` for -# specific platforms by calling `TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS()`_. +# specific platforms by calling `tribits_disable_package_on_platforms()`_. # # **IMPORTANT:** The packages must be listed in increasing order of package # dependencies. That is `No circular dependencies of any kind are allowed`_ @@ -113,7 +113,7 @@ INCLUDE(TribitsListHelpers) # NOTE: For some rare use cases, the package directory ```` is # allowed to be specified as an absolute directory but this absolute directory # must be a subdirectory of the project source base directory given by -# `PROJECT_SOURCE_DIR`_. If not, ``MESSAGE(FATAL_ERROR ...)`` is called and +# `PROJECT_SOURCE_DIR`_. If not, ``message(FATAL_ERROR ...)`` is called and # processing stops immediately. # # NOTE: This macro just sets the variable:: @@ -134,20 +134,20 @@ INCLUDE(TribitsListHelpers) # ``${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS``. If one # misspells the name of the macro, it is an immediate error in CMake. # -MACRO(TRIBITS_REPOSITORY_DEFINE_PACKAGES) - ASSERT_DEFINED(REPOSITORY_NAME) - SET(${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS "${ARGN}") -ENDMACRO() +macro(tribits_repository_define_packages) + assert_defined(REPOSITORY_NAME) + set(${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS "${ARGN}") +endmacro() -# @FUNCTION: TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES() +# @FUNCTION: tribits_allow_missing_external_packages() # # Allow listed packages to be missing and automatically excluded from the # package dependency data-structures. # # Usage:: # -# TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES( ...) +# tribits_allow_missing_external_packages( ...) # # If the missing upstream SE package ```` is optional, then the effect # will be to simply ignore the missing package (i.e. it will never be added to @@ -191,14 +191,14 @@ ENDMACRO() # repositories, one might need to also call this function from the file # `/cmake/ProjectDependenciesSetup.cmake`_. # -FUNCTION(TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES) - FOREACH(TRIBITS_PACKAGE ${ARGN}) - ADVANCED_SET(${TRIBITS_PACKAGE}_ALLOW_MISSING_EXTERNAL_PACKAGE TRUE +function(tribits_allow_missing_external_packages) + foreach(TRIBITS_PACKAGE ${ARGN}) + advanced_set(${TRIBITS_PACKAGE}_ALLOW_MISSING_EXTERNAL_PACKAGE TRUE CACHE BOOL - "Default set by TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES()!" + "Default set by tribits_allow_missing_external_packages()!" ) - ENDFOREACH() -ENDFUNCTION() + endforeach() +endfunction() # @@ -230,150 +230,150 @@ ENDFUNCTION() # # * ${PACKAGE_NAME_IN}_TESTGROUP: Set to PT, ST, or EX # -MACRO(TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS PACKAGE_NAME_IN PACKAGE_TESTGROUP_IN) +macro(tribits_insert_standard_package_options PACKAGE_NAME_IN PACKAGE_TESTGROUP_IN) - IF (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) - MESSAGE("TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS: ${PACKAGE_NAME_IN} ${PACKAGE_TESTGROUP_IN}") - PRINT_VAR(${PACKAGE_NAME_IN}_TESTGROUP) - ENDIF() + if (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) + message("TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS: ${PACKAGE_NAME_IN} ${PACKAGE_TESTGROUP_IN}") + print_var(${PACKAGE_NAME_IN}_TESTGROUP) + endif() - SET(PACKAGE_TESTGROUP_LOCAL ${PACKAGE_TESTGROUP_IN}) + set(PACKAGE_TESTGROUP_LOCAL ${PACKAGE_TESTGROUP_IN}) # ${PROJECT_NAME}_ELEVATE_ST_TO_PT is deprecated but allowed for backward compatibility - IF (${PROJECT_NAME}_ELEVATE_SS_TO_PS) - SET(${PROJECT_NAME}_ELEVATE_ST_TO_PT ON) - ENDIF() - - IF (${PACKAGE_TESTGROUP_IN} STREQUAL PT OR ${PACKAGE_TESTGROUP_IN} STREQUAL ST) - IF (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) - MESSAGE("-- " "PT or ST") - PRINT_VAR(${PROJECT_NAME}_ELEVATE_ST_TO_PT) - ENDIF() - IF (${PROJECT_NAME}_ELEVATE_ST_TO_PT) - SET(PACKAGE_TESTGROUP_LOCAL PT) - ENDIF() - IF (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) - PRINT_VAR(PACKAGE_TESTGROUP_LOCAL) - ENDIF() - SET(PACKAGE_ENABLE "") - ELSEIF (${PACKAGE_TESTGROUP_IN} STREQUAL EX) - IF (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) - MESSAGE("-- " "EX") - ENDIF() - SET(PACKAGE_ENABLE OFF) - ELSE() - MESSAGE(FATAL_ERROR "Error the package classification '${PACKAGE_TESTGROUP_IN}'" + if (${PROJECT_NAME}_ELEVATE_SS_TO_PS) + set(${PROJECT_NAME}_ELEVATE_ST_TO_PT ON) + endif() + + if (${PACKAGE_TESTGROUP_IN} STREQUAL PT OR ${PACKAGE_TESTGROUP_IN} STREQUAL ST) + if (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) + message("-- " "PT or ST") + print_var(${PROJECT_NAME}_ELEVATE_ST_TO_PT) + endif() + if (${PROJECT_NAME}_ELEVATE_ST_TO_PT) + set(PACKAGE_TESTGROUP_LOCAL PT) + endif() + if (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) + print_var(PACKAGE_TESTGROUP_LOCAL) + endif() + set(PACKAGE_ENABLE "") + elseif (${PACKAGE_TESTGROUP_IN} STREQUAL EX) + if (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) + message("-- " "EX") + endif() + set(PACKAGE_ENABLE OFF) + else() + message(FATAL_ERROR "Error the package classification '${PACKAGE_TESTGROUP_IN}'" " for the package ${PACKAGE_NAME_IN} is not a valid classification." ) - ENDIF() - - IF (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) - PRINT_VAR(PACKAGE_ENABLE) - PRINT_VAR(${PACKAGE_NAME_IN}_TESTGROUP) - ENDIF() - - IF ("${${PACKAGE_NAME_IN}_TESTGROUP}" STREQUAL "") # Allow testing override - IF (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) - MESSAGE("-- " "Setting classification to ${PACKAGE_TESTGROUP_LOCAL}") - PRINT_VAR(PACKAGE_TESTGROUP_LOCAL) - ENDIF() - SET(${PACKAGE_NAME_IN}_TESTGROUP "${PACKAGE_TESTGROUP_LOCAL}") - ENDIF() - - IF (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) - PRINT_VAR(${PACKAGE_NAME_IN}_TESTGROUP) - ENDIF() - - MULTILINE_SET(DOCSTR + endif() + + if (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) + print_var(PACKAGE_ENABLE) + print_var(${PACKAGE_NAME_IN}_TESTGROUP) + endif() + + if ("${${PACKAGE_NAME_IN}_TESTGROUP}" STREQUAL "") # Allow testing override + if (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) + message("-- " "Setting classification to ${PACKAGE_TESTGROUP_LOCAL}") + print_var(PACKAGE_TESTGROUP_LOCAL) + endif() + set(${PACKAGE_NAME_IN}_TESTGROUP "${PACKAGE_TESTGROUP_LOCAL}") + endif() + + if (TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS_DEBUG) + print_var(${PACKAGE_NAME_IN}_TESTGROUP) + endif() + + multiline_set(DOCSTR "Enable the package ${PACKAGE_NAME_IN}. Set to 'ON', 'OFF', or leave" " empty to allow for other logic to decide." ) - SET_CACHE_ON_OFF_EMPTY( ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME_IN} + set_cache_on_off_empty( ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME_IN} "${PACKAGE_ENABLE}" ${DOCSTR} ) -ENDMACRO() +endmacro() # Function that determines if a package is a primary meta-project package # according to the variables # ${PARENT_REPO_NAME}_NO_PRIMARY_META_PROJECT_PACKAGES[_EXCEPT]. # -FUNCTION(TRIBITS_IS_PRIMARY_META_PROJECT_PACKAGE PACKAGE_NAME_IN +function(tribits_is_primary_meta_project_package PACKAGE_NAME_IN IS_PRIMARY_META_PROJECT_PACKAGE_OUT ) - SET(IS_PRIMARY_META_PROJECT_PACKAGE TRUE) + set(IS_PRIMARY_META_PROJECT_PACKAGE TRUE) - ASSERT_DEFINED(${PACKAGE_NAME_IN}_PARENT_REPOSITORY) - SET(PARENT_REPO_NAME ${${PACKAGE_NAME_IN}_PARENT_REPOSITORY}) - IF (${PARENT_REPO_NAME}_NO_PRIMARY_META_PROJECT_PACKAGES) - FIND_LIST_ELEMENT( + assert_defined(${PACKAGE_NAME_IN}_PARENT_REPOSITORY) + set(PARENT_REPO_NAME ${${PACKAGE_NAME_IN}_PARENT_REPOSITORY}) + if (${PARENT_REPO_NAME}_NO_PRIMARY_META_PROJECT_PACKAGES) + find_list_element( ${PARENT_REPO_NAME}_NO_PRIMARY_META_PROJECT_PACKAGES_EXCEPT ${PACKAGE_NAME_IN} PACKAGE_EXCEPTED ) - IF (PACKAGE_EXCEPTED) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " + if (PACKAGE_EXCEPTED) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "NOTE: ${PACKAGE_NAME_IN} is classified as a primary meta-project packages even" " though ${PARENT_REPO_NAME}_NO_PRIMARY_META_PROJECT_PACKAGES=ON " " because the package is included in the list ${PARENT_REPO_NAME}_NO_PRIMARY_META_PROJECT_PACKAGES_EXCEPT!") - ENDIF() - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " + endif() + else() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "NOTE: ${PACKAGE_NAME_IN} is not as a primary meta-project packages" " because ${PARENT_REPO_NAME}_NO_PRIMARY_META_PROJECT_PACKAGES=ON " ) - ENDIF() - SET(IS_PRIMARY_META_PROJECT_PACKAGE FALSE) - ENDIF() - ENDIF() + endif() + set(IS_PRIMARY_META_PROJECT_PACKAGE FALSE) + endif() + endif() - SET(${IS_PRIMARY_META_PROJECT_PACKAGE_OUT} ${IS_PRIMARY_META_PROJECT_PACKAGE} + set(${IS_PRIMARY_META_PROJECT_PACKAGE_OUT} ${IS_PRIMARY_META_PROJECT_PACKAGE} PARENT_SCOPE ) -ENDFUNCTION() +endfunction() # Function that determines if it is okay to allow an implicit package enable # based on its classification. # -FUNCTION(TRIBITS_IMPLICIT_PACKAGE_ENABLE_IS_ALLOWED UPSTREAM_PACKAGE_NAME_IN +function(tribits_implicit_package_enable_is_allowed UPSTREAM_PACKAGE_NAME_IN PACKAGE_NAME_IN IMPLICIT_PACKAGE_ENABLE_ALLOWED_OUT ) - IF (${PACKAGE_NAME_IN}_TESTGROUP STREQUAL PT) - SET(IMPLICIT_PACKAGE_ENABLE_ALLOWED TRUE) - ELSEIF (${PACKAGE_NAME_IN}_TESTGROUP STREQUAL ST + if (${PACKAGE_NAME_IN}_TESTGROUP STREQUAL PT) + set(IMPLICIT_PACKAGE_ENABLE_ALLOWED TRUE) + elseif (${PACKAGE_NAME_IN}_TESTGROUP STREQUAL ST AND ${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE ) - SET(IMPLICIT_PACKAGE_ENABLE_ALLOWED TRUE) - ELSE() - IF (UPSTREAM_PACKAGE_NAME_IN) - MESSAGE("-- " "NOTE: Not Setting ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME_IN}=ON" + set(IMPLICIT_PACKAGE_ENABLE_ALLOWED TRUE) + else() + if (UPSTREAM_PACKAGE_NAME_IN) + message("-- " "NOTE: Not Setting ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME_IN}=ON" " even though ${UPSTREAM_PACKAGE_NAME_IN} has an optional dependence on" " ${PACKAGE_NAME_IN} because ${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE=OFF" ) - ENDIF() - SET(IMPLICIT_PACKAGE_ENABLE_ALLOWED FALSE) - ENDIF() + endif() + set(IMPLICIT_PACKAGE_ENABLE_ALLOWED FALSE) + endif() - SET(${IMPLICIT_PACKAGE_ENABLE_ALLOWED_OUT} ${IMPLICIT_PACKAGE_ENABLE_ALLOWED} + set(${IMPLICIT_PACKAGE_ENABLE_ALLOWED_OUT} ${IMPLICIT_PACKAGE_ENABLE_ALLOWED} PARENT_SCOPE ) -ENDFUNCTION() +endfunction() -# @MACRO: TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS() +# @MACRO: tribits_process_packages_and_dirs_lists() # # Usage:: # -# TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS() +# tribits_process_packages_and_dirs_lists() # # Macro that processes the list variable:: # # ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS # # from a `/PackagesList.cmake`_ file that just got read in and -# creates/updates the varaibles:: +# creates/updates the variables:: # # ${PROJECT_NAME}_PACKAGES # ${PROJECT_NAME}_NUM_PACKAGES @@ -381,26 +381,28 @@ ENDFUNCTION() # ${PROJECT_NAME}_REVERSE_PACKAGES # # For each of the listed top-level (parent) packages ${PACKAGE_NAME}, it also -# sets up constant variables like: +# sets up constant variables defined in `TriBITS Package Top-Level Local +# Variables`_ like: # # * `${PACKAGE_NAME}_SOURCE_DIR`_ # * `${PACKAGE_NAME}_REL_SOURCE_DIR`_ # * `${PACKAGE_NAME}_TESTGROUP`_ # -# and sets up some standard enable/diable vars with default values like: +# and sets up some standard enable/disable vars with default values as defined +# in `TriBITS Package Cache Variables`_ like:: # # ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME} # -# NOTE: Set TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE=TRUE to see really -# verbose debug ouptut from this macro. +# NOTE: Set ``TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE=TRUE`` to see +# really verbose debug output from this macro. # -# See `Function call tree for constructing package dependency graph`_ +# See `Function call tree for constructing package dependency graph`_. # -MACRO(TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS REPOSITORY_NAME REPOSITORY_DIR) +macro(tribits_process_packages_and_dirs_lists REPOSITORY_NAME REPOSITORY_DIR) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS: '${REPOSITORY_NAME}' '${REPOSITORY_DIR}'") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS: '${REPOSITORY_NAME}' '${REPOSITORY_DIR}'") + endif() # # Separate out separate lists of package names and directories @@ -408,210 +410,210 @@ MACRO(TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS REPOSITORY_NAME REPOSITORY_DIR) # Get the total number of packages defined - ASSERT_DEFINED(${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS) - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - PRINT_VAR(${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS) - ENDIF() - LIST(LENGTH ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS + assert_defined(${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS) + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + print_var(${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS) + endif() + list(LENGTH ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS ${REPOSITORY_NAME}_NUM_PACKAGES_AND_FIELDS ) - MATH(EXPR ${REPOSITORY_NAME}_NUM_PACKAGES + math(EXPR ${REPOSITORY_NAME}_NUM_PACKAGES "${${REPOSITORY_NAME}_NUM_PACKAGES_AND_FIELDS}/${PLH_NUM_FIELDS_PER_PACKAGE}") - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - PRINT_VAR(${REPOSITORY_NAME}_NUM_PACKAGES) - ENDIF() - MATH(EXPR ${REPOSITORY_NAME}_LAST_PACKAGE_IDX "${${REPOSITORY_NAME}_NUM_PACKAGES}-1") + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + print_var(${REPOSITORY_NAME}_NUM_PACKAGES) + endif() + math(EXPR ${REPOSITORY_NAME}_LAST_PACKAGE_IDX "${${REPOSITORY_NAME}_NUM_PACKAGES}-1") # Process each of the packages defined - IF (${REPOSITORY_NAME}_NUM_PACKAGES GREATER 0) + if (${REPOSITORY_NAME}_NUM_PACKAGES GREATER 0) - FOREACH(PACKAGE_IDX RANGE ${${REPOSITORY_NAME}_LAST_PACKAGE_IDX}) + foreach(PACKAGE_IDX RANGE ${${REPOSITORY_NAME}_LAST_PACKAGE_IDX}) - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - MESSAGE("") - PRINT_VAR(${PROJECT_NAME}_PACKAGES) - ENDIF() + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + message("") + print_var(${PROJECT_NAME}_PACKAGES) + endif() - MATH(EXPR PACKAGE_NAME_IDX "${PACKAGE_IDX}*${PLH_NUM_FIELDS_PER_PACKAGE}+0") - LIST(GET ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS + math(EXPR PACKAGE_NAME_IDX "${PACKAGE_IDX}*${PLH_NUM_FIELDS_PER_PACKAGE}+0") + list(GET ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS ${PACKAGE_NAME_IDX} TRIBITS_PACKAGE ) - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - PRINT_VAR(TRIBITS_PACKAGE) - ENDIF() + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + print_var(TRIBITS_PACKAGE) + endif() - MATH(EXPR PACKAGE_DIR_IDX + math(EXPR PACKAGE_DIR_IDX "${PACKAGE_IDX}*${PLH_NUM_FIELDS_PER_PACKAGE}+${PLH_NUM_PACKAGE_DIR_OFFSET}") - LIST(GET ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS + list(GET ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS ${PACKAGE_DIR_IDX} PACKAGE_DIR ) - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - PRINT_VAR(PACKAGE_DIR) - ENDIF() + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + print_var(PACKAGE_DIR) + endif() - MATH(EXPR PACKAGE_CLASSIFICATION_IDX + math(EXPR PACKAGE_CLASSIFICATION_IDX "${PACKAGE_IDX}*${PLH_NUM_FIELDS_PER_PACKAGE}+${PLH_NUM_PACKAGE_CLASSIFICATION_OFFSET}") - LIST(GET ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS + list(GET ${REPOSITORY_NAME}_PACKAGES_AND_DIRS_AND_CLASSIFICATIONS ${PACKAGE_CLASSIFICATION_IDX} PACKAGE_CLASSIFICATION ) - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - PRINT_VAR(PACKAGE_CLASSIFICATION) - ENDIF() + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + print_var(PACKAGE_CLASSIFICATION) + endif() # ToDo: Parse out TESTGROUP and MATURITYLEVEL (Trilinos #6042) - SET(PACKAGE_TESTGROUP ${PACKAGE_CLASSIFICATION}) + set(PACKAGE_TESTGROUP ${PACKAGE_CLASSIFICATION}) - TRIBITS_UPDATE_PS_PT_SS_ST(Package ${TRIBITS_PACKAGE} PACKAGE_TESTGROUP) + tribits_update_ps_pt_ss_st(Package ${TRIBITS_PACKAGE} PACKAGE_TESTGROUP) - IF (${TRIBITS_PACKAGE}_SOURCE_DIR_OVERRIDE) - MESSAGE("-- " + if (${TRIBITS_PACKAGE}_SOURCE_DIR_OVERRIDE) + message("-- " "NOTE: ${TRIBITS_PACKAGE}_SOURCE_DIR_OVERRIDE='${${TRIBITS_PACKAGE}_SOURCE_DIR_OVERRIDE}'" " is overriding default path '${PACKAGE_DIR}'") - SET(PACKAGE_DIR "${${TRIBITS_PACKAGE}_SOURCE_DIR_OVERRIDE}") - ENDIF() + set(PACKAGE_DIR "${${TRIBITS_PACKAGE}_SOURCE_DIR_OVERRIDE}") + endif() - IF (IS_ABSOLUTE "${PACKAGE_DIR}") + if (IS_ABSOLUTE "${PACKAGE_DIR}") - SET(PACKAGE_ABS_DIR "${PACKAGE_DIR}") + set(PACKAGE_ABS_DIR "${PACKAGE_DIR}") - STRING(LENGTH "${PROJECT_SOURCE_DIR}" PROJECT_SOURCE_DIR_LEN) - STRING(LENGTH "${PACKAGE_ABS_DIR}" PACKAGE_ABS_DIR_LEN) + string(LENGTH "${PROJECT_SOURCE_DIR}" PROJECT_SOURCE_DIR_LEN) + string(LENGTH "${PACKAGE_ABS_DIR}" PACKAGE_ABS_DIR_LEN) # See if the package dir is under the project dir - SET(PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR TRUE) + set(PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR TRUE) - IF (PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR) + if (PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR) # Determine package abs dir is too short to be under project - IF (PACKAGE_ABS_DIR_LEN LESS PROJECT_SOURCE_DIR_LEN) - SET(PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR FALSE) - ENDIF() - ENDIF() + if (PACKAGE_ABS_DIR_LEN LESS PROJECT_SOURCE_DIR_LEN) + set(PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR FALSE) + endif() + endif() - IF (PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR) + if (PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR) # Determine if the package abs base dir base is the project dir - STRING(SUBSTRING "${PACKAGE_ABS_DIR}" 0 ${PROJECT_SOURCE_DIR_LEN} + string(SUBSTRING "${PACKAGE_ABS_DIR}" 0 ${PROJECT_SOURCE_DIR_LEN} PROJECT_SOURCE_DIR_BASE_MATCH) - PRINT_VAR(PROJECT_SOURCE_DIR_BASE_MATCH) - IF (NOT PROJECT_SOURCE_DIR_BASE_MATCH STREQUAL "${PROJECT_SOURCE_DIR}") - SET(PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR FALSE) - ENDIF() - ENDIF() + print_var(PROJECT_SOURCE_DIR_BASE_MATCH) + if (NOT PROJECT_SOURCE_DIR_BASE_MATCH STREQUAL "${PROJECT_SOURCE_DIR}") + set(PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR FALSE) + endif() + endif() - IF (PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR) + if (PACKAGE_ABS_DIR_UNDER_PROJECT_SOURCE_DIR) # Get the path of the package dir under the project dir - MATH(EXPR PACKAGE_REL_DIR_BEGIN "${PROJECT_SOURCE_DIR_LEN}+1") - STRING(SUBSTRING "${PACKAGE_ABS_DIR}" ${PACKAGE_REL_DIR_BEGIN} -1 + math(EXPR PACKAGE_REL_DIR_BEGIN "${PROJECT_SOURCE_DIR_LEN}+1") + string(SUBSTRING "${PACKAGE_ABS_DIR}" ${PACKAGE_REL_DIR_BEGIN} -1 REPOSITORY_AND_PACKAGE_DIR) - ELSE() - MESSAGE_WRAPPER(FATAL_ERROR - "Error: The pacakge '${TRIBITS_PACKAGE}' was given an absolute directory '${PACKAGE_ABS_DIR}' which is *not* under the project's source directory '${PROJECT_SOURCE_DIR}/'!") - SET(REPOSITORY_AND_PACKAGE_DIR "ERROR-BAD-PACKAGE-ABS-DIR") - # ToDo: We could just put in a relative path but that requries + else() + message_wrapper(FATAL_ERROR + "Error: The package '${TRIBITS_PACKAGE}' was given an absolute directory '${PACKAGE_ABS_DIR}' which is *not* under the project's source directory '${PROJECT_SOURCE_DIR}/'!") + set(REPOSITORY_AND_PACKAGE_DIR "ERROR-BAD-PACKAGE-ABS-DIR") + # ToDo: We could just put in a relative path but that requires # knowing the common path between the two directory paths but CMake # does not give an easy way to determine that. I would have to # write that function myself. - ENDIF() + endif() - ELSE() + else() # PACKAGE_DIR is a relative path - IF ("${REPOSITORY_DIR}" STREQUAL ".") - SET(REPOSITORY_AND_PACKAGE_DIR "${PACKAGE_DIR}") - ELSEIF("${PACKAGE_DIR}" STREQUAL ".") - SET(REPOSITORY_AND_PACKAGE_DIR "${REPOSITORY_DIR}") - ELSE() - SET(REPOSITORY_AND_PACKAGE_DIR "${REPOSITORY_DIR}/${PACKAGE_DIR}") - ENDIF() - SET(PACKAGE_ABS_DIR "${PROJECT_SOURCE_DIR}/${REPOSITORY_AND_PACKAGE_DIR}") - - ENDIF() - - IF (EXISTS ${PACKAGE_ABS_DIR}) - SET(PACKAGE_EXISTS TRUE) - ELSE() - SET(PACKAGE_EXISTS FALSE) - ENDIF() - - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - PRINT_VAR(PROJECT_SOURCE_DIR) - PRINT_VAR(REPOSITORY_AND_PACKAGE_DIR) - PRINT_VAR(PACKAGE_ABS_DIR) - PRINT_VAR(PACKAGE_EXISTS) - PRINT_VAR(${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - PRINT_VAR(${TRIBITS_PACKAGE}_ALLOW_MISSING_EXTERNAL_PACKAGE) - ENDIF() - - IF (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES + if ("${REPOSITORY_DIR}" STREQUAL ".") + set(REPOSITORY_AND_PACKAGE_DIR "${PACKAGE_DIR}") + elseif("${PACKAGE_DIR}" STREQUAL ".") + set(REPOSITORY_AND_PACKAGE_DIR "${REPOSITORY_DIR}") + else() + set(REPOSITORY_AND_PACKAGE_DIR "${REPOSITORY_DIR}/${PACKAGE_DIR}") + endif() + set(PACKAGE_ABS_DIR "${PROJECT_SOURCE_DIR}/${REPOSITORY_AND_PACKAGE_DIR}") + + endif() + + if (EXISTS ${PACKAGE_ABS_DIR}) + set(PACKAGE_EXISTS TRUE) + else() + set(PACKAGE_EXISTS FALSE) + endif() + + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + print_var(PROJECT_SOURCE_DIR) + print_var(REPOSITORY_AND_PACKAGE_DIR) + print_var(PACKAGE_ABS_DIR) + print_var(PACKAGE_EXISTS) + print_var(${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + print_var(${TRIBITS_PACKAGE}_ALLOW_MISSING_EXTERNAL_PACKAGE) + endif() + + if (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES AND NOT PACKAGE_EXISTS AND NOT ${TRIBITS_PACKAGE}_ALLOW_MISSING_EXTERNAL_PACKAGE ) - MESSAGE( + message( "\n***" "\n*** Error, the package ${TRIBITS_PACKAGE} directory ${PACKAGE_ABS_DIR} does not exist!" "\n***\n" ) - MESSAGE(FATAL_ERROR "Stopping due to above error!") - ENDIF() + message(FATAL_ERROR "Stopping due to above error!") + endif() - IF (PACKAGE_EXISTS OR ${PROJECT_NAME}_IGNORE_PACKAGE_EXISTS_CHECK) - LIST(APPEND ${PROJECT_NAME}_PACKAGES ${TRIBITS_PACKAGE}) - TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS(${TRIBITS_PACKAGE} + if (PACKAGE_EXISTS OR ${PROJECT_NAME}_IGNORE_PACKAGE_EXISTS_CHECK) + list(APPEND ${PROJECT_NAME}_PACKAGES ${TRIBITS_PACKAGE}) + tribits_insert_standard_package_options(${TRIBITS_PACKAGE} ${PACKAGE_TESTGROUP}) - SET(${TRIBITS_PACKAGE}_SOURCE_DIR + set(${TRIBITS_PACKAGE}_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${REPOSITORY_AND_PACKAGE_DIR}") - SET(${TRIBITS_PACKAGE}_REL_SOURCE_DIR + set(${TRIBITS_PACKAGE}_REL_SOURCE_DIR "${REPOSITORY_AND_PACKAGE_DIR}") - SET(${TRIBITS_PACKAGE}_PARENT_PACKAGE "") - SET(${TRIBITS_PACKAGE}_PARENT_REPOSITORY ${REPOSITORY_NAME}) - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE( + set(${TRIBITS_PACKAGE}_PARENT_PACKAGE "") + set(${TRIBITS_PACKAGE}_PARENT_REPOSITORY ${REPOSITORY_NAME}) + else() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message( "\n***" "\n*** NOTE: Excluding package ${TRIBITS_PACKAGE} because ${PACKAGE_ABS_DIR}" " does not exist!" "\n***\n" ) - ENDIF() - ENDIF() + endif() + endif() # NOTE: The variable ${PROJECT_NAME}_IGNORE_PACKAGE_EXISTS_CHECK only # gets set to TRUE for some unit tests. Otherwise, in every legitimate # usage of this macro it is always FALSE. - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - PRINT_VAR(${TRIBITS_PACKAGE}_SOURCE_DIR) - PRINT_VAR(${TRIBITS_PACKAGE}_PARENT_PACKAGE) - PRINT_VAR(${TRIBITS_PACKAGE}_PARENT_REPOSITORY) - ENDIF() + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + print_var(${TRIBITS_PACKAGE}_SOURCE_DIR) + print_var(${TRIBITS_PACKAGE}_PARENT_PACKAGE) + print_var(${TRIBITS_PACKAGE}_PARENT_REPOSITORY) + endif() - IF (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) - PRINT_VAR(${PROJECT_NAME}_PACKAGES) - ENDIF() + if (TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS_VERBOSE) + print_var(${PROJECT_NAME}_PACKAGES) + endif() - ENDFOREACH() + endforeach() # Get the actual number of packages that actually exist - LIST(LENGTH ${PROJECT_NAME}_PACKAGES ${PROJECT_NAME}_NUM_PACKAGES ) - MATH(EXPR ${PROJECT_NAME}_LAST_PACKAGE_IDX "${${PROJECT_NAME}_NUM_PACKAGES}-1") + list(LENGTH ${PROJECT_NAME}_PACKAGES ${PROJECT_NAME}_NUM_PACKAGES ) + math(EXPR ${PROJECT_NAME}_LAST_PACKAGE_IDX "${${PROJECT_NAME}_NUM_PACKAGES}-1") # Create a reverse list for later use - SET(${PROJECT_NAME}_REVERSE_PACKAGES ${${PROJECT_NAME}_PACKAGES}) - LIST(REVERSE ${PROJECT_NAME}_REVERSE_PACKAGES) + set(${PROJECT_NAME}_REVERSE_PACKAGES ${${PROJECT_NAME}_PACKAGES}) + list(REVERSE ${PROJECT_NAME}_REVERSE_PACKAGES) - ELSE() + else() - SET(${REPOSITORY_NAME}_NUM_PACKAGES 0) + set(${REPOSITORY_NAME}_NUM_PACKAGES 0) - ENDIF() + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${REPOSITORY_NAME}_NUM_PACKAGES) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${REPOSITORY_NAME}_NUM_PACKAGES) + endif() - PRINT_VAR(${PROJECT_NAME}_NUM_PACKAGES) + print_var(${PROJECT_NAME}_NUM_PACKAGES) # Print the final set of packages in debug mode - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PROJECT_NAME}_PACKAGES) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${PROJECT_NAME}_PACKAGES) + endif() -ENDMACRO() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake b/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake index 4b087e97f668..4009ac400928 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake @@ -38,14 +38,14 @@ # @HEADER -INCLUDE(TribitsConstants) -INCLUDE(TribitsListHelpers) +include(TribitsConstants) +include(TribitsListHelpers) -INCLUDE(PrintVar) -INCLUDE(Split) +include(PrintVar) +include(Split) # -# @MACRO: TRIBITS_REPOSITORY_DEFINE_TPLS() +# @MACRO: tribits_repository_define_tpls() # # Define the list of `TriBITS TPLs`_ for a given `TriBITS Repository`_ which # includes the TPL name, find module, and classification . This macro is @@ -54,7 +54,7 @@ INCLUDE(Split) # # Usage:: # -# TRIBITS_REPOSITORY_DEFINE_TPLS( +# tribits_repository_define_tpls( # # # ... @@ -80,7 +80,7 @@ INCLUDE(Split) # find module will be assumed to be under that this directory with the # standard name (e.g. ``cmake/tpls/FindTPL.cmake``). A standard # way to write a ``FindTPL.cmake`` module is to use the function -# `TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES()`_. +# `tribits_tpl_find_include_dirs_and_libraries()`_. # # 2. **CLASSIFICATION** (````): Gives the `SE Package Test # Group`_ `PT`_, `ST`_, or `EX`_ and the maturity level ``EP``, ``RS``, @@ -115,13 +115,13 @@ INCLUDE(Split) # ``${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS``. If one misspells # the name of a macro, it is an immediate error in CMake. # -MACRO(TRIBITS_REPOSITORY_DEFINE_TPLS) - ASSERT_DEFINED(REPOSITORY_NAME) - SET(${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS "${ARGN}") -ENDMACRO() +macro(tribits_repository_define_tpls) + assert_defined(REPOSITORY_NAME) + set(${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS "${ARGN}") +endmacro() -# @MACRO: TRIBITS_PROCESS_TPLS_LISTS() +# @MACRO: tribits_process_tpls_lists() # # This macro that processes the project-level variable:: # @@ -140,167 +140,167 @@ ENDMACRO() # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_PROCESS_TPLS_LISTS REPOSITORY_NAME REPOSITORY_DIR) +macro(tribits_process_tpls_lists REPOSITORY_NAME REPOSITORY_DIR) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("TRIBITS_PROCESS_TPLS_LISTS: '${REPOSITORY_NAME}' '${REPOSITORY_DIR}'") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("TRIBITS_PROCESS_TPLS_LISTS: '${REPOSITORY_NAME}' '${REPOSITORY_DIR}'") + endif() - #SET(TRIBITS_PROCESS_TPLS_LISTS_DEBUG ON) - SET(TRIBITS_PROCESS_TPLS_LISTS_DEBUG OFF) + #set(TRIBITS_PROCESS_TPLS_LISTS_DEBUG ON) + set(TRIBITS_PROCESS_TPLS_LISTS_DEBUG OFF) - SET(TPL_NAME_OFFSET 0) - SET(TPL_FINDMOD_OFFSET 1) - SET(TPL_CLASSIFICATION_OFFSET 2) - SET(TPL_NUM_COLUMNS 3) + set(TPL_NAME_OFFSET 0) + set(TPL_FINDMOD_OFFSET 1) + set(TPL_CLASSIFICATION_OFFSET 2) + set(TPL_NUM_COLUMNS 3) - LIST(LENGTH ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS + list(LENGTH ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS ${REPOSITORY_NAME}_CURR_NUM_TPLS_FULL) - MATH(EXPR ${REPOSITORY_NAME}_CURR_NUM_TPLS + math(EXPR ${REPOSITORY_NAME}_CURR_NUM_TPLS "${${REPOSITORY_NAME}_CURR_NUM_TPLS_FULL}/${TPL_NUM_COLUMNS}") - IF (${REPOSITORY_NAME}_CURR_NUM_TPLS GREATER 0) + if (${REPOSITORY_NAME}_CURR_NUM_TPLS GREATER 0) - MATH(EXPR ${REPOSITORY_NAME}_LAST_TPL_IDX + math(EXPR ${REPOSITORY_NAME}_LAST_TPL_IDX "${${REPOSITORY_NAME}_CURR_NUM_TPLS}-1") - FOREACH(TPL_IDX RANGE ${${REPOSITORY_NAME}_LAST_TPL_IDX}) + foreach(TPL_IDX RANGE ${${REPOSITORY_NAME}_LAST_TPL_IDX}) - IF (TRIBITS_PROCESS_TPLS_LISTS_DEBUG) - PRINT_VAR(TPL_IDX) - ENDIF() + if (TRIBITS_PROCESS_TPLS_LISTS_DEBUG) + print_var(TPL_IDX) + endif() # Get fields for this TPL - MATH(EXPR TPL_NAME_IDX + math(EXPR TPL_NAME_IDX "${TPL_IDX}*${TPL_NUM_COLUMNS}+${TPL_NAME_OFFSET}") - LIST(GET ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS ${TPL_NAME_IDX} + list(GET ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS ${TPL_NAME_IDX} TPL_NAME) - IF (TRIBITS_PROCESS_TPLS_LISTS_DEBUG) - PRINT_VAR(TPL_NAME) - ENDIF() + if (TRIBITS_PROCESS_TPLS_LISTS_DEBUG) + print_var(TPL_NAME) + endif() - MATH(EXPR TPL_FINDMOD_IDX + math(EXPR TPL_FINDMOD_IDX "${TPL_IDX}*${TPL_NUM_COLUMNS}+${TPL_FINDMOD_OFFSET}") - LIST(GET ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS ${TPL_FINDMOD_IDX} + list(GET ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS ${TPL_FINDMOD_IDX} TPL_FINDMOD) - IF (TRIBITS_PROCESS_TPLS_LISTS_DEBUG) - PRINT_VAR(TPL_FINDMOD) - ENDIF() + if (TRIBITS_PROCESS_TPLS_LISTS_DEBUG) + print_var(TPL_FINDMOD) + endif() - MATH(EXPR TPL_CLASSIFICATION_IDX + math(EXPR TPL_CLASSIFICATION_IDX "${TPL_IDX}*${TPL_NUM_COLUMNS}+${TPL_CLASSIFICATION_OFFSET}") - LIST(GET ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS ${TPL_CLASSIFICATION_IDX} + list(GET ${REPOSITORY_NAME}_TPLS_FINDMODS_CLASSIFICATIONS ${TPL_CLASSIFICATION_IDX} TPL_CLASSIFICATION) - IF (TRIBITS_PROCESS_TPLS_LISTS_DEBUG) - PRINT_VAR(TPL_CLASSIFICATION) - ENDIF() + if (TRIBITS_PROCESS_TPLS_LISTS_DEBUG) + print_var(TPL_CLASSIFICATION) + endif() # ToDo: Parse out TESTGROUP and MATURITYLEVEL (Trilinos #6042) - SET(TPL_TESTGROUP ${TPL_CLASSIFICATION}) + set(TPL_TESTGROUP ${TPL_CLASSIFICATION}) - TRIBITS_UPDATE_PS_PT_SS_ST(TPL ${TPL_NAME} TPL_TESTGROUP) + tribits_update_ps_pt_ss_st(TPL ${TPL_NAME} TPL_TESTGROUP) # Update TPLS list (unless the TPL already exists) - IF (${TPL_NAME}_FINDMOD) + if (${TPL_NAME}_FINDMOD) # If the variable ${TPL_NAME}_FINDMOD already exists, then this TPL # has already been defined in a previous repository. In this case, we # will just leave the TPL in its current position. - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " "NOTE: The TPL ${TPL_NAME} has already been defined so leaving it" + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "NOTE: The TPL ${TPL_NAME} has already been defined so leaving it" " in the same location and not adding it again!") - ENDIF() - ELSE() - LIST(APPEND ${PROJECT_NAME}_TPLS ${TPL_NAME}) - ENDIF() + endif() + else() + list(APPEND ${PROJECT_NAME}_TPLS ${TPL_NAME}) + endif() # Set ${TPL_NAME}_TESTGROUP - IF (TPL_TESTGROUP STREQUAL PT + if (TPL_TESTGROUP STREQUAL PT OR TPL_TESTGROUP STREQUAL ST OR TPL_TESTGROUP STREQUAL TT OR TPL_TESTGROUP STREQUAL EX ) - ELSE() - MESSAGE(FATAL_ERROR "Error the TPL classification '${TPL_TESTGROUP}'" + else() + message(FATAL_ERROR "Error the TPL classification '${TPL_TESTGROUP}'" " for the TPL ${TPL_NAME} is not a valid classification." ) - ENDIF() + endif() - IF (NOT ${TPL_NAME}_TESTGROUP) # Allow for testing override - SET(${TPL_NAME}_TESTGROUP ${TPL_TESTGROUP}) - ENDIF() + if (NOT ${TPL_NAME}_TESTGROUP) # Allow for testing override + set(${TPL_NAME}_TESTGROUP ${TPL_TESTGROUP}) + endif() # Set ${TPL_NAME}_FINDMOD - #PRINT_VAR(REPOSITORY_DIR) - - IF ("${REPOSITORY_DIR}" STREQUAL "." OR IS_ABSOLUTE ${TPL_FINDMOD}) - SET(REPOSITORY_DIR_AND_SEP "") - ELSE() - SET(REPOSITORY_DIR_AND_SEP "${REPOSITORY_DIR}/") - ENDIF() - #PRINT_VAR(REPOSITORY_DIR_AND_SEP) - - SET(TPL_FINDMOD "${REPOSITORY_DIR_AND_SEP}${TPL_FINDMOD}") - #PRINT_VAR(TPL_FINDMOD) - - SET(TPL_FINDMOD_STD_NAME "FindTPL${TPL_NAME}.cmake") - - IF (TPL_FINDMOD) - STRING(REGEX MATCH ".+/$" FINDMOD_IS_DIR "${TPL_FINDMOD}") - #PRINT_VAR(FINDMOD_IS_DIR) - IF (FINDMOD_IS_DIR) - SET(${TPL_NAME}_FINDMOD "${TPL_FINDMOD}${TPL_FINDMOD_STD_NAME}") - ELSE() - SET(${TPL_NAME}_FINDMOD ${TPL_FINDMOD}) - ENDIF() - ELSE() - SET(${TPL_NAME}_FINDMOD ${TPL_FINDMOD_STD_NAME}) - ENDIF() - - ASSERT_DEFINED(${REPOSITORY_NAME}_TPLS_FILE) - SET(${TPL_NAME}_TPLS_LIST_FILE ${${REPOSITORY_NAME}_TPLS_FILE}) - - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${TPL_NAME}_FINDMOD) - PRINT_VAR(${TPL_NAME}_TESTGROUP) - PRINT_VAR(${TPL_NAME}_TPLS_LIST_FILE) - ENDIF() + #print_var(REPOSITORY_DIR) + + if ("${REPOSITORY_DIR}" STREQUAL "." OR IS_ABSOLUTE ${TPL_FINDMOD}) + set(REPOSITORY_DIR_AND_SEP "") + else() + set(REPOSITORY_DIR_AND_SEP "${REPOSITORY_DIR}/") + endif() + #print_var(REPOSITORY_DIR_AND_SEP) + + set(TPL_FINDMOD "${REPOSITORY_DIR_AND_SEP}${TPL_FINDMOD}") + #print_var(TPL_FINDMOD) + + set(TPL_FINDMOD_STD_NAME "FindTPL${TPL_NAME}.cmake") + + if (TPL_FINDMOD) + string(REGEX MATCH ".+/$" FINDMOD_IS_DIR "${TPL_FINDMOD}") + #print_var(FINDMOD_IS_DIR) + if (FINDMOD_IS_DIR) + set(${TPL_NAME}_FINDMOD "${TPL_FINDMOD}${TPL_FINDMOD_STD_NAME}") + else() + set(${TPL_NAME}_FINDMOD ${TPL_FINDMOD}) + endif() + else() + set(${TPL_NAME}_FINDMOD ${TPL_FINDMOD_STD_NAME}) + endif() + + assert_defined(${REPOSITORY_NAME}_TPLS_FILE) + set(${TPL_NAME}_TPLS_LIST_FILE ${${REPOSITORY_NAME}_TPLS_FILE}) + + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${TPL_NAME}_FINDMOD) + print_var(${TPL_NAME}_TESTGROUP) + print_var(${TPL_NAME}_TPLS_LIST_FILE) + endif() # Set the enable cache variable for ${TPL_NAME} - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "Enable support for the TPL ${TPL_NAME} in all supported ${PROJECT_NAME} packages." " This can be set to 'ON', 'OFF', or left empty ''." ) - SET_CACHE_ON_OFF_EMPTY( TPL_ENABLE_${TPL_NAME} "" ${DOCSTR} ) + set_cache_on_off_empty( TPL_ENABLE_${TPL_NAME} "" ${DOCSTR} ) # 2008/11/25: rabartl: Above, we use the prefix TPL_ instead of # ${PROJECT_NAME}_ in order to make it clear that external TPLs are # different from packages so users don't get confused and # think that the project actually includes some TPL when it does not! - ENDFOREACH() + endforeach() - ENDIF() + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PROJECT_NAME}_TPLS) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${PROJECT_NAME}_TPLS) + endif() # Get the final length - LIST(LENGTH ${PROJECT_NAME}_TPLS ${PROJECT_NAME}_NUM_TPLS) - PRINT_VAR(${PROJECT_NAME}_NUM_TPLS) + list(LENGTH ${PROJECT_NAME}_TPLS ${PROJECT_NAME}_NUM_TPLS) + print_var(${PROJECT_NAME}_NUM_TPLS) # Create a reverse list for later use - IF (${PROJECT_NAME}_TPLS) - SET(${PROJECT_NAME}_REVERSE_TPLS ${${PROJECT_NAME}_TPLS}) - LIST(REVERSE ${PROJECT_NAME}_REVERSE_TPLS) - ELSE() - SET(${PROJECT_NAME}_REVERSE_TPLS) - ENDIF() + if (${PROJECT_NAME}_TPLS) + set(${PROJECT_NAME}_REVERSE_TPLS ${${PROJECT_NAME}_TPLS}) + list(REVERSE ${PROJECT_NAME}_REVERSE_TPLS) + else() + set(${PROJECT_NAME}_REVERSE_TPLS) + endif() -ENDMACRO() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsProject.cmake b/cmake/tribits/core/package_arch/TribitsProject.cmake index b83d59cb77d0..c1e3837aa639 100644 --- a/cmake/tribits/core/package_arch/TribitsProject.cmake +++ b/cmake/tribits/core/package_arch/TribitsProject.cmake @@ -39,46 +39,46 @@ # Projects that change the location of the source need to consider this in # their top-level CMakeLists.txt file -SET(${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tribits" +set(${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tribits" CACHE PATH "The base directory pointing to the TriBITS system. If provided as a relative path (formatted as STRING) then will be set to '${CMAKE_CURRENT_SOURCE_DIR}/'. NOTE: If you leave off the STRING datatype, and it is a relative path, then it will be interpreted as relative to the build directory!" ) -MARK_AS_ADVANCED(${PROJECT_NAME}_TRIBITS_DIR) +mark_as_advanced(${PROJECT_NAME}_TRIBITS_DIR) -IF (NOT IS_ABSOLUTE "${${PROJECT_NAME}_TRIBITS_DIR}") - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("NOTE: ${PROJECT_NAME}_TRIBITS_DIR = '${${PROJECT_NAME}_TRIBITS_DIR}' provided as a relative directory so making this relative to '${CMAKE_CURRENT_SOURCE_DIR}'!") - ENDIF() - SET(${PROJECT_NAME}_TRIBITS_DIR +if (NOT IS_ABSOLUTE "${${PROJECT_NAME}_TRIBITS_DIR}") + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("NOTE: ${PROJECT_NAME}_TRIBITS_DIR = '${${PROJECT_NAME}_TRIBITS_DIR}' provided as a relative directory so making this relative to '${CMAKE_CURRENT_SOURCE_DIR}'!") + endif() + set(${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${${PROJECT_NAME}_TRIBITS_DIR}") -ENDIF() +endif() -IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("${PROJECT_NAME}_TRIBITS_DIR='${${PROJECT_NAME}_TRIBITS_DIR}'") -ENDIF() +if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("${PROJECT_NAME}_TRIBITS_DIR='${${PROJECT_NAME}_TRIBITS_DIR}'") +endif() -SET(CMAKE_MODULE_PATH +set(CMAKE_MODULE_PATH ${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch ) -IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}'") -ENDIF() +if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}'") +endif() # Overrides that we have for CMake functions -INCLUDE(TribitsCMakePolicies) -INCLUDE(TribitsProjectImpl) +include(TribitsCMakePolicies) +include(TribitsProjectImpl) # -# @MACRO: TRIBITS_PROJECT() +# @MACRO: tribits_project() # # Processes a `TriBITS Project`_'s files and configures its software which is # called from the project's top-level `/CMakeLists.txt`_ file. # # Usage:: # -# TRIBITS_PROJECT() +# tribits_project() # # This macro requires that the variable `PROJECT_NAME`_ be defined before # calling this macro. All default values for project settings should be set @@ -89,11 +89,11 @@ INCLUDE(TribitsProjectImpl) # then performs all processing of the TriBITS project files (see `Full TriBITS # Project Configuration`_). # -MACRO(TRIBITS_PROJECT) - TRIBITS_PROJECT_IMPL(${ARGN}) -ENDMACRO() +macro(tribits_project) + tribits_project_impl(${ARGN}) +endmacro() # Note, this is just a shell of a macro that calls the real implementation -# TRIBITS_PROJECT_IMPL(). This allows someone to set +# tribits_project_impl(). This allows someone to set # ${PROJECT_NAME}_TRIBITS_DIR in the env and point to a different Tribits # implementation to test before snapshoting. diff --git a/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake b/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake index eadc0c81253d..62ff4e883e0f 100644 --- a/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake +++ b/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake @@ -43,7 +43,7 @@ # tribits implementation to use in {PROJECT_NAME}_TRIBITS_DIR. # -SET(CMAKE_MODULE_PATH +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${${PROJECT_NAME}_TRIBITS_DIR}/core/utils @@ -53,57 +53,57 @@ SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_TRIBITS_DIR}/core/installation ) -IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}'") -ENDIF() +if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}'") +endif() -INCLUDE(TribitsConstants) -TRIBITS_ASESRT_MINIMUM_CMAKE_VERSION() -INCLUDE(TribitsCMakePolicies) +include(TribitsConstants) +tribits_asesrt_minimum_cmake_version() +include(TribitsCMakePolicies) -INCLUDE(TribitsIncludeDirectories) -INCLUDE(TribitsFindPythonInterp) -INCLUDE(TribitsGlobalMacros) -INCLUDE(TribitsConfigureCTestCustom) -INCLUDE(TribitsGenerateResourceSpecFile) -INCLUDE(TribitsPrintDependencyInfo) +include(TribitsIncludeDirectories) +include(TribitsFindPythonInterp) +include(TribitsGlobalMacros) +include(TribitsConfigureCTestCustom) +include(TribitsGenerateResourceSpecFile) +include(TribitsPrintDependencyInfo) -INCLUDE(AdvancedSet) -INCLUDE(AdvancedOption) -INCLUDE(TimingUtils) -INCLUDE(SetDefault) +include(AdvancedSet) +include(AdvancedOption) +include(TimingUtils) +include(SetDefault) # # Defines a TriBITS project (the guts). # -MACRO(TRIBITS_PROJECT_IMPL) +macro(tribits_project_impl) # # A) Basic top-level TriBITS project stuff # - MESSAGE("") - MESSAGE("Configuring ${PROJECT_NAME} build directory") - MESSAGE("") + message("") + message("Configuring ${PROJECT_NAME} build directory") + message("") # A.1) Set some basic system vars and info you can't change - TRIBITS_ASSERT_AND_SETUP_PROJECT_AND_STATIC_SYSTEM_VARS() + tribits_assert_and_setup_project_and_static_system_vars() # A.2) Read user provided options from specified files. It is important to # process these files *very* early on so that they have the same basic # effect of setting these variables directly in the cache. - TRIBITS_READ_IN_OPTIONS_FROM_FILE() + tribits_read_in_options_from_file() # A.3) Get some other basic system info that is useful early on in # configuration - TRIBITS_SETUP_BASIC_SYSTEM_VARS() - TRIBITS_FIND_PYTHON_INTERP() - FIND_PACKAGE(Git) - IF (NOT "${GIT_VERSION_STRING_OVERRIDE}" STREQUAL "") - SET(GIT_VERSION_STRING ${GIT_VERSION_STRING_OVERRIDE}) # For testing! - ENDIF() + tribits_setup_basic_system_vars() + tribits_find_python_interp() + find_package(Git) + if (NOT "${GIT_VERSION_STRING_OVERRIDE}" STREQUAL "") + set(GIT_VERSION_STRING ${GIT_VERSION_STRING_OVERRIDE}) # For testing! + endif() # # A.4) Read in the Project's version file @@ -112,103 +112,103 @@ MACRO(TRIBITS_PROJECT_IMPL) # read because the variables defined in Version.cmake provide defaults for # many of these options. # - TRIBITS_PROJECT_READ_VERSION_FILE(${PROJECT_SOURCE_DIR}) + tribits_project_read_version_file(${PROJECT_SOURCE_DIR}) # Since the version header file is now configured the root build # dir needs to be on the include path - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) # # B) Set up user options and global variables that will be used throughout # - MESSAGE("") - MESSAGE("Setting up major user options ...") - MESSAGE("") + message("") + message("Setting up major user options ...") + message("") - TRIBITS_DEFINE_GLOBAL_OPTIONS_AND_DEFINE_EXTRA_REPOS() + tribits_define_global_options_and_define_extra_repos() # Have to start timing after we read in the major options since that # determines the timing option var. - TRIBITS_CONFIG_CODE_START_TIMER(GLOBAL_TIME_START_SECONDS) + tribits_config_code_start_timer(GLOBAL_TIME_START_SECONDS) - TRIBITS_READ_IN_NATIVE_REPOSITORIES() + tribits_read_in_native_repositories() - TRIBITS_COMBINE_NATIVE_AND_EXTRA_REPOS() + tribits_combine_native_and_extra_repos() - TRIBITS_PROCESS_EXTRA_REPOS_OPTIONS_FILES() + tribits_process_extra_repos_options_files() - INCLUDE(TribitsInstallationTestingMacros) - TRIBITS_FIND_PROJECT_INSTALL() + include(TribitsInstallationTestingMacros) + tribits_find_project_install() # # C) Generate version info file and read in ${PROJECT_NAME} packages and # TPLs and process dependencies # - TRIBITS_GENERATE_REPO_VERSION_OUTPUT_AND_FILE_AND_INSTALL() + tribits_generate_repo_version_output_and_file_and_install() # Read in and process all of the project's package, TPL, listss and # dependency definition files. - TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() - TRIBITS_PRINT_INITIAL_DEPENDENCY_INFO() - TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED() + tribits_read_all_project_deps_files_create_deps_graph() + tribits_print_initial_dependency_info() + tribits_write_xml_dependency_files_if_supported() # # D) Apply dependency logic to enable and disable TriBITS packages and tests # - TRIBITS_ADJUST_AND_PRINT_PACKAGE_DEPENDENCIES() + tribits_adjust_and_print_package_dependencies() # # E) Stop after all dependencies handling is finished if asked # - IF (${PROJECT_NAME}_SHORTCIRCUIT_AFTER_DEPENDENCY_HANDLING) - MESSAGE("") - MESSAGE("Shortcircuiting after dependency tracking ...") - RETURN() - ENDIF() + if (${PROJECT_NAME}_SHORTCIRCUIT_AFTER_DEPENDENCY_HANDLING) + message("") + message("Shortcircuiting after dependency tracking ...") + return() + endif() # # F) Set up the environment on this computer # - MESSAGE("") - MESSAGE("Probing the environment ...") - MESSAGE("") + message("") + message("Probing the environment ...") + message("") - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - TRIBITS_SETUP_ENV() - ELSE() - MESSAGE("-- Skipping env setup due to" + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + tribits_setup_env() + else() + message("-- Skipping env setup due to" " ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY=ON") - ENDIF() + endif() # # G) Go get the information for all enabled TPLS # - MESSAGE("") - MESSAGE("Getting information for all enabled TPLs ...") - MESSAGE("") + message("") + message("Getting information for all enabled TPLs ...") + message("") - TRIBITS_PROCESS_ENABLED_TPLS() + tribits_process_enabled_tpls() # # H) Set up for testing with CTest and ${PROJECT_NAME} test harness # - MESSAGE("") - MESSAGE("Setting up testing support ...") - MESSAGE("") + message("") + message("Setting up testing support ...") + message("") - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - TRIBITS_INCLUDE_CTEST_SUPPORT() - ELSE() - MESSAGE("-- Skipping testing support setup due to" + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + tribits_include_ctest_support() + else() + message("-- Skipping testing support setup due to" " ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY=ON") - ENDIF() + endif() # # I) Add the 'dashboard' target @@ -216,130 +216,130 @@ MACRO(TRIBITS_PROJECT_IMPL) # NOTE: Must come after setting up for testing # - SET(TRIBITS_ADD_DASHBOARD_TARGET_MODULE + set(TRIBITS_ADD_DASHBOARD_TARGET_MODULE ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CTEST_DRIVER_DIR}/TribitsAddDashboardTarget.cmake ) - IF ( + if ( EXISTS ${TRIBITS_ADD_DASHBOARD_TARGET_MODULE} AND NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY ) - INCLUDE(${TRIBITS_ADD_DASHBOARD_TARGET_MODULE}) - TRIBITS_ADD_DASHBOARD_TARGET() - ENDIF() + include(${TRIBITS_ADD_DASHBOARD_TARGET_MODULE}) + tribits_add_dashboard_target() + endif() # # J) Configure individual packages # - MESSAGE("") - MESSAGE("Configuring individual enabled ${PROJECT_NAME} packages ...") - MESSAGE("") + message("") + message("Configuring individual enabled ${PROJECT_NAME} packages ...") + message("") - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - TRIBITS_REPOSITORY_CONFIGURE_ALL_VERSION_HEADER_FILES( + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + tribits_repository_configure_all_version_header_files( ${${PROJECT_NAME}_ALL_REPOSITORIES}) - TRIBITS_REPOSITORY_CONFIGURE_ALL_VERSION_DATE_FILES( + tribits_repository_configure_all_version_date_files( ${${PROJECT_NAME}_ALL_REPOSITORIES}) - ENDIF() + endif() - TRIBITS_CONFIGURE_ENABLED_PACKAGES() + tribits_configure_enabled_packages() # # K) Write dummy makefiles for Ninja # - IF (CMAKE_GENERATOR STREQUAL "Ninja") + if (CMAKE_GENERATOR STREQUAL "Ninja") - IF (${PROJECT_NAME}_WRITE_NINJA_MAKEFILES) + if (${PROJECT_NAME}_WRITE_NINJA_MAKEFILES) - MESSAGE("") - MESSAGE("Generating dummy makefiles in each directory to call Ninja ...") - MESSAGE("") + message("") + message("Generating dummy makefiles in each directory to call Ninja ...") + message("") - TRIBITS_CONFIG_CODE_START_TIMER(NINJA_MAKEFILES_TIME_START_SECONDS) + tribits_config_code_start_timer(NINJA_MAKEFILES_TIME_START_SECONDS) - INCLUDE(GenerateNinjaMakefiles) - GENERATE_NINJA_MAKEFILES(${CMAKE_SOURCE_DIR}) + include(GenerateNinjaMakefiles) + generate_ninja_makefiles(${CMAKE_SOURCE_DIR}) - TRIBITS_CONFIG_CODE_STOP_TIMER(NINJA_MAKEFILES_TIME_START_SECONDS + tribits_config_code_stop_timer(NINJA_MAKEFILES_TIME_START_SECONDS "Total time generate Ninja makefiles ${PROJECT_NAME}") - ELSE() + else() - MESSAGE("\nNOTE: *NOT* generating dummy Ninja makefiles (see above note" + message("\nNOTE: *NOT* generating dummy Ninja makefiles (see above note" " and check CMake version)") - ENDIF() + endif() - ENDIF() + endif() # # L) Setup for packaging and distribution # - IF (${PROJECT_NAME}_ENABLE_CPACK_PACKAGING) - MESSAGE("") - MESSAGE("Set up for creating a distribution ...") - MESSAGE("") - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - TRIBITS_SETUP_PACKAGING_AND_DISTRIBUTION() - ELSE() - MESSAGE("-- Skipping distribution setup due to" + if (${PROJECT_NAME}_ENABLE_CPACK_PACKAGING) + message("") + message("Set up for creating a distribution ...") + message("") + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + tribits_setup_packaging_and_distribution() + else() + message("-- Skipping distribution setup due to" " ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY=ON") - ENDIF() - ELSE() - MESSAGE("") - MESSAGE("Skipping setup for distribution because" + endif() + else() + message("") + message("Skipping setup for distribution because" " ${PROJECT_NAME}_ENABLE_CPACK_PACKAGING=OFF") - MESSAGE("") - ENDIF() + message("") + endif() # # M) Set up for installation # - IF (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - TRIBITS_SETUP_FOR_INSTALLATION() - ENDIF() + if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) + tribits_setup_for_installation() + endif() # # N) Generate resource spec file if applicable # - TRIBITS_GENERATE_CTEST_RESOURCE_SPEC_FILE_PROJECT_LOGIC() + tribits_generate_ctest_resource_spec_file_project_logic() # # O) Show final timing and end # - MESSAGE("") - MESSAGE("Finished configuring ${PROJECT_NAME}!") - MESSAGE("") - TRIBITS_CONFIG_CODE_STOP_TIMER(GLOBAL_TIME_START_SECONDS + message("") + message("Finished configuring ${PROJECT_NAME}!") + message("") + tribits_config_code_stop_timer(GLOBAL_TIME_START_SECONDS "Total time to configure ${PROJECT_NAME}") -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_PROJECT_ENABLE_ALL() +# @MACRO: tribits_project_enable_all() # # Process a project where you enable all of the packages by default. # # Usage:: # -# TRIBITS_PROJECT_ENABLE_ALL() +# tribits_project_enable_all() # # This macro just sets the global cache var # `${PROJECT_NAME}_ENABLE_ALL_PACKAGES`_ to ``ON`` by default then calls -# `TRIBITS_PROJECT()`_. That is all. This macro is generally used for +# `tribits_project()`_. That is all. This macro is generally used for # TriBITS projects that have just a single package or by default just want to # enable all packages. This is especially useful when you have a TriBITS # project with just a single package. # -MACRO(TRIBITS_PROJECT_ENABLE_ALL) - SET(${PROJECT_NAME}_ENABLE_ALL_PACKAGES ON CACHE BOOL "Enable all by default" ) - TRIBITS_PROJECT_IMPL(${ARGN}) -ENDMACRO() +macro(tribits_project_enable_all) + set(${PROJECT_NAME}_ENABLE_ALL_PACKAGES ON CACHE BOOL "Enable all by default" ) + tribits_project_impl(${ARGN}) +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake b/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake index e7cbb787c2bd..581d09fee74f 100644 --- a/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake +++ b/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake @@ -39,58 +39,63 @@ # Standard TriBITS system includes -INCLUDE(TribitsConstants) -INCLUDE(TribitsProcessExtraRepositoriesList) -INCLUDE(TribitsProcessPackagesAndDirsLists) -INCLUDE(TribitsProcessTplsLists) -INCLUDE(TribitsReadDepsFilesCreateDepsGraph) +include(TribitsConstants) +include(TribitsProcessExtraRepositoriesList) +include(TribitsProcessPackagesAndDirsLists) +include(TribitsProcessTplsLists) +include(TribitsReadDepsFilesCreateDepsGraph) # Standard TriBITS utilities includes -INCLUDE(TimingUtils) +include(TimingUtils) -# @MACRO: TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() +# @MACRO: tribits_read_all_project_deps_files_create_deps_graph() # # Usage:: # -# TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH() +# tribits_read_all_project_deps_files_create_deps_graph() # -# Macro run at the top project-level scope that reads in packages and TPLs, -# process dependencies, and (optimally) writes XML files of dependency -# information. +# Macro run at the top project-level scope that reads the lists of packages +# and TPLs and creates the packages dependency graph. # # On output, this creates all of the package lists and dependency -# data-structures described in `TriBITS System Data Structures and -# Functions`_. +# data-structures described in the section `TriBITS System Data Structures`_ +# and more specifically the sections: # -# See `Function call tree for constructing package dependency graph`_ +# * `Lists of external and internal packages`_ +# * `List variables defining the package dependencies graph`_ +# * `TriBITS Package Top-Level Local Variables`_ +# * `TriBITS Subpackage Top-Level Local Variables`_ +# * `TriBITS Package Cache Variables`_ +# +# See `Function call tree for constructing package dependency graph`_. # -MACRO(TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH) +macro(tribits_read_all_project_deps_files_create_deps_graph) - TRIBITS_CONFIG_CODE_START_TIMER(SET_UP_DEPENDENCIES_TIME_START_SECONDS) + tribits_config_code_start_timer(SET_UP_DEPENDENCIES_TIME_START_SECONDS) - TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS() + tribits_read_defined_external_and_internal_toplevel_packages_lists() - TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH() + tribits_read_deps_files_create_deps_graph() - TRIBITS_CONFIG_CODE_STOP_TIMER(SET_UP_DEPENDENCIES_TIME_START_SECONDS + tribits_config_code_stop_timer(SET_UP_DEPENDENCIES_TIME_START_SECONDS "\nTotal time to read in all dependencies files and build dependencies graph") -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS() +# @MACRO: tribits_read_defined_external_and_internal_toplevel_packages_lists() # # Usage:: # -# TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS() +# tribits_read_defined_external_and_internal_toplevel_packages_lists() # # Macro run at the top project-level scope that reads in the contents of all # of the `/TPLsList.cmake`_ and `/PackagesList.cmake`_ files # to get the list of defined external packages (TPLs) and internal top-level # (TriBITS) packages. # -# On output, this produces the list varaibles:: +# On output, this produces the list variables:: # # ${PROJECT_NAME}_DEFINED_TPLS # ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES @@ -103,7 +108,7 @@ ENDMACRO() # ${PROJECT_NAME}_PACKAGES (old) # ${PROJECT_NAME}_TPLS (old) # -# and related varaibles. +# and related variables. # # This includes the files: # @@ -112,49 +117,49 @@ ENDMACRO() # # and calls the macros: # -# * `TRIBITS_PROCESS_TPLS_LISTS()`_ -# * `TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS()`_ +# * `tribits_process_tpls_lists()`_ +# * `tribits_process_packages_and_dirs_lists()`_ # -# which set their varaibles. +# which set their variables. # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS) +macro(tribits_read_defined_external_and_internal_toplevel_packages_lists) - TRIBITS_SET_ALL_EXTRA_REPOSITORIES() + tribits_set_all_extra_repositories() # Set to empty - SET(${PROJECT_NAME}_PACKAGES) - SET(${PROJECT_NAME}_TPLS) + set(${PROJECT_NAME}_PACKAGES) + set(${PROJECT_NAME}_TPLS) # # A) Read list of packages and TPLs from 'PRE' extra repos # - SET(READ_PRE_OR_POST_EXRAREPOS PRE) - TRIBITS_READ_EXTRA_REPOSITORIES_LISTS() + set(READ_PRE_OR_POST_EXRAREPOS PRE) + tribits_read_extra_repositories_lists() # # B) Read list of packages and TPLs from native repos # - FOREACH(NATIVE_REPO ${${PROJECT_NAME}_NATIVE_REPOSITORIES}) + foreach(NATIVE_REPO ${${PROJECT_NAME}_NATIVE_REPOSITORIES}) - TRIBITS_GET_REPO_NAME_DIR(${NATIVE_REPO} NATIVE_REPO_NAME NATIVE_REPO_DIR) - #PRINT_VAR(NATIVE_REPO_NAME) - #PRINT_VAR(NATIVE_REPO_DIR) + tribits_get_repo_name_dir(${NATIVE_REPO} NATIVE_REPO_NAME NATIVE_REPO_DIR) + #print_var(NATIVE_REPO_NAME) + #print_var(NATIVE_REPO_DIR) # Need to make sure this gets set because logic in Dependencies.cmake files # looks for the presents of this variable. - TRIBITS_SET_BASE_REPO_DIR(${PROJECT_SOURCE_DIR} ${NATIVE_REPO_DIR} + tribits_set_base_repo_dir(${PROJECT_SOURCE_DIR} ${NATIVE_REPO_DIR} ${NATIVE_REPO_NAME}_SOURCE_DIR) - #PRINT_VAR(${NATIVE_REPO_NAME}_SOURCE_DIR) + #print_var(${NATIVE_REPO_NAME}_SOURCE_DIR) - IF (NATIVE_REPO STREQUAL ".") - SET(REPOSITORY_NAME ${PROJECT_NAME}) - ELSE() - SET(REPOSITORY_NAME ${NATIVE_REPO_NAME}) - ENDIF() + if (NATIVE_REPO STREQUAL ".") + set(REPOSITORY_NAME ${PROJECT_NAME}) + else() + set(REPOSITORY_NAME ${NATIVE_REPO_NAME}) + endif() # # B.1) Define the lists of all ${NATIVE_REPO_NAME} native packages and TPLs @@ -162,243 +167,243 @@ MACRO(TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS) # B.1.a) Read in the list of TPLs for this repo - IF (${NATIVE_REPO_NAME}_TPLS_FILE_OVERRIDE) - IF (IS_ABSOLUTE "${${NATIVE_REPO_NAME}_TPLS_FILE_OVERRIDE}") - SET(${NATIVE_REPO_NAME}_TPLS_FILE + if (${NATIVE_REPO_NAME}_TPLS_FILE_OVERRIDE) + if (IS_ABSOLUTE "${${NATIVE_REPO_NAME}_TPLS_FILE_OVERRIDE}") + set(${NATIVE_REPO_NAME}_TPLS_FILE "${${NATIVE_REPO_NAME}_TPLS_FILE_OVERRIDE}") - ELSE() - SET(${NATIVE_REPO_NAME}_TPLS_FILE + else() + set(${NATIVE_REPO_NAME}_TPLS_FILE "${${NATIVE_REPO_NAME}_SOURCE_DIR}/${${NATIVE_REPO_NAME}_TPLS_FILE_OVERRIDE}") - ENDIF() - ELSE() - SET(${NATIVE_REPO_NAME}_TPLS_FILE + endif() + else() + set(${NATIVE_REPO_NAME}_TPLS_FILE "${${NATIVE_REPO_NAME}_SOURCE_DIR}/${${PROJECT_NAME}_TPLS_FILE_NAME}") - ENDIF() + endif() - MESSAGE("") - MESSAGE("Reading list of native TPLs from ${${NATIVE_REPO_NAME}_TPLS_FILE}") - MESSAGE("") + message("") + message("Reading list of native TPLs from ${${NATIVE_REPO_NAME}_TPLS_FILE}") + message("") - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE + tribits_trace_file_processing(REPOSITORY INCLUDE "${${NATIVE_REPO_NAME}_TPLS_FILE}") - INCLUDE(${${NATIVE_REPO_NAME}_TPLS_FILE}) - TRIBITS_PROCESS_TPLS_LISTS(${NATIVE_REPO_NAME} ${NATIVE_REPO_DIR}) + include(${${NATIVE_REPO_NAME}_TPLS_FILE}) + tribits_process_tpls_lists(${NATIVE_REPO_NAME} ${NATIVE_REPO_DIR}) # B.1.b) Read in list of packages for this repo - IF (${NATIVE_REPO_NAME}_PACKAGES_FILE_OVERRIDE) - IF (IS_ABSOLUTE "${${NATIVE_REPO_NAME}_PACKAGES_FILE_OVERRIDE}") - SET(${NATIVE_REPO_NAME}_PACKAGES_FILE + if (${NATIVE_REPO_NAME}_PACKAGES_FILE_OVERRIDE) + if (IS_ABSOLUTE "${${NATIVE_REPO_NAME}_PACKAGES_FILE_OVERRIDE}") + set(${NATIVE_REPO_NAME}_PACKAGES_FILE "${${NATIVE_REPO_NAME}_PACKAGES_FILE_OVERRIDE}") - ELSE() - SET(${NATIVE_REPO_NAME}_PACKAGES_FILE + else() + set(${NATIVE_REPO_NAME}_PACKAGES_FILE "${${NATIVE_REPO_NAME}_SOURCE_DIR}/${${NATIVE_REPO_NAME}_PACKAGES_FILE_OVERRIDE}") - ENDIF() - ELSE() - SET(${NATIVE_REPO_NAME}_PACKAGES_FILE + endif() + else() + set(${NATIVE_REPO_NAME}_PACKAGES_FILE "${${NATIVE_REPO_NAME}_SOURCE_DIR}/${${PROJECT_NAME}_PACKAGES_FILE_NAME}") - ENDIF() + endif() - MESSAGE("") - MESSAGE("Reading list of native packages from ${${NATIVE_REPO_NAME}_PACKAGES_FILE}") - MESSAGE("") + message("") + message("Reading list of native packages from ${${NATIVE_REPO_NAME}_PACKAGES_FILE}") + message("") - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE + tribits_trace_file_processing(REPOSITORY INCLUDE "${${NATIVE_REPO_NAME}_PACKAGES_FILE}") - INCLUDE(${${NATIVE_REPO_NAME}_PACKAGES_FILE}) + include(${${NATIVE_REPO_NAME}_PACKAGES_FILE}) - TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS(${NATIVE_REPO_NAME} ${NATIVE_REPO_DIR}) + tribits_process_packages_and_dirs_lists(${NATIVE_REPO_NAME} ${NATIVE_REPO_DIR}) - ENDFOREACH() + endforeach() # # C) Read list of packages and TPLs from 'POST' extra repos # - SET(READ_PRE_OR_POST_EXRAREPOS POST) - TRIBITS_READ_EXTRA_REPOSITORIES_LISTS() + set(READ_PRE_OR_POST_EXRAREPOS POST) + tribits_read_extra_repositories_lists() # # D) Set names of new vars (#63) # - SET(${PROJECT_NAME}_DEFINED_TPLS ${${PROJECT_NAME}_TPLS}) - LIST(LENGTH ${PROJECT_NAME}_DEFINED_TPLS ${PROJECT_NAME}_NUM_DEFINED_TPLS) - SET(${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES ${${PROJECT_NAME}_PACKAGES}) - LIST(LENGTH ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES + set(${PROJECT_NAME}_DEFINED_TPLS ${${PROJECT_NAME}_TPLS}) + list(LENGTH ${PROJECT_NAME}_DEFINED_TPLS ${PROJECT_NAME}_NUM_DEFINED_TPLS) + set(${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES ${${PROJECT_NAME}_PACKAGES}) + list(LENGTH ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES ${PROJECT_NAME}_NUM_DEFINED_INTERNAL_PACKAGES) - SET(${PROJECT_NAME}_ALL_DEFINED_TOPLEVEL_PACKAGES + set(${PROJECT_NAME}_ALL_DEFINED_TOPLEVEL_PACKAGES ${${PROJECT_NAME}_DEFINED_TPLS} ${${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES}) - LIST(LENGTH ${PROJECT_NAME}_ALL_DEFINED_TOPLEVEL_PACKAGES + list(LENGTH ${PROJECT_NAME}_ALL_DEFINED_TOPLEVEL_PACKAGES ${PROJECT_NAME}_NUM_ALL_DEFINED_TOPLEVEL_PACKAGES) -ENDMACRO() +endmacro() -# @FUNCTION: TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED() +# @FUNCTION: tribits_write_xml_dependency_files_if_supported() # # Usage:: # -# TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED() +# tribits_write_xml_dependency_files_if_supported() # -# Function that writes XML dependnecy files if support for that exists in this +# Function that writes XML dependency files if support for that exists in this # instance of TriBITs. # # See `Function call tree for constructing package dependency graph`_ # -FUNCTION(TRIBITS_WRITE_XML_DEPENDENCY_FILES_IF_SUPPORTED) - SET(TRIBITS_PROJECT_CI_SUPPORT_DIR +function(tribits_write_xml_dependency_files_if_supported) + set(TRIBITS_PROJECT_CI_SUPPORT_DIR "${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CI_SUPPORT_DIR}") - SET(TRIBITS_DUMP_XML_DEPS_MODULE + set(TRIBITS_DUMP_XML_DEPS_MODULE "${TRIBITS_PROJECT_CI_SUPPORT_DIR}/TribitsWriteXmlDependenciesFiles.cmake") - IF (EXISTS "${TRIBITS_DUMP_XML_DEPS_MODULE}") - INCLUDE(${TRIBITS_DUMP_XML_DEPS_MODULE}) - TRIBITS_WRITE_XML_DEPENDENCY_FILES() - ENDIF() -ENDFUNCTION() + if (EXISTS "${TRIBITS_DUMP_XML_DEPS_MODULE}") + include(${TRIBITS_DUMP_XML_DEPS_MODULE}) + tribits_write_xml_dependency_files() + endif() +endfunction() # Macro that sets ${PROJECT_NAME}_ALL_REPOSITORIES from # ${PROJECT_NAME}_PRE_REPOSITORIES and ${PROJECT_NAME}_EXTRA_REPOSITORIES if -# it is not alrady set. Also, it replaces ',' with ';' in the latter. +# it is not already set. Also, it replaces ',' with ';' in the latter. # # This function is needed in use cases where extra repos are used where the # extra repos are not read in through an ExtraRepositoriesList.cmake file and # instead are directly passed in by the user. # -MACRO(TRIBITS_SET_ALL_EXTRA_REPOSITORIES) - IF ("${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}" STREQUAL "") - # Allow list to be seprated by ',' instead of just by ';'. This is needed +macro(tribits_set_all_extra_repositories) + if ("${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}" STREQUAL "") + # Allow list to be separated by ',' instead of just by ';'. This is needed # by the unit test driver code - SPLIT("${${PROJECT_NAME}_PRE_REPOSITORIES}" "," + split("${${PROJECT_NAME}_PRE_REPOSITORIES}" "," ${PROJECT_NAME}_PRE_REPOSITORIES) - SPLIT("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" "," + split("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" "," ${PROJECT_NAME}_EXTRA_REPOSITORIES) - SET(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES + set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES ${${PROJECT_NAME}_PRE_REPOSITORIES} ${${PROJECT_NAME}_EXTRA_REPOSITORIES}) - ENDIF() -ENDMACRO() + endif() +endmacro() # Macro that processes the list of package and TPLs for the set of 'PRE' or # 'POST' extra repos. # -MACRO(TRIBITS_READ_EXTRA_REPOSITORIES_LISTS) +macro(tribits_read_extra_repositories_lists) - LIST(LENGTH ${PROJECT_NAME}_PRE_REPOSITORIES PRE_EXTRAREPOS_LEN) - LIST(LENGTH ${PROJECT_NAME}_EXTRA_REPOSITORIES POST_EXTRAREPOS_LEN) - MATH(EXPR ALL_EXTRAREPOS_LEN "${PRE_EXTRAREPOS_LEN} + ${POST_EXTRAREPOS_LEN}") + list(LENGTH ${PROJECT_NAME}_PRE_REPOSITORIES PRE_EXTRAREPOS_LEN) + list(LENGTH ${PROJECT_NAME}_EXTRA_REPOSITORIES POST_EXTRAREPOS_LEN) + math(EXPR ALL_EXTRAREPOS_LEN "${PRE_EXTRAREPOS_LEN} + ${POST_EXTRAREPOS_LEN}") # See if processing 'PRE' or 'POST' extra repos - IF (READ_PRE_OR_POST_EXRAREPOS STREQUAL "PRE") - SET(EXTRAREPO_IDX_START 0) - SET(EXTRAREPO_IDX_END ${PRE_EXTRAREPOS_LEN}) - ELSEIF (READ_PRE_OR_POST_EXRAREPOS STREQUAL "POST") - SET(EXTRAREPO_IDX_START ${PRE_EXTRAREPOS_LEN}) - SET(EXTRAREPO_IDX_END ${ALL_EXTRAREPOS_LEN}) - ELSE() - MESSAGE(FATAL_ERROR "Invalid value for READ_PRE_OR_POST_EXRAREPOS='${READ_PRE_OR_POST_EXRAREPOS}' ") - ENDIF() + if (READ_PRE_OR_POST_EXRAREPOS STREQUAL "PRE") + set(EXTRAREPO_IDX_START 0) + set(EXTRAREPO_IDX_END ${PRE_EXTRAREPOS_LEN}) + elseif (READ_PRE_OR_POST_EXRAREPOS STREQUAL "POST") + set(EXTRAREPO_IDX_START ${PRE_EXTRAREPOS_LEN}) + set(EXTRAREPO_IDX_END ${ALL_EXTRAREPOS_LEN}) + else() + message(FATAL_ERROR "Invalid value for READ_PRE_OR_POST_EXRAREPOS='${READ_PRE_OR_POST_EXRAREPOS}' ") + endif() # NOTE: For some reason, we can't pass this argument to the function and # have it read. Instead, we have to pass it a local variable. I will never # understand CMake. - SET(EXTRAREPO_IDX ${EXTRAREPO_IDX_START}) - WHILE(EXTRAREPO_IDX LESS EXTRAREPO_IDX_END) + set(EXTRAREPO_IDX ${EXTRAREPO_IDX_START}) + while(EXTRAREPO_IDX LESS EXTRAREPO_IDX_END) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES ${EXTRAREPO_IDX} EXTRA_REPO ) - SET(REPOSITORY_NAME ${EXTRA_REPO}) + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES ${EXTRAREPO_IDX} EXTRA_REPO ) + set(REPOSITORY_NAME ${EXTRA_REPO}) - #PRINT_VAR(EXTRA_REPO) - #PRINT_VAR(EXTRAREPO_IDX) - #PRINT_VAR(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) + #print_var(EXTRA_REPO) + #print_var(EXTRAREPO_IDX) + #print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) # Need to make sure this gets set because logic in Dependencies.cmake files # looks for the presents of this variable. - SET(${EXTRA_REPO}_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${EXTRA_REPO}") - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${EXTRA_REPO}_SOURCE_DIR) - ENDIF() + set(${EXTRA_REPO}_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${EXTRA_REPO}") + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${EXTRA_REPO}_SOURCE_DIR) + endif() # ToDo: TriBITS:73: Get ${EXTRA_REPO}_SOURCE_DIR from # ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIR when it exists. - SET(EXTRAREPO_PACKSTAT "") - IF (${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) - LIST(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_IDX} + set(EXTRAREPO_PACKSTAT "") + if (${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_IDX} EXTRAREPO_PACKSTAT ) - ENDIF() + endif() - IF (EXTRAREPO_PACKSTAT STREQUAL NOPACKAGES) + if (EXTRAREPO_PACKSTAT STREQUAL NOPACKAGES) - MESSAGE("") - MESSAGE("Skipping reading packages and TPLs for ${READ_PRE_OR_POST_EXRAREPOS} extra repo ${EXTRA_REPO} because marked NOPACKAGES ... ") - MESSAGE("") + message("") + message("Skipping reading packages and TPLs for ${READ_PRE_OR_POST_EXRAREPOS} extra repo ${EXTRA_REPO} because marked NOPACKAGES ... ") + message("") # ToDo: TriBITS:73: Don't print the above message by default. It is # just clutter. - ELSE() + else() # Read in the add-on TPLs from the extra repo - SET(${EXTRA_REPO}_TPLS_FILE + set(${EXTRA_REPO}_TPLS_FILE "${${EXTRA_REPO}_SOURCE_DIR}/${${PROJECT_NAME}_EXTRA_TPLS_FILE_NAME}") - PRINT_VAR(${EXTRA_REPO}_SOURCE_DIR) - PRINT_VAR(${PROJECT_NAME}_EXTRA_TPLS_FILE_NAME) - PRINT_VAR(${EXTRA_REPO}_TPLS_FILE) + print_var(${EXTRA_REPO}_SOURCE_DIR) + print_var(${PROJECT_NAME}_EXTRA_TPLS_FILE_NAME) + print_var(${EXTRA_REPO}_TPLS_FILE) - MESSAGE("") - MESSAGE("Reading list of ${READ_PRE_OR_POST_EXRAREPOS} extra TPLs from ${${EXTRA_REPO}_TPLS_FILE} ... ") - MESSAGE("") + message("") + message("Reading list of ${READ_PRE_OR_POST_EXRAREPOS} extra TPLs from ${${EXTRA_REPO}_TPLS_FILE} ... ") + message("") - IF (NOT EXISTS "${${EXTRA_REPO}_TPLS_FILE}") - IF (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) - MESSAGE("-- " + if (NOT EXISTS "${${EXTRA_REPO}_TPLS_FILE}") + if (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) + message("-- " "NOTE: Ignoring missing ${READ_PRE_OR_POST_EXRAREPOS} extra repo '${EXTRA_REPO}' TPLs list file '${${EXTRA_REPO}_TPLS_FILE}' on request!" ) - ELSE() - MESSAGE( SEND_ERROR + else() + message( SEND_ERROR "ERROR: Skipping missing ${READ_PRE_OR_POST_EXRAREPOS} extra repo '${EXTRA_REPO}' TPLs list file '${${EXTRA_REPO}_TPLS_FILE}'!") - ENDIF() - ELSE() - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE "${${EXTRA_REPO}_TPLS_FILE}") - INCLUDE("${${EXTRA_REPO}_TPLS_FILE}") - SET(APPEND_TO_TPLS_LIST TRUE) - TRIBITS_PROCESS_TPLS_LISTS(${EXTRA_REPO} ${EXTRA_REPO}) - ENDIF() + endif() + else() + tribits_trace_file_processing(REPOSITORY INCLUDE "${${EXTRA_REPO}_TPLS_FILE}") + include("${${EXTRA_REPO}_TPLS_FILE}") + set(APPEND_TO_TPLS_LIST TRUE) + tribits_process_tpls_lists(${EXTRA_REPO} ${EXTRA_REPO}) + endif() # Read in the add-on packages from the extra repo - #PRINT_VAR(${EXTRA_REPO}_PACKAGES_LIST_FILE) - IF (${EXTRA_REPO}_PACKAGES_LIST_FILE) - SET(EXTRAREPO_PACKAGES_FILE + #print_var(${EXTRA_REPO}_PACKAGES_LIST_FILE) + if (${EXTRA_REPO}_PACKAGES_LIST_FILE) + set(EXTRAREPO_PACKAGES_FILE "${PROJECT_SOURCE_DIR}/${${EXTRA_REPO}_PACKAGES_LIST_FILE}") - ELSE() - SET(EXTRAREPO_PACKAGES_FILE + else() + set(EXTRAREPO_PACKAGES_FILE "${${EXTRA_REPO}_SOURCE_DIR}/${${PROJECT_NAME}_EXTRA_PACKAGES_FILE_NAME}") - ENDIF() + endif() - MESSAGE("") - MESSAGE("Reading list of ${READ_PRE_OR_POST_EXRAREPOS} extra packages from ${EXTRAREPO_PACKAGES_FILE} ... ") - MESSAGE("") + message("") + message("Reading list of ${READ_PRE_OR_POST_EXRAREPOS} extra packages from ${EXTRAREPO_PACKAGES_FILE} ... ") + message("") - IF (NOT EXISTS "${EXTRAREPO_PACKAGES_FILE}") - IF (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) - MESSAGE("-- " + if (NOT EXISTS "${EXTRAREPO_PACKAGES_FILE}") + if (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) + message("-- " "NOTE: Ignoring missing ${READ_PRE_OR_POST_EXRAREPOS} extra repo '${EXTRA_REPO}' packages list file '${EXTRAREPO_PACKAGES_FILE}' on request!") - ELSE() - MESSAGE( SEND_ERROR + else() + message( SEND_ERROR "ERROR: Skipping missing ${READ_PRE_OR_POST_EXRAREPOS} extra repo '${EXTRA_REPO}' packages list file '${EXTRAREPO_PACKAGES_FILE}'!") # ToDo: TriBITS:73: Change to FATAL_ERROR to abort early - ENDIF() - ELSE() - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE "${EXTRAREPO_PACKAGES_FILE}") - INCLUDE("${EXTRAREPO_PACKAGES_FILE}") - SET(APPEND_TO_PACKAGES_LIST TRUE) - TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS(${EXTRA_REPO} ${EXTRA_REPO}) - ENDIF() + endif() + else() + tribits_trace_file_processing(REPOSITORY INCLUDE "${EXTRAREPO_PACKAGES_FILE}") + include("${EXTRAREPO_PACKAGES_FILE}") + set(APPEND_TO_PACKAGES_LIST TRUE) + tribits_process_packages_and_dirs_lists(${EXTRA_REPO} ${EXTRA_REPO}) + endif() - ENDIF() + endif() - MATH(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") + math(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") - ENDWHILE() + endwhile() -ENDMACRO() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake b/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake index c778c4054d10..c344680041de 100644 --- a/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake +++ b/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake @@ -37,15 +37,15 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsPackageDefineDependencies) -INCLUDE(SetDefault) -INCLUDE(DualScopeSet) +include(TribitsPackageDefineDependencies) +include(SetDefault) +include(DualScopeSet) -# @MACRO: TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH() +# @MACRO: tribits_read_deps_files_create_deps_graph() # # Usage:: # -# TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH() +# tribits_read_deps_files_create_deps_graph() # # This macro reads of all the package dependencies and builds the package # dependency graph. This first executes the logic in the files @@ -53,7 +53,7 @@ INCLUDE(DualScopeSet) # and `/cmake/ProjectDependenciesSetup.cmake`_ and then reads in # all of the `/cmake/Dependencies.cmake`_ and # `//cmake/Dependencies.cmake`_ files and builds the -# package depenency graph varibles. +# package dependency graph variables. # # This macro reads from the variables:: # @@ -64,97 +64,97 @@ INCLUDE(DualScopeSet) # # ${PROJECT_NAME}_SE_PACKAGES (old) # -# as well creates the package dependency varaibles described in `List +# as well creates the package dependency variables described in `List # variables defining the package dependencies graph`_ that defines the -# directed acyclic depenency (DAG) package dependency graph (with navigation +# directed acyclic dependency (DAG) package dependency graph (with navigation # up and down the graph). # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH) +macro(tribits_read_deps_files_create_deps_graph) - MESSAGE("") - MESSAGE("Processing Project, Repository, and Package dependency files and building internal dependencies graph ...") - MESSAGE("") + message("") + message("Processing Project, Repository, and Package dependency files and building internal dependencies graph ...") + message("") - TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES() + tribits_process_all_repository_deps_setup_files() - TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE() + tribits_process_project_dependency_setup_file() - TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH() + tribits_read_all_package_deps_files_create_deps_graph() -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES() +# @MACRO: tribits_process_all_repository_deps_setup_files() # # Process any dependency logic at the repo level by loading # `/cmake/RepositoryDependenciesSetup.cmake`_ files. # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES) - FOREACH(TIBITS_REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) - TRIBITS_GET_REPO_NAME_DIR(${TIBITS_REPO} REPO_NAME REPO_DIR) - TRIBITS_SET_BASE_REPO_DIR(${PROJECT_SOURCE_DIR} ${REPO_DIR} BASE_REPO_DIR) - TRIBITS_GET_REPO_NAME(${TIBITS_REPO} REPOSITORY_NAME) - #PRINT_VAR(TIBITS_REPO) - #PRINT_VAR(REPO_NAME) - #PRINT_VAR(REPO_DIR) - #PRINT_VAR(REPOSITORY_NAME) - SET(REPO_DEPENDENCIES_SETUP_FILE +macro(tribits_process_all_repository_deps_setup_files) + foreach(TIBITS_REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) + tribits_get_repo_name_dir(${TIBITS_REPO} REPO_NAME REPO_DIR) + tribits_set_base_repo_dir(${PROJECT_SOURCE_DIR} ${REPO_DIR} BASE_REPO_DIR) + tribits_get_repo_name(${TIBITS_REPO} REPOSITORY_NAME) + #print_var(TIBITS_REPO) + #print_var(REPO_NAME) + #print_var(REPO_DIR) + #print_var(REPOSITORY_NAME) + set(REPO_DEPENDENCIES_SETUP_FILE "${BASE_REPO_DIR}/cmake/RepositoryDependenciesSetup.cmake") - #PRINT_VAR(REPO_DEPENDENCIES_SETUP_FILE) - IF (EXISTS ${REPO_DEPENDENCIES_SETUP_FILE}) - TRIBITS_TRACE_FILE_PROCESSING(REPOSITORY INCLUDE + #print_var(REPO_DEPENDENCIES_SETUP_FILE) + if (EXISTS ${REPO_DEPENDENCIES_SETUP_FILE}) + tribits_trace_file_processing(REPOSITORY INCLUDE "${REPO_DEPENDENCIES_SETUP_FILE}") - INCLUDE(${REPO_DEPENDENCIES_SETUP_FILE}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${REPO_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) - PRINT_VAR(${REPO_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) - ENDIF() - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " + include(${REPO_DEPENDENCIES_SETUP_FILE}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${REPO_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) + print_var(${REPO_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) + endif() + else() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "The ${REPO_NAME} file ${REPO_DEPENDENCIES_SETUP_FILE} does not exist! ...") - ENDIF() - ENDIF() - ENDFOREACH() -ENDMACRO() + endif() + endif() + endforeach() +endmacro() -# @MACRO: TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE() +# @MACRO: tribits_process_project_dependency_setup_file() # # Process any dependency logic at the project level by loading the # `/cmake/ProjectDependenciesSetup.cmake`_ file # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE) - SET(PROJECT_DEPENDENCIES_SETUP_FILE +macro(tribits_process_project_dependency_setup_file) + set(PROJECT_DEPENDENCIES_SETUP_FILE "${PROJECT_SOURCE_DIR}/cmake/ProjectDependenciesSetup.cmake") - IF (EXISTS ${PROJECT_DEPENDENCIES_SETUP_FILE}) - TRIBITS_TRACE_FILE_PROCESSING(PROJECT INCLUDE + if (EXISTS ${PROJECT_DEPENDENCIES_SETUP_FILE}) + tribits_trace_file_processing(PROJECT INCLUDE "${PROJECT_DEPENDENCIES_SETUP_FILE}") - INCLUDE(${PROJECT_DEPENDENCIES_SETUP_FILE}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) - PRINT_VAR(${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) - ENDIF() - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("-- " + include(${PROJECT_DEPENDENCIES_SETUP_FILE}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) + print_var(${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) + endif() + else() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("-- " "The ${PROJECT_NAME} file ${PROJECT_DEPENDENCIES_SETUP_FILE} does not exist! ...") - ENDIF() - ENDIF() -ENDMACRO() + endif() + endif() +endmacro() -# @MACRO: TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH() +# @MACRO: tribits_read_all_package_deps_files_create_deps_graph() # # Usage:: # -# TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH() +# tribits_read_all_package_deps_files_create_deps_graph() # # This macro reads in all of the `/cmake/Dependencies.cmake`_ and # `//cmake/Dependencies.cmake`_ files for top-level @@ -177,32 +177,32 @@ ENDMACRO() # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH) +macro(tribits_read_all_package_deps_files_create_deps_graph) - SET(${PROJECT_NAME}_SE_PACKAGES) # Packages and subpackages + set(${PROJECT_NAME}_SE_PACKAGES) # Packages and subpackages - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) - TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH(${TRIBITS_PACKAGE} + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) + tribits_read_toplevel_package_deps_files_add_to_graph(${TRIBITS_PACKAGE} ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) - ENDFOREACH() + endforeach() # Create a reverse SE packages list for later use - SET(${PROJECT_NAME}_REVERSE_SE_PACKAGES ${${PROJECT_NAME}_SE_PACKAGES}) - IF (${PROJECT_NAME}_REVERSE_SE_PACKAGES) - LIST(REVERSE ${PROJECT_NAME}_REVERSE_SE_PACKAGES) - ENDIF() + set(${PROJECT_NAME}_REVERSE_SE_PACKAGES ${${PROJECT_NAME}_SE_PACKAGES}) + if (${PROJECT_NAME}_REVERSE_SE_PACKAGES) + list(REVERSE ${PROJECT_NAME}_REVERSE_SE_PACKAGES) + endif() - LIST(LENGTH ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME}_NUM_SE_PACKAGES) - PRINT_VAR(${PROJECT_NAME}_NUM_SE_PACKAGES) + list(LENGTH ${PROJECT_NAME}_SE_PACKAGES ${PROJECT_NAME}_NUM_SE_PACKAGES) + print_var(${PROJECT_NAME}_NUM_SE_PACKAGES) -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH() +# @MACRO: tribits_read_toplevel_package_deps_files_add_to_graph() # # Usage:: # -# TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH() +# tribits_read_toplevel_package_deps_files_add_to_graph() # # Macro that reads in package dependencies for a top-level package from the # file `/cmake/Dependencies.cmake`_ and appends the forward @@ -220,7 +220,7 @@ ENDMACRO() # ${PACKAGE_NAME}_FORWARD_TEST_REQUIRED_DEP_PACKAGES # ${PACKAGE_NAME}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES # -# It also appends the list varaible:: +# It also appends the list variable:: # # ${PROJECT_NAME}_SE_PACKAGES (old) # @@ -230,61 +230,61 @@ ENDMACRO() # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH PACKAGE_NAME) +macro(tribits_read_toplevel_package_deps_files_add_to_graph PACKAGE_NAME) # A) Get ready to read in the contents of this this pakages's Dependencies.cmake file - TRIBITS_PREP_TO_READ_DEPENDENCIES(${PACKAGE_NAME}) + tribits_prep_to_read_dependencies(${PACKAGE_NAME}) - # Listing of subpakages - SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) # Allow to be empty + # Listing of subpackages + set(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) # Allow to be empty # B) Read in this package's Dependencies file and save off read dependency vars. - SET(PACKAGE_DEPENDENCIES_FILE + set(PACKAGE_DEPENDENCIES_FILE "${PROJECT_SOURCE_DIR}/${${PACKAGE_NAME}_REL_SOURCE_DIR}/cmake/Dependencies.cmake") - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE INCLUDE "${PACKAGE_DEPENDENCIES_FILE}") - INCLUDE(${PACKAGE_DEPENDENCIES_FILE}) + tribits_trace_file_processing(PACKAGE INCLUDE "${PACKAGE_DEPENDENCIES_FILE}") + include(${PACKAGE_DEPENDENCIES_FILE}) - TRIBITS_ASSERT_READ_DEPENDENCY_VARS(${PACKAGE_NAME}) + tribits_assert_read_dependency_vars(${PACKAGE_NAME}) - TRIBITS_SAVE_OFF_DEPENDENCIES_VARS(PARENTPACK) + tribits_save_off_dependency_vars(PARENTPACK) # B.1) Set up the mail addresses (one regression email list for the package # and all subpackages) - TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST(${PACKAGE_NAME}) + tribits_set_package_regression_email_list(${PACKAGE_NAME}) # B.2) Process this package's subpackages first *before* finishing this packages! - TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS(${PACKAGE_NAME}) + tribits_parse_subpackages_append_se_packages_add_options(${PACKAGE_NAME}) - TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH(${PACKAGE_NAME}) + tribits_read_package_subpackage_deps_files_add_to_graph(${PACKAGE_NAME}) # C) Finish processing this package's dependencies into dependency graph vars # # NOTE: The subpackages for this package are automatically treated as # optional or required library dependent packages for this outer package! - TRIBITS_READ_BACK_DEPENDENCIES_VARS(PARENTPACK) + tribits_read_back_dependencies_vars(PARENTPACK) # Append the subpackages to the dependencies list if this top-level package - SET(SUBPACKAGE_IDX 0) - FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) - LIST(GET ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_IDX} SUBPACKAGE_OPTREQ) - LIST(APPEND LIB_${SUBPACKAGE_OPTREQ}_DEP_PACKAGES ${SUBPACKAGE_FULLNAME}) - MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") - ENDFOREACH() + set(SUBPACKAGE_IDX 0) + foreach(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) + set(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) + list(GET ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_IDX} SUBPACKAGE_OPTREQ) + list(APPEND LIB_${SUBPACKAGE_OPTREQ}_DEP_PACKAGES ${SUBPACKAGE_FULLNAME}) + math(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") + endforeach() # Append this package to list of SE packages *after* subpackages are added! - LIST(APPEND ${PROJECT_NAME}_SE_PACKAGES ${PACKAGE_NAME}) + list(APPEND ${PROJECT_NAME}_SE_PACKAGES ${PACKAGE_NAME}) # Process this parent package's dependency lists! - TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS(${PACKAGE_NAME}) + tribits_process_package_dependencies_lists(${PACKAGE_NAME}) -ENDMACRO() +endmacro() ################################################################################ @@ -293,14 +293,14 @@ ENDMACRO() ################################################################################ -# @MACRO: TRIBITS_PREP_TO_READ_DEPENDENCIES() +# @MACRO: tribits_prep_to_read_dependencies() # # Usage:: # -# TRIBITS_PREP_TO_READ_DEPENDENCIES() +# tribits_prep_to_read_dependencies() # # Macro that sets to undefined all of the variables that must be set by the -# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ macro. +# `tribits_package_define_dependencies()`_ macro. # # It also sets to empty the forward dependency list vars:: # @@ -311,149 +311,149 @@ ENDMACRO() # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_PREP_TO_READ_DEPENDENCIES PACKAGE_NAME_IN) +macro(tribits_prep_to_read_dependencies PACKAGE_NAME_IN) - TRIBITS_DECLARE_UNDEFINED(LIB_REQUIRED_DEP_PACKAGES) - TRIBITS_DECLARE_UNDEFINED(LIB_OPTIONAL_DEP_PACKAGES) - TRIBITS_DECLARE_UNDEFINED(TEST_REQUIRED_DEP_PACKAGES) - TRIBITS_DECLARE_UNDEFINED(TEST_OPTIONAL_DEP_PACKAGES) + tribits_declare_undefined(LIB_REQUIRED_DEP_PACKAGES) + tribits_declare_undefined(LIB_OPTIONAL_DEP_PACKAGES) + tribits_declare_undefined(TEST_REQUIRED_DEP_PACKAGES) + tribits_declare_undefined(TEST_OPTIONAL_DEP_PACKAGES) - TRIBITS_DECLARE_UNDEFINED(LIB_REQUIRED_DEP_TPLS "") - TRIBITS_DECLARE_UNDEFINED(LIB_OPTIONAL_DEP_TPLS "") - TRIBITS_DECLARE_UNDEFINED(TEST_REQUIRED_DEP_TPLS "") - TRIBITS_DECLARE_UNDEFINED(TEST_OPTIONAL_DEP_TPLS "") + tribits_declare_undefined(LIB_REQUIRED_DEP_TPLS "") + tribits_declare_undefined(LIB_OPTIONAL_DEP_TPLS "") + tribits_declare_undefined(TEST_REQUIRED_DEP_TPLS "") + tribits_declare_undefined(TEST_OPTIONAL_DEP_TPLS "") - SET(REGRESSION_EMAIL_LIST "") # Allow to be empty + set(REGRESSION_EMAIL_LIST "") # Allow to be empty - SET(${PACKAGE_NAME_IN}_FORWARD_LIB_REQUIRED_DEP_PACKAGES "") - SET(${PACKAGE_NAME_IN}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES "") - SET(${PACKAGE_NAME_IN}_FORWARD_TEST_REQUIRED_DEP_PACKAGES "") - SET(${PACKAGE_NAME_IN}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES "") + set(${PACKAGE_NAME_IN}_FORWARD_LIB_REQUIRED_DEP_PACKAGES "") + set(${PACKAGE_NAME_IN}_FORWARD_LIB_OPTIONAL_DEP_PACKAGES "") + set(${PACKAGE_NAME_IN}_FORWARD_TEST_REQUIRED_DEP_PACKAGES "") + set(${PACKAGE_NAME_IN}_FORWARD_TEST_OPTIONAL_DEP_PACKAGES "") -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_ASSERT_READ_DEPENDENCY_VARS() +# @MACRO: tribits_assert_read_dependency_vars() # # Usage:: # -# TRIBITS_ASSERT_READ_DEPENDENCY_VARS() +# tribits_assert_read_dependency_vars() # # Assert that all of the required variables set by the function -# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ in the file +# `tribits_package_define_dependencies()`_ in the file # `/cmake/Dependencies.cmake`_ have been set. # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_ASSERT_READ_DEPENDENCY_VARS PACKAGE_NAME) +macro(tribits_assert_read_dependency_vars PACKAGE_NAME) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) + tribits_assert_defined_package_var(LIB_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) + tribits_assert_defined_package_var(LIB_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) + tribits_assert_defined_package_var(TEST_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) + tribits_assert_defined_package_var(TEST_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(LIB_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) - TRIBITS_ASSERT_DEFINED_PACKAGE_VAR(TEST_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) + tribits_assert_defined_package_var(LIB_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) + tribits_assert_defined_package_var(LIB_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) + tribits_assert_defined_package_var(TEST_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) + tribits_assert_defined_package_var(TEST_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_SAVE_OFF_DEPENDENCIES_VARS() +# @MACRO: tribits_save_off_dependency_vars() # # Usage:: # -# TRIBITS_SAVE_OFF_DEPENDENCIES_VARS() +# tribits_save_off_dependency_vars() # -# Saves off package depeneency varaibles with variable suffix ``_``. +# Saves off package dependency variables with variable suffix ``_``. # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_SAVE_OFF_DEPENDENCIES_VARS POSTFIX) +macro(tribits_save_off_dependency_vars POSTFIX) - SET(LIB_REQUIRED_DEP_PACKAGES_${POSTFIX} ${LIB_REQUIRED_DEP_PACKAGES}) - SET(LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${LIB_OPTIONAL_DEP_PACKAGES}) - SET(TEST_REQUIRED_DEP_PACKAGES_${POSTFIX} ${TEST_REQUIRED_DEP_PACKAGES}) - SET(TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${TEST_OPTIONAL_DEP_PACKAGES}) + set(LIB_REQUIRED_DEP_PACKAGES_${POSTFIX} ${LIB_REQUIRED_DEP_PACKAGES}) + set(LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${LIB_OPTIONAL_DEP_PACKAGES}) + set(TEST_REQUIRED_DEP_PACKAGES_${POSTFIX} ${TEST_REQUIRED_DEP_PACKAGES}) + set(TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${TEST_OPTIONAL_DEP_PACKAGES}) - SET(LIB_REQUIRED_DEP_TPLS_${POSTFIX} ${LIB_REQUIRED_DEP_TPLS}) - SET(LIB_OPTIONAL_DEP_TPLS_${POSTFIX} ${LIB_OPTIONAL_DEP_TPLS}) - SET(TEST_REQUIRED_DEP_TPLS_${POSTFIX} ${TEST_REQUIRED_DEP_TPLS}) - SET(TEST_OPTIONAL_DEP_TPLS_${POSTFIX} ${TEST_OPTIONAL_DEP_TPLS}) + set(LIB_REQUIRED_DEP_TPLS_${POSTFIX} ${LIB_REQUIRED_DEP_TPLS}) + set(LIB_OPTIONAL_DEP_TPLS_${POSTFIX} ${LIB_OPTIONAL_DEP_TPLS}) + set(TEST_REQUIRED_DEP_TPLS_${POSTFIX} ${TEST_REQUIRED_DEP_TPLS}) + set(TEST_OPTIONAL_DEP_TPLS_${POSTFIX} ${TEST_OPTIONAL_DEP_TPLS}) -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_READ_BACK_DEPENDENCIES_VARS() +# @MACRO: tribits_read_back_dependencies_vars() # # Usage:: # -# TRIBITS_READ_BACK_DEPENDENCIES_VARS() +# tribits_read_back_dependencies_vars() # # Read back the local package dependency vars from the saved-off vars with # suffix ``_``. # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_READ_BACK_DEPENDENCIES_VARS POSTFIX) +macro(tribits_read_back_dependencies_vars POSTFIX) - SET(LIB_REQUIRED_DEP_PACKAGES ${LIB_REQUIRED_DEP_PACKAGES_${POSTFIX}}) - SET(LIB_OPTIONAL_DEP_PACKAGES ${LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) - SET(TEST_REQUIRED_DEP_PACKAGES ${TEST_REQUIRED_DEP_PACKAGES_${POSTFIX}}) - SET(TEST_OPTIONAL_DEP_PACKAGES ${TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) + set(LIB_REQUIRED_DEP_PACKAGES ${LIB_REQUIRED_DEP_PACKAGES_${POSTFIX}}) + set(LIB_OPTIONAL_DEP_PACKAGES ${LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) + set(TEST_REQUIRED_DEP_PACKAGES ${TEST_REQUIRED_DEP_PACKAGES_${POSTFIX}}) + set(TEST_OPTIONAL_DEP_PACKAGES ${TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) - SET(LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS_${POSTFIX}}) - SET(LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS_${POSTFIX}}) - SET(TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS_${POSTFIX}}) - SET(TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS_${POSTFIX}}) + set(LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS_${POSTFIX}}) + set(LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS_${POSTFIX}}) + set(TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS_${POSTFIX}}) + set(TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS_${POSTFIX}}) -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS() +# @MACRO: tribits_process_package_dependencies_lists() # # Usage:: # -# TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS() +# tribits_process_package_dependencies_lists() # -# Sets up the upstsream and downstream/forward package dependency list -# varaibles for ```` descrdibed in `List variables defining the +# Sets up the upstream and downstream/forward package dependency list +# variables for ```` described in `List variables defining the # package dependencies graph`_. Note that the downstream/forward dependencies # of upstream packages on this package ```` are built up -# incrimentally. +# incrementally. # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS PACKAGE_NAME) +macro(tribits_process_package_dependencies_lists PACKAGE_NAME) - TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} LIB REQUIRED) - TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} LIB OPTIONAL) - TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} TEST REQUIRED) - TRIBITS_SET_DEP_PACKAGES(${PACKAGE_NAME} TEST OPTIONAL) + tribits_set_dep_packages(${PACKAGE_NAME} LIB REQUIRED) + tribits_set_dep_packages(${PACKAGE_NAME} LIB OPTIONAL) + tribits_set_dep_packages(${PACKAGE_NAME} TEST REQUIRED) + tribits_set_dep_packages(${PACKAGE_NAME} TEST OPTIONAL) - SET(${PACKAGE_NAME}_LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS}) - SET(${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS}) - SET(${PACKAGE_NAME}_TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS}) - SET(${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS}) + set(${PACKAGE_NAME}_LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS}) + set(${PACKAGE_NAME}_LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS}) + set(${PACKAGE_NAME}_TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS}) + set(${PACKAGE_NAME}_TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS}) - TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} LIB_REQUIRED_DEP_PACKAGES) - TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} LIB_OPTIONAL_DEP_PACKAGES) - TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} TEST_REQUIRED_DEP_PACKAGES) - TRIBITS_APPEND_FORWARD_DEP_PACKAGES(${PACKAGE_NAME} TEST_OPTIONAL_DEP_PACKAGES) + tribits_append_forward_dep_packages(${PACKAGE_NAME} LIB_REQUIRED_DEP_PACKAGES) + tribits_append_forward_dep_packages(${PACKAGE_NAME} LIB_OPTIONAL_DEP_PACKAGES) + tribits_append_forward_dep_packages(${PACKAGE_NAME} TEST_REQUIRED_DEP_PACKAGES) + tribits_append_forward_dep_packages(${PACKAGE_NAME} TEST_OPTIONAL_DEP_PACKAGES) -ENDMACRO() +endmacro() -# @FUNCTION: TRIBITS_SET_DEP_PACKAGES() +# @FUNCTION: tribits_set_dep_packages() # # Usage:: # -# TRIBITS_SET_DEP_PACKAGES( LIB|TEST REQUIRED|OPTIONAL) +# tribits_set_dep_packages( LIB|TEST REQUIRED|OPTIONAL) # # Function that helps to set up backward package dependency lists for a given # package given the vars read in from the macro -# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_. +# `tribits_package_define_dependencies()`_. # # Sets the upstream/backward dependency variables defined in the section `List # variables defining the package dependencies graph`_. @@ -461,87 +461,87 @@ ENDMACRO() # This also handles the several types of issues: # # * A package declaring a dependency on itself -# (`TRIBITS_ABORT_ON_SELF_DEP()`_). +# (`tribits_abort_on_self_dep()`_). # # * A missing upstream dependent package (either error out with -# `TRIBITS_ABORT_ON_MISSING_PACKAGE()`_ or allow to be missing and disable +# `tribits_abort_on_missing_package()`_ or allow to be missing and disable # this package if this is a required dependency). # # See `Function call tree for constructing package dependency graph`_ # -FUNCTION(TRIBITS_SET_DEP_PACKAGES PACKAGE_NAME LIB_OR_TEST REQUIRED_OR_OPTIONAL) - - IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) - MESSAGE("\nTRIBITS_SET_DEP_PACKAGES: ${PACKAGE_NAME} ${LIB_OR_TEST} ${REQUIRED_OR_OPTIONAL})") - ENDIF() - - SET(LIST_TYPE ${LIB_OR_TEST}_${REQUIRED_OR_OPTIONAL}_DEP_PACKAGES) - SET(PACKAGE_DEPS_LIST) - SET(SE_PACKAGE_ENABLE_VAR ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) - - FOREACH(DEP_PKG ${${LIST_TYPE}}) - IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) - PRINT_VAR(DEP_PKG) - ENDIF() - IF (${DEP_PKG} STREQUAL ${PACKAGE_NAME}) - TRIBITS_ABORT_ON_SELF_DEP("${PACKAGE_NAME}" "${LIST_TYPE}") - ENDIF() - IF (${DEP_PKG}_SOURCE_DIR) - SET(DEP_PKG_DEFINED_AND_EXISTS TRUE) - ELSE() - SET(DEP_PKG_DEFINED_AND_EXISTS FALSE) - ENDIF() - IF (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) - PRINT_VAR(DEP_PKG_DEFINED_AND_EXISTS) - ENDIF() - IF (DEP_PKG_DEFINED_AND_EXISTS) - LIST(APPEND PACKAGE_DEPS_LIST ${DEP_PKG}) - ELSE() - IF (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES +function(tribits_set_dep_packages PACKAGE_NAME LIB_OR_TEST REQUIRED_OR_OPTIONAL) + + if (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) + message("\nTRIBITS_SET_DEP_PACKAGES: ${PACKAGE_NAME} ${LIB_OR_TEST} ${REQUIRED_OR_OPTIONAL})") + endif() + + set(LIST_TYPE ${LIB_OR_TEST}_${REQUIRED_OR_OPTIONAL}_DEP_PACKAGES) + set(PACKAGE_DEPS_LIST) + set(SE_PACKAGE_ENABLE_VAR ${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}) + + foreach(DEP_PKG ${${LIST_TYPE}}) + if (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) + print_var(DEP_PKG) + endif() + if (${DEP_PKG} STREQUAL ${PACKAGE_NAME}) + tribits_abort_on_self_dep("${PACKAGE_NAME}" "${LIST_TYPE}") + endif() + if (${DEP_PKG}_SOURCE_DIR) + set(DEP_PKG_DEFINED_AND_EXISTS TRUE) + else() + set(DEP_PKG_DEFINED_AND_EXISTS FALSE) + endif() + if (TRIBITS_SET_DEP_PACKAGES_DEBUG_DUMP) + print_var(DEP_PKG_DEFINED_AND_EXISTS) + endif() + if (DEP_PKG_DEFINED_AND_EXISTS) + list(APPEND PACKAGE_DEPS_LIST ${DEP_PKG}) + else() + if (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES AND NOT ${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE ) - TRIBITS_ABORT_ON_MISSING_PACKAGE( + tribits_abort_on_missing_package( "${DEP_PKG}" "${PACKAGE_NAME}" "${PROJECT_NAME}_SE_PACKAGES") - ELSE() - IF (${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE) - IF (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES) - MESSAGE_WRAPPER("NOTE: ${DEP_PKG} is being ignored since its directory" + else() + if (${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE) + if (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES) + message_wrapper("NOTE: ${DEP_PKG} is being ignored since its directory" " is missing and ${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE =" " ${${DEP_PKG}_ALLOW_MISSING_EXTERNAL_PACKAGE}!") - ENDIF() - IF (REQUIRED_OR_OPTIONAL STREQUAL "REQUIRED") - MESSAGE_WRAPPER("NOTE: Setting ${SE_PACKAGE_ENABLE_VAR}=OFF because" + endif() + if (REQUIRED_OR_OPTIONAL STREQUAL "REQUIRED") + message_wrapper("NOTE: Setting ${SE_PACKAGE_ENABLE_VAR}=OFF because" " package ${PACKAGE_NAME} has a required dependency on missing" " package ${DEP_PKG}!") - DUAL_SCOPE_SET(${SE_PACKAGE_ENABLE_VAR} OFF) - ENDIF() - ENDIF() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE( + dual_scope_set(${SE_PACKAGE_ENABLE_VAR} OFF) + endif() + endif() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message( "\n***" "\n*** NOTE: The package ${DEP_PKG} which is a dependent package of" " ${PACKAGE_NAME} being ignored because ${DEP_PKG} is missing!" "\n***\n" ) - ENDIF() + 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. - DUAL_SCOPE_SET(${PROJECT_NAME}_ENABLE_${DEP_PKG} OFF) - DUAL_SCOPE_SET(${PACKAGE_NAME}_ENABLE_${DEP_PKG} OFF) - ENDIF() - ENDIF() - ENDFOREACH() + dual_scope_set(${PROJECT_NAME}_ENABLE_${DEP_PKG} OFF) + dual_scope_set(${PACKAGE_NAME}_ENABLE_${DEP_PKG} OFF) + endif() + endif() + endforeach() - #PRINT_VAR(PACKAGE_DEPS_LIST) + #print_var(PACKAGE_DEPS_LIST) - GLOBAL_SET(${PACKAGE_NAME}_${LIST_TYPE} ${PACKAGE_DEPS_LIST}) + global_set(${PACKAGE_NAME}_${LIST_TYPE} ${PACKAGE_DEPS_LIST}) -ENDFUNCTION() +endfunction() -# @FUNCTION: TRIBITS_APPEND_FORWARD_DEP_PACKAGES() +# @FUNCTION: tribits_append_forward_dep_packages() # -# Usage: TRIBITS_APPEND_FORWARD_DEP_PACKAGES( ) +# Usage: tribits_append_forward_dep_packages( ) # # Function that helps to set up forward package dependency lists for an # upstream package given that a downstream package declared a dependency on @@ -558,90 +558,90 @@ ENDFUNCTION() # # See `Function call tree for constructing package dependency graph`_ # -FUNCTION(TRIBITS_APPEND_FORWARD_DEP_PACKAGES PACKAGE_NAME LIST_TYPE) +function(tribits_append_forward_dep_packages PACKAGE_NAME LIST_TYPE) - SET(DEP_PKG_LIST_NAME "${PACKAGE_NAME}_${LIST_TYPE}") + set(DEP_PKG_LIST_NAME "${PACKAGE_NAME}_${LIST_TYPE}") - ASSERT_DEFINED(${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - FOREACH(DEP_PKG ${${DEP_PKG_LIST_NAME}}) - SET(FWD_DEP_PKG_LIST_NAME "${DEP_PKG}_FORWARD_${LIST_TYPE}") - IF (NOT DEFINED ${FWD_DEP_PKG_LIST_NAME}) - IF (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - TRIBITS_ABORT_ON_MISSING_PACKAGE(${DEP_PKG} ${PACKAGE_NAME} ${DEP_PKG_LIST_NAME}) - ELSE() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE( + assert_defined(${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + foreach(DEP_PKG ${${DEP_PKG_LIST_NAME}}) + set(FWD_DEP_PKG_LIST_NAME "${DEP_PKG}_FORWARD_${LIST_TYPE}") + if (NOT DEFINED ${FWD_DEP_PKG_LIST_NAME}) + if (${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + tribits_abort_on_missing_package(${DEP_PKG} ${PACKAGE_NAME} ${DEP_PKG_LIST_NAME}) + else() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message( "\n***" "\n*** NOTE: The package ${DEP_PKG} has forward dependent package" " ${PACKAGE_NAME}, but that dependency is being ignored because the package" " ${DEP_PKG} is missing!" "\n***\n" ) - ENDIF() - ENDIF() - ELSE() - SET(${FWD_DEP_PKG_LIST_NAME} ${${FWD_DEP_PKG_LIST_NAME}} ${PACKAGE_NAME} + endif() + endif() + else() + set(${FWD_DEP_PKG_LIST_NAME} ${${FWD_DEP_PKG_LIST_NAME}} ${PACKAGE_NAME} PARENT_SCOPE) - ENDIF() - ENDFOREACH() + endif() + endforeach() -ENDFUNCTION() +endfunction() -# @MACRO: TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST() +# @MACRO: tribits_set_package_regression_email_list() # # Usage:: # -# TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST() +# tribits_set_package_regression_email_list() # # Macro that sets a pacakge's regression email address # ``${PACKAGE_NAME}_REGRESSION_EMAIL_LIST`` as described in ???. # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_SET_PACAKGE_REGRESSION_EMAIL_LIST PACKAGE_NAME) +macro(tribits_set_package_regression_email_list PACKAGE_NAME) # Lower-case package name To be used with auto email naming based on base email address - STRING(TOLOWER "${PACKAGE_NAME}" LPACKAGE) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(REGRESSION_EMAIL_LIST) - ENDIF() + string(TOLOWER "${PACKAGE_NAME}" LPACKAGE) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(REGRESSION_EMAIL_LIST) + endif() - TRIBITS_GET_REPO_NAME(${${PACKAGE_NAME}_PARENT_REPOSITORY} REPOSITORY_NAME) - #PRINT_VAR(REPOSITORY_NAME) + tribits_get_repo_name(${${PACKAGE_NAME}_PARENT_REPOSITORY} REPOSITORY_NAME) + #print_var(REPOSITORY_NAME) - IF(${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + if(${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST) + set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST ${${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST}) - ELSEIF (REGRESSION_EMAIL_LIST) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST ${REGRESSION_EMAIL_LIST}) - ELSEIF (${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + elseif (REGRESSION_EMAIL_LIST) + set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST ${REGRESSION_EMAIL_LIST}) + elseif (${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) + set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "${LPACKAGE}-regression@${${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE}") - ELSEIF (${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + elseif (${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) + set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "${${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS}") - ELSEIF (${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + elseif (${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) + set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "${LPACKAGE}-regression@${${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE}") - ELSEIF (${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST + elseif (${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) + set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "${${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS}") - ELSE() - SET(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "") - ENDIF() + else() + set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "") + endif() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST) + endif() -ENDMACRO() +endmacro() -# @FUNCTION: TRIBITS_ABORT_ON_MISSING_PACKAGE() +# @FUNCTION: tribits_abort_on_missing_package() # # Usage:: # -# TRIBITS_ABORT_ON_MISSING_PACKAGE( ) +# tribits_abort_on_missing_package( ) # # Function that creates error message about missing/misspelled package. This # error message also suggests that the package might be defining an upstream @@ -649,37 +649,37 @@ ENDMACRO() # # See `Function call tree for constructing package dependency graph`_ # -FUNCTION(TRIBITS_ABORT_ON_MISSING_PACKAGE DEP_PKG PACKAGE_NAME DEP_PKG_LIST_NAME) - MULTILINE_SET(ERRMSG +function(tribits_abort_on_missing_package DEP_PKG PACKAGE_NAME DEP_PKG_LIST_NAME) + multiline_set(ERRMSG "Error, the package '${DEP_PKG}' is listed as a dependency of the package" " '${PACKAGE_NAME}' is in the list '${DEP_PKG_LIST_NAME}' but the package" " '${DEP_PKG}' is either not defined or is listed later in the package order." " This may also be an attempt to create a circular dependency between" " the packages '${DEP_PKG}' and '${PACKAGE_NAME}' (which is not allowed)." " Check the spelling of '${DEP_PKG}' or see how it is listed in" - " a call to TRIBITS_REPOSITORY_DEFINE_PACKAGES() in relation to" + " a call to tribits_repository_define_packages() in relation to" " '${PACKAGE_NAME}'.") - MESSAGE(FATAL_ERROR ${ERRMSG}) -ENDFUNCTION() + message(FATAL_ERROR ${ERRMSG}) +endfunction() -# @FUNCTION: TRIBITS_ABORT_ON_SELF_DEP() +# @FUNCTION: tribits_abort_on_self_dep() # # Usage:: # -# TRIBITS_ABORT_ON_SELF_DEP( ) +# tribits_abort_on_self_dep( ) # # Prints a fatal error message for an attempt for a self dependency # declaration and which list it comes from. # # See `Function call tree for constructing package dependency graph`_ # -FUNCTION(TRIBITS_ABORT_ON_SELF_DEP PACKAGE_NAME DEP_PKG_LIST_NAME) - MULTILINE_SET(ERRMSG +function(tribits_abort_on_self_dep PACKAGE_NAME DEP_PKG_LIST_NAME) + multiline_set(ERRMSG "Error, the package '${PACKAGE_NAME}' is listed as a dependency of itself" " in the list '${DEP_PKG_LIST_NAME}'!") - MESSAGE(FATAL_ERROR ${ERRMSG}) -ENDFUNCTION() + message(FATAL_ERROR ${ERRMSG}) +endfunction() ################################################################################ @@ -687,18 +687,18 @@ ENDFUNCTION() ################################################################################ -# @MACRO: TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS() +# @MACRO: tribits_parse_subpackages_append_se_packages_add_options() # # Usage:: # -# TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS() +# tribits_parse_subpackages_append_se_packages_add_options() # # Macro that parses the read-in variable # ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` set by the macro -# `TRIBITS_PACKAGE_DEFINE_DEPENDENCIES()`_ , add subpackages to the list of +# `tribits_package_define_dependencies()`_ , add subpackages to the list of # defined packages, and define user cache var options for those subpackages. # -# This sets the list varaibles for the parent package ````:: +# This sets the list variables for the parent package ````:: # # _SUBPACKAGES # _SUBPACKAGE_DIRS @@ -711,154 +711,154 @@ ENDFUNCTION() # _PARENT_PACKAGE # _PARENT_REPOSITORY # -# And it appends for each subpackage to varaible:: +# And it appends for each subpackage to variable:: # # ${PROJECT_NAME}_SE_PACKAGES (old) # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS +macro(tribits_parse_subpackages_append_se_packages_add_options PACKAGE_NAME ) - #MESSAGE("TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS: ${PACKAGE_NAME}") + #message("TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS: ${PACKAGE_NAME}") # Structure of SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS - SET(SPDC_SP_NAME_OFFSET 0) - SET(SPDC_SP_DIR_OFFSET 1) - SET(SPDC_SP_CLASSIFICATION_OFFSET 2) - SET(SPDC_SP_OPTREQ_OFFSET 3) - SET(SPDC_NUM_FIELDS 4) + set(SPDC_SP_NAME_OFFSET 0) + set(SPDC_SP_DIR_OFFSET 1) + set(SPDC_SP_CLASSIFICATION_OFFSET 2) + set(SPDC_SP_OPTREQ_OFFSET 3) + set(SPDC_NUM_FIELDS 4) - SET(${PACKAGE_NAME}_SUBPACKAGES "") - SET(${PACKAGE_NAME}_SUBPACKAGE_DIRS "") - SET(${PACKAGE_NAME}_SUBPACKAGE_OPTREQ "") + set(${PACKAGE_NAME}_SUBPACKAGES "") + set(${PACKAGE_NAME}_SUBPACKAGE_DIRS "") + set(${PACKAGE_NAME}_SUBPACKAGE_OPTREQ "") - IF (SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) + if (SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) - LIST(LENGTH SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS SPDC_TOTAL_LENGTH) - MATH(EXPR NUM_SUBPACKAGES "${SPDC_TOTAL_LENGTH}/${SPDC_NUM_FIELDS}") - MATH(EXPR SUBPACKAGES_LAST_IDX "${NUM_SUBPACKAGES}-1") + list(LENGTH SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS SPDC_TOTAL_LENGTH) + math(EXPR NUM_SUBPACKAGES "${SPDC_TOTAL_LENGTH}/${SPDC_NUM_FIELDS}") + math(EXPR SUBPACKAGES_LAST_IDX "${NUM_SUBPACKAGES}-1") - FOREACH(SUBPACKAGE_IDX RANGE ${SUBPACKAGES_LAST_IDX}) + foreach(SUBPACKAGE_IDX RANGE ${SUBPACKAGES_LAST_IDX}) - #MESSAGE("") - #PRINT_VAR(SUBPACKAGE_IDX) + #message("") + #print_var(SUBPACKAGE_IDX) # SUBPACKAGE_NAME - MATH(EXPR SUBPACKAGE_NAME_IDX + math(EXPR SUBPACKAGE_NAME_IDX "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_NAME_OFFSET}") - LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_NAME_IDX} + list(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_NAME_IDX} SUBPACKAGE_NAME ) - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) + set(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) # SUBPACKAGE_DIR - MATH(EXPR SUBPACKAGE_DIR_IDX + math(EXPR SUBPACKAGE_DIR_IDX "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_DIR_OFFSET}") - LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_DIR_IDX} + list(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_DIR_IDX} SUBPACKAGE_DIR ) # SUBPACKAGE_CLASSIFICATION - MATH(EXPR SUBPACKAGE_CLASSIFICATION_IDX + math(EXPR SUBPACKAGE_CLASSIFICATION_IDX "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_CLASSIFICATION_OFFSET}") - LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_CLASSIFICATION_IDX} + list(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_CLASSIFICATION_IDX} SUBPACKAGE_CLASSIFICATION ) # ToDo: Parse out TESTGROUP and MATURITYLEVEL (Trilinos #6042) - SET(SUBPACKAGE_TESTGROUP ${SUBPACKAGE_CLASSIFICATION}) + set(SUBPACKAGE_TESTGROUP ${SUBPACKAGE_CLASSIFICATION}) - TRIBITS_UPDATE_PS_PT_SS_ST(Subpackage ${SUBPACKAGE_FULLNAME} SUBPACKAGE_TESTGROUP) + tribits_update_ps_pt_ss_st(Subpackage ${SUBPACKAGE_FULLNAME} SUBPACKAGE_TESTGROUP) # SUBPACKAGE_OPTREQ - MATH(EXPR SUBPACKAGE_OPTREQ_IDX + math(EXPR SUBPACKAGE_OPTREQ_IDX "${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_OPTREQ_OFFSET}") - LIST(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_OPTREQ_IDX} + list(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${SUBPACKAGE_OPTREQ_IDX} SUBPACKAGE_OPTREQ ) # Determine if this subpackage exists - SET(SUBPACKAGE_FULL_SOURCE_DIR + set(SUBPACKAGE_FULL_SOURCE_DIR ${PROJECT_SOURCE_DIR}/${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}) - IF (EXISTS ${SUBPACKAGE_FULL_SOURCE_DIR}) - SET(SUBPACKAGE_EXISTS TRUE) - ELSE() - SET(SUBPACKAGE_EXISTS FALSE) - ENDIF() - - IF (NOT SUBPACKAGE_EXISTS AND ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - MESSAGE(SEND_ERROR "ERROR: Subpackage dir '${SUBPACKAGE_FULL_SOURCE_DIR}'" + if (EXISTS ${SUBPACKAGE_FULL_SOURCE_DIR}) + set(SUBPACKAGE_EXISTS TRUE) + else() + set(SUBPACKAGE_EXISTS FALSE) + endif() + + if (NOT SUBPACKAGE_EXISTS AND ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + message(SEND_ERROR "ERROR: Subpackage dir '${SUBPACKAGE_FULL_SOURCE_DIR}'" " is missing!") - ENDIF() + endif() # Append to lists and global variables - IF (SUBPACKAGE_EXISTS) + if (SUBPACKAGE_EXISTS) - LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGES ${SUBPACKAGE_NAME}) - LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_DIR}) - LIST(APPEND ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_OPTREQ}) - LIST(APPEND ${PROJECT_NAME}_SE_PACKAGES ${SUBPACKAGE_FULLNAME}) - SET(${SUBPACKAGE_FULLNAME}_SOURCE_DIR "${SUBPACKAGE_FULL_SOURCE_DIR}") - SET(${SUBPACKAGE_FULLNAME}_REL_SOURCE_DIR + list(APPEND ${PACKAGE_NAME}_SUBPACKAGES ${SUBPACKAGE_NAME}) + list(APPEND ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_DIR}) + list(APPEND ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_OPTREQ}) + list(APPEND ${PROJECT_NAME}_SE_PACKAGES ${SUBPACKAGE_FULLNAME}) + set(${SUBPACKAGE_FULLNAME}_SOURCE_DIR "${SUBPACKAGE_FULL_SOURCE_DIR}") + set(${SUBPACKAGE_FULLNAME}_REL_SOURCE_DIR "${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}") - SET(${SUBPACKAGE_FULLNAME}_PARENT_PACKAGE ${PACKAGE_NAME}) - SET(${SUBPACKAGE_FULLNAME}_PARENT_REPOSITORY + set(${SUBPACKAGE_FULLNAME}_PARENT_PACKAGE ${PACKAGE_NAME}) + set(${SUBPACKAGE_FULLNAME}_PARENT_REPOSITORY ${${PACKAGE_NAME}_PARENT_REPOSITORY}) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${SUBPACKAGE_FULLNAME}_PARENT_PACKAGE) - PRINT_VAR(${SUBPACKAGE_FULLNAME}_PARENT_REPOSITORY) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${SUBPACKAGE_FULLNAME}_PARENT_PACKAGE) + print_var(${SUBPACKAGE_FULLNAME}_PARENT_REPOSITORY) + endif() # Set up the input options for this subpackage - TRIBITS_INSERT_STANDARD_PACKAGE_OPTIONS(${SUBPACKAGE_FULLNAME} + tribits_insert_standard_package_options(${SUBPACKAGE_FULLNAME} ${SUBPACKAGE_TESTGROUP}) - ENDIF() + endif() - ENDFOREACH() + endforeach() - ENDIF() + endif() - #PRINT_VAR(${PACKAGE_NAME}_SUBPACKAGES) - #PRINT_VAR(${PACKAGE_NAME}_SUBPACKAGE_OPTREQ) + #print_var(${PACKAGE_NAME}_SUBPACKAGES) + #print_var(${PACKAGE_NAME}_SUBPACKAGE_OPTREQ) -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH() +# @MACRO: tribits_read_package_subpackage_deps_files_add_to_graph() # # Usage:: # -# TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH() +# tribits_read_package_subpackage_deps_files_add_to_graph() # # Read in subpackages dependencies files and add to dependencies graph # variables. # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH PACKAGE_NAME) +macro(tribits_read_package_subpackage_deps_files_add_to_graph PACKAGE_NAME) - #MESSAGE("TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH: ${PACKAGE_NAME}") + #message("TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH: ${PACKAGE_NAME}") - #PRINT_VAR(${PROJECT_NAME}_SE_PACKAGES) + #print_var(${PROJECT_NAME}_SE_PACKAGES) - SET(SUBPACKAGE_IDX 0) - FOREACH(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) - LIST(GET ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_IDX} SUBPACKAGE_DIR) - TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH(${TRIBITS_PACKAGE} + set(SUBPACKAGE_IDX 0) + foreach(TRIBITS_SUBPACKAGE ${${PACKAGE_NAME}_SUBPACKAGES}) + list(GET ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_IDX} SUBPACKAGE_DIR) + tribits_read_subpackage_deps_file_add_to_graph(${TRIBITS_PACKAGE} ${TRIBITS_SUBPACKAGE} ${SUBPACKAGE_DIR}) - MATH(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") - ENDFOREACH() + math(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") + endforeach() -ENDMACRO() +endmacro() -# @MACRO: TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH() +# @MACRO: tribits_read_subpackage_deps_file_add_to_graph() # # Usage:: # -# TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH( +# tribits_read_subpackage_deps_file_add_to_graph( # ) # # Macro that reads in a single subpackage dependencies file @@ -867,56 +867,56 @@ ENDMACRO() # # See `Function call tree for constructing package dependency graph`_ # -MACRO(TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH PACKAGE_NAME +macro(tribits_read_subpackage_deps_file_add_to_graph PACKAGE_NAME SUBPACKAGE_NAME SUBPACKAGE_DIR ) - #MESSAGE("TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH: ${PACKAGE_NAME} ${SUBPACKAGE_NAME} ${SUBPACKAGE_DIR}") + #message("TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH: ${PACKAGE_NAME} ${SUBPACKAGE_NAME} ${SUBPACKAGE_DIR}") - SET(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) + set(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) # - # A) Get ready to read in the contents of this this subpakages's + # A) Get ready to read in the contents of this this subpackage's # Dependencies.cmake file # - TRIBITS_PREP_TO_READ_DEPENDENCIES(${SUBPACKAGE_FULLNAME}) + tribits_prep_to_read_dependencies(${SUBPACKAGE_FULLNAME}) # NOTE: Subpackages use the regression email list from the parent package. # NOTE: Subpackages are not allowed to have subpackages! - SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) + set(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) # # B) Read in this subpackage's Dependencies file # - SET(SUBPACKAGE_FULL_DIR "${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}") + set(SUBPACKAGE_FULL_DIR "${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}") - SET(SUBPACKAGE_ABS_DIR "${PROJECT_SOURCE_DIR}/${SUBPACKAGE_FULL_DIR}") - SET(SUBPAKCAGE_DEPENDENCIES_FILE "${SUBPACKAGE_ABS_DIR}/cmake/Dependencies.cmake") + set(SUBPACKAGE_ABS_DIR "${PROJECT_SOURCE_DIR}/${SUBPACKAGE_FULL_DIR}") + set(SUBPAKCAGE_DEPENDENCIES_FILE "${SUBPACKAGE_ABS_DIR}/cmake/Dependencies.cmake") - IF (EXISTS ${SUBPAKCAGE_DEPENDENCIES_FILE}) - SET(SUBPACKAGE_EXISTS TRUE) - ELSE() - SET(SUBPACKAGE_EXISTS FALSE) - ENDIF() + if (EXISTS ${SUBPAKCAGE_DEPENDENCIES_FILE}) + set(SUBPACKAGE_EXISTS TRUE) + else() + set(SUBPACKAGE_EXISTS FALSE) + endif() - IF (SUBPACKAGE_EXISTS OR ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) + if (SUBPACKAGE_EXISTS OR ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES) - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE INCLUDE "${SUBPAKCAGE_DEPENDENCIES_FILE}") - INCLUDE(${SUBPAKCAGE_DEPENDENCIES_FILE}) + tribits_trace_file_processing(PACKAGE INCLUDE "${SUBPAKCAGE_DEPENDENCIES_FILE}") + include(${SUBPAKCAGE_DEPENDENCIES_FILE}) - TRIBITS_ASSERT_READ_DEPENDENCY_VARS(${SUBPACKAGE_FULLNAME}) + tribits_assert_read_dependency_vars(${SUBPACKAGE_FULLNAME}) - TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS(${SUBPACKAGE_FULLNAME}) + tribits_process_package_dependencies_lists(${SUBPACKAGE_FULLNAME}) - SET(${SUBPACKAGE_FULLNAME}_REGRESSION_EMAIL_LIST + set(${SUBPACKAGE_FULLNAME}_REGRESSION_EMAIL_LIST ${${PACKAGE_NAME}_REGRESSION_EMAIL_LIST}) - ENDIF() + endif() -ENDMACRO() +endmacro() # @@ -924,20 +924,20 @@ ENDMACRO() # -# Function that sets a varaible to DECLARED-UNDEFINED +# Function that sets a variable to DECLARED-UNDEFINED # -FUNCTION(TRIBITS_DECLARE_UNDEFINED VAR_NAME) - SET(${VAR_NAME} DECLARED-UNDEFINED PARENT_SCOPE) -ENDFUNCTION() +function(tribits_declare_undefined VAR_NAME) + set(${VAR_NAME} DECLARED-UNDEFINED PARENT_SCOPE) +endfunction() # Function that asserts that a package dependency variable is defined # correctly # -FUNCTION(TRIBITS_ASSERT_DEFINED_PACKAGE_VAR PACKAGE_VAR PACKAGE_NAME) - IF (${PACKAGE_VAR} STREQUAL DECLARED-UNDEFINED) - MESSAGE(FATAL_ERROR +function(tribits_assert_defined_package_var PACKAGE_VAR PACKAGE_NAME) + if (${PACKAGE_VAR} STREQUAL DECLARED-UNDEFINED) + message(FATAL_ERROR "Error, the package variable ${PACKAGE_VAR} was not defined correctly for package ${PACKAGE_NAME}!" ) - ENDIF() -ENDFUNCTION() + endif() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsReportInvalidTribitsUsage.cmake b/cmake/tribits/core/package_arch/TribitsReportInvalidTribitsUsage.cmake index f4bdaaeb76c1..4db279fd387e 100644 --- a/cmake/tribits/core/package_arch/TribitsReportInvalidTribitsUsage.cmake +++ b/cmake/tribits/core/package_arch/TribitsReportInvalidTribitsUsage.cmake @@ -37,51 +37,51 @@ # ************************************************************************ # @HEADER -IF (__TribitsReportInvalidTribitsUsage_INCLUDED__) - RETURN() -ELSE() - SET(__TribitsReportInvalidTribitsUsage_INCLUDED__ TRUE) -ENDIF() +if (__TribitsReportInvalidTribitsUsage_INCLUDED__) + return() +else() + set(__TribitsReportInvalidTribitsUsage_INCLUDED__ TRUE) +endif() -INCLUDE(MessageWrapper) +include(MessageWrapper) # Called to report incorrect usage # # Usage: # -# TRIBITS_REPORT_INVALID_TRIBITS_USAGE("" "" ...) +# tribits_report_invalid_tribits_usage("" "" ...) # # Depending on the value of ${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE, this # function will: # -# * FATAL_ERROR: Calls MESSAGE(FATAL_ERROR "") -# * SEND_ERROR: Calls MESSAGE(SEND_ERROR "") -# * WARNING: Calls MESSAGE(WARNING "") -# * IGNORE: Does not call MESSAGE() at all and is silent +# * FATAL_ERROR: Calls message(FATAL_ERROR "") +# * SEND_ERROR: Calls message(SEND_ERROR "") +# * WARNING: Calls message(WARNING "") +# * IGNORE: Does not call message() at all and is silent # # If '${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE}' is empty on call, then # `FATAL_ERROR` will be used. # -FUNCTION(TRIBITS_REPORT_INVALID_TRIBITS_USAGE) - IF ("${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE}" STREQUAL "") - SET(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE FATAL_ERROR) - ENDIF() - SET(PRINT_ERR_MSG) - IF (${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE STREQUAL "FATAL_ERROR") - SET(PRINT_ERR_MSG FATAL_ERROR) - ELSEIF (${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE STREQUAL "SEND_ERROR") - SET(PRINT_ERR_MSG SEND_ERROR) - ELSEIF (${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE STREQUAL "WARNING") - SET(PRINT_ERR_MSG WARNING) - ELSEIF (${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE STREQUAL "IGNORE") - SET(PRINT_ERR_MSG) - ELSE() - MESSAGE_WRAPPER(FATAL_ERROR "Error, invalid value for" +function(tribits_report_invalid_tribits_usage) + if ("${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE}" STREQUAL "") + set(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE FATAL_ERROR) + endif() + set(PRINT_ERR_MSG) + if (${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE STREQUAL "FATAL_ERROR") + set(PRINT_ERR_MSG FATAL_ERROR) + elseif (${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE STREQUAL "SEND_ERROR") + set(PRINT_ERR_MSG SEND_ERROR) + elseif (${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE STREQUAL "WARNING") + set(PRINT_ERR_MSG WARNING) + elseif (${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE STREQUAL "IGNORE") + set(PRINT_ERR_MSG) + else() + message_wrapper(FATAL_ERROR "Error, invalid value for" " ${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE =" " '${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE}'!" " Value values include 'FATAL_ERROR', 'SEND_ERROR', 'WARNING', and 'IGNORE'!") - ENDIF() - IF (PRINT_ERR_MSG) - MESSAGE_WRAPPER(${PRINT_ERR_MSG} ${ARGN}) - ENDIF() -ENDFUNCTION() + endif() + if (PRINT_ERR_MSG) + message_wrapper(${PRINT_ERR_MSG} ${ARGN}) + endif() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsSetupBasicCompileLinkFlags.cmake b/cmake/tribits/core/package_arch/TribitsSetupBasicCompileLinkFlags.cmake index c02025b2cf09..ed61cf2ae41b 100644 --- a/cmake/tribits/core/package_arch/TribitsSetupBasicCompileLinkFlags.cmake +++ b/cmake/tribits/core/package_arch/TribitsSetupBasicCompileLinkFlags.cmake @@ -37,95 +37,95 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsDefineStandardCompileVars) -INCLUDE(DualScopePrependCmndlineArgs) -INCLUDE(PrintVar) +include(TribitsDefineStandardCompileVars) +include(DualScopePrependCmndlineArgs) +include(PrintVar) # # Helper macros # -MACRO(TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS LANG BUILDTYPE) +macro(tribits_set_language_buildtype_flags LANG BUILDTYPE) - #PRINT_VAR(CMAKE_${LANG}_FLAGS_${BUILDTYPE}) - #PRINT_VAR(GENERAL_${BUILDTYPE}_FLAGS) + #print_var(CMAKE_${LANG}_FLAGS_${BUILDTYPE}) + #print_var(GENERAL_${BUILDTYPE}_FLAGS) # Set the default CMAKE_${LANG}_FLAGS_${BUILDTYPE} to empty to override the # default that CMake gives! We want to define these for ourselves. - SET(CMAKE_${LANG}_FLAGS_${BUILDTYPE} "") + set(CMAKE_${LANG}_FLAGS_${BUILDTYPE} "") - IF (${LANG}_${BUILDTYPE}_FLAGS) - DUAL_SCOPE_PREPEND_CMNDLINE_ARGS(CMAKE_${LANG}_FLAGS_${BUILDTYPE} + if (${LANG}_${BUILDTYPE}_FLAGS) + dual_scope_prepend_cmndline_args(CMAKE_${LANG}_FLAGS_${BUILDTYPE} "${${LANG}_${BUILDTYPE}_FLAGS}") - ENDIF() - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Adding ${LANG} ${BUILDTYPE} flags" + endif() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Adding ${LANG} ${BUILDTYPE} flags" " \"${${LANG}_${BUILDTYPE}_FLAGS}\"") - PRINT_VAR(CMAKE_${LANG}_FLAGS_${BUILDTYPE}) - ENDIF() + print_var(CMAKE_${LANG}_FLAGS_${BUILDTYPE}) + endif() -ENDMACRO() +endmacro() -MACRO(TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS_OVERRIDE LANG BUILDTYPE) +macro(tribits_set_language_buildtype_flags_override LANG BUILDTYPE) - SET(CMAKE_${LANG}_FLAGS_${BUILDTYPE}_OVERRIDE "" + set(CMAKE_${LANG}_FLAGS_${BUILDTYPE}_OVERRIDE "" CACHE STRING "If set to non-empty, will override CMAKE_${LANG}_FLAGS_${BUILDTYPE}") - IF (CMAKE_${LANG}_FLAGS_${BUILDTYPE}_OVERRIDE) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE( + if (CMAKE_${LANG}_FLAGS_${BUILDTYPE}_OVERRIDE) + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message( "-- Overriding CMAKE_${LANG}_FLAGS_${BUILDTYPE}:\n" "-- from\n" "-- ${CMAKE_${LANG}_FLAGS_${BUILDTYPE}}") - ENDIF() - DUAL_SCOPE_SET(CMAKE_${LANG}_FLAGS_${BUILDTYPE} + endif() + dual_scope_set(CMAKE_${LANG}_FLAGS_${BUILDTYPE} ${CMAKE_${LANG}_FLAGS_${BUILDTYPE}_OVERRIDE}) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE( + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message( "-- to\n" "-- ${CMAKE_${LANG}_FLAGS_${BUILDTYPE}}") - ENDIF() - ENDIF() + endif() + endif() # NOTE: Above, we can't just let users set CMAKE_${LANG}_FLAGS_${BUILDTYPE} - # in the cache because CMake overrides it. We have ot add this override + # in the cache because CMake overrides it. We have to add this override # option to allow them to override it. -ENDMACRO() +endmacro() -MACRO(TRIBITS_SET_LANGUAGE_ALL_BUILDTYPES_FLAGS_OVERRIDE LANG) +macro(tribits_set_language_all_buildtypes_flags_override LANG) - FOREACH(BUILDTYPE ${CMAKE_BUILD_TYPES_LIST}) - TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS_OVERRIDE(${LANG} ${BUILDTYPE}) - ENDFOREACH() + foreach(BUILDTYPE ${CMAKE_BUILD_TYPES_LIST}) + tribits_set_language_buildtype_flags_override(${LANG} ${BUILDTYPE}) + endforeach() -ENDMACRO() +endmacro() -MACRO(TRIBITS_SET_LANGUAGE_GENERAL_FLAGS LANG) +macro(tribits_set_language_general_flags LANG) - DUAL_SCOPE_PREPEND_CMNDLINE_ARGS(CMAKE_${LANG}_FLAGS "${GENERAL_BUILD_FLAGS}") - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Adding general ${LANG} flags \"${${GENERAL_BUILD_FLAGS}}\"") - PRINT_VAR(CMAKE_${LANG}_FLAGS) - ENDIF() + dual_scope_prepend_cmndline_args(CMAKE_${LANG}_FLAGS "${GENERAL_BUILD_FLAGS}") + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Adding general ${LANG} flags \"${${GENERAL_BUILD_FLAGS}}\"") + print_var(CMAKE_${LANG}_FLAGS) + endif() -ENDMACRO() +endmacro() -MACRO(TRIBITS_SET_LANGUAGE_COVERAGE_FLAGS LANG) +macro(tribits_set_language_coverage_flags LANG) - DUAL_SCOPE_PREPEND_CMNDLINE_ARGS(CMAKE_${LANG}_FLAGS + dual_scope_prepend_cmndline_args(CMAKE_${LANG}_FLAGS "${COVERAGE_OPTIONS}") - IF(COVERAGE_OPTIONS AND ${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Adding coverage ${LANG} flags \"${COVERAGE_OPTIONS}\"") - PRINT_VAR(CMAKE_${LANG}_FLAGS) - ENDIF() + if(COVERAGE_OPTIONS AND ${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Adding coverage ${LANG} flags \"${COVERAGE_OPTIONS}\"") + print_var(CMAKE_${LANG}_FLAGS) + endif() -ENDMACRO() +endmacro() # @@ -140,75 +140,75 @@ ENDMACRO() # executables, etc. # -FUNCTION(TRIBITS_SETUP_BASIC_COMPILE_LINK_FLAGS) +function(tribits_setup_basic_compile_link_flags) # # Setup and general flags # - TRIBITS_DEFINE_STANDARD_COMPILE_FLAGS_VARS(FALSE) + tribits_define_standard_compile_flags_vars(FALSE) # - # Set up coverge testing options + # Set up coverage testing options # - IF (${PROJECT_NAME}_ENABLE_COVERAGE_TESTING) - SET(COVERAGE_OPTIONS "-fprofile-arcs -ftest-coverage") - ELSE() - SET(COVERAGE_OPTIONS "") - ENDIF() + if (${PROJECT_NAME}_ENABLE_COVERAGE_TESTING) + set(COVERAGE_OPTIONS "-fprofile-arcs -ftest-coverage") + else() + set(COVERAGE_OPTIONS "") + endif() # # C compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_C CMAKE_C_COMPILER_ID) - IF (${PROJECT_NAME}_ENABLE_C AND CMAKE_C_COMPILER_ID STREQUAL "GNU") - TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS(C DEBUG) - TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS(C RELEASE) - TRIBITS_SET_LANGUAGE_GENERAL_FLAGS(C) - TRIBITS_SET_LANGUAGE_COVERAGE_FLAGS(C) - ENDIF() - TRIBITS_SET_LANGUAGE_ALL_BUILDTYPES_FLAGS_OVERRIDE(C) + assert_defined(${PROJECT_NAME}_ENABLE_C CMAKE_C_COMPILER_ID) + if (${PROJECT_NAME}_ENABLE_C AND CMAKE_C_COMPILER_ID STREQUAL "GNU") + tribits_set_language_buildtype_flags(C DEBUG) + tribits_set_language_buildtype_flags(C RELEASE) + tribits_set_language_general_flags(C) + tribits_set_language_coverage_flags(C) + endif() + tribits_set_language_all_buildtypes_flags_override(C) # # C++ compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_CXX CMAKE_CXX_COMPILER_ID) - IF (${PROJECT_NAME}_ENABLE_CXX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS(CXX DEBUG) - TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS(CXX RELEASE) - TRIBITS_SET_LANGUAGE_GENERAL_FLAGS(CXX) - TRIBITS_SET_LANGUAGE_COVERAGE_FLAGS(CXX) - ENDIF() - TRIBITS_SET_LANGUAGE_ALL_BUILDTYPES_FLAGS_OVERRIDE(CXX) + assert_defined(${PROJECT_NAME}_ENABLE_CXX CMAKE_CXX_COMPILER_ID) + if (${PROJECT_NAME}_ENABLE_CXX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + tribits_set_language_buildtype_flags(CXX DEBUG) + tribits_set_language_buildtype_flags(CXX RELEASE) + tribits_set_language_general_flags(CXX) + tribits_set_language_coverage_flags(CXX) + endif() + tribits_set_language_all_buildtypes_flags_override(CXX) # # Fortran compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_Fortran) - IF (${PROJECT_NAME}_ENABLE_Fortran AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS(Fortran DEBUG) - TRIBITS_SET_LANGUAGE_BUILDTYPE_FLAGS(Fortran RELEASE) - TRIBITS_SET_LANGUAGE_GENERAL_FLAGS(Fortran) - TRIBITS_SET_LANGUAGE_COVERAGE_FLAGS(Fortran) - ENDIF() - TRIBITS_SET_LANGUAGE_ALL_BUILDTYPES_FLAGS_OVERRIDE(Fortran) + assert_defined(${PROJECT_NAME}_ENABLE_Fortran) + if (${PROJECT_NAME}_ENABLE_Fortran AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + tribits_set_language_buildtype_flags(Fortran DEBUG) + tribits_set_language_buildtype_flags(Fortran RELEASE) + tribits_set_language_general_flags(Fortran) + tribits_set_language_coverage_flags(Fortran) + endif() + tribits_set_language_all_buildtypes_flags_override(Fortran) # # Linker options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_COVERAGE_TESTING COVERAGE_OPTIONS) - IF (${PROJECT_NAME}_ENABLE_COVERAGE_TESTING AND COVERAGE_OPTIONS) - DUAL_SCOPE_PREPEND_CMNDLINE_ARGS(CMAKE_EXE_LINKER_FLAGS + assert_defined(${PROJECT_NAME}_ENABLE_COVERAGE_TESTING COVERAGE_OPTIONS) + if (${PROJECT_NAME}_ENABLE_COVERAGE_TESTING AND COVERAGE_OPTIONS) + dual_scope_prepend_cmndline_args(CMAKE_EXE_LINKER_FLAGS "${COVERAGE_OPTIONS} ${CMAKE_EXE_LINKER_FLAGS}") - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Adding coverage linker flags flags \"${COVERAGE_OPTIONS}\"") - PRINT_VAR(CMAKE_EXE_LINKER_FLAGS) - ENDIF() - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Adding coverage linker flags flags \"${COVERAGE_OPTIONS}\"") + print_var(CMAKE_EXE_LINKER_FLAGS) + endif() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsSetupMPI.cmake b/cmake/tribits/core/package_arch/TribitsSetupMPI.cmake index 9bb281fed8d4..0d5e3f5e0bc1 100644 --- a/cmake/tribits/core/package_arch/TribitsSetupMPI.cmake +++ b/cmake/tribits/core/package_arch/TribitsSetupMPI.cmake @@ -37,79 +37,79 @@ # ************************************************************************ # @HEADER -INCLUDE(AdvancedSet) -INCLUDE(MultilineSet) -INCLUDE(PrintNonemptyVar) -INCLUDE(FindProgramPlus) - - -FUNCTION(TRIBITS_EXTRACT_BASE_DIR FILE_PATH BASE_DIR) - IF (NOT ${BASE_DIR}) - GET_FILENAME_COMPONENT( ${BASE_DIR} ${FILE_PATH} PATH ) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_VAR(${BASE_DIR}) - ENDIF() - SET(${BASE_DIR} ${${BASE_DIR}} PARENT_SCOPE) - ENDIF() -ENDFUNCTION() - - -MACRO(TRIBITS_FIND_MPI_COMPILER LANG) - IF (${PROJECT_NAME}_ENABLE_${LANG}) - IF (CMAKE_${LANG}_COMPILER) - MESSAGE(STATUS "Leaving current CMAKE_${LANG}_COMPILER=" +include(AdvancedSet) +include(MultilineSet) +include(PrintNonemptyVar) +include(FindProgramPlus) + + +function(tribits_extract_base_dir FILE_PATH BASE_DIR) + if (NOT ${BASE_DIR}) + get_filename_component( ${BASE_DIR} ${FILE_PATH} PATH ) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_var(${BASE_DIR}) + endif() + set(${BASE_DIR} ${${BASE_DIR}} PARENT_SCOPE) + endif() +endfunction() + + +macro(tribits_find_mpi_compiler LANG) + if (${PROJECT_NAME}_ENABLE_${LANG}) + if (CMAKE_${LANG}_COMPILER) + message(STATUS "Leaving current CMAKE_${LANG}_COMPILER=" "${CMAKE_${LANG}_COMPILER} since it is already set!") - ELSE() - FIND_PROGRAM_PLUS( + else() + find_program_plus( MPI_${LANG}_COMPILER NAMES ${ARGN} PATHS ${MPI_BIN_DIR_PATHS} ) - TRIBITS_EXTRACT_BASE_DIR(${MPI_${LANG}_COMPILER} MPI_BASE_DIR) - MESSAGE(STATUS "Setting CMAKE_${LANG}_COMPILER=\${MPI_${LANG}_COMPILER}") - SET(CMAKE_${LANG}_COMPILER "${MPI_${LANG}_COMPILER}" + tribits_extract_base_dir(${MPI_${LANG}_COMPILER} MPI_BASE_DIR) + message(STATUS "Setting CMAKE_${LANG}_COMPILER=\${MPI_${LANG}_COMPILER}") + set(CMAKE_${LANG}_COMPILER "${MPI_${LANG}_COMPILER}" CACHE FILEPATH "${LANG} compiler overridden by MPI_${LANG}_COMPILER") - PRINT_VAR(CMAKE_${LANG}_COMPILER) - ENDIF() - ENDIF() -ENDMACRO() + print_var(CMAKE_${LANG}_COMPILER) + endif() + endif() +endmacro() -FUNCTION(TRIBITS_SETUP_MPI) +function(tribits_setup_mpi) # # A) Get the directory paths # - MULTILINE_SET( DOC + multiline_set( DOC "Base directory for the MPI implementation under which" " the bin, include, and lib directories are found" ) - ADVANCED_SET( MPI_BASE_DIR "" CACHE PATH ${DOC} ) - PRINT_NONEMPTY_VAR(MPI_BASE_DIR) - - IF (MPI_BASE_DIR) - SET(MPI_BIN_DIR_DEFAULT "${MPI_BASE_DIR}/bin") - ELSE() - SET(MPI_BIN_DIR_DEFAULT "") - ENDIF() - MULTILINE_SET( DOC + advanced_set( MPI_BASE_DIR "" CACHE PATH ${DOC} ) + print_nonempty_var(MPI_BASE_DIR) + + if (MPI_BASE_DIR) + set(MPI_BIN_DIR_DEFAULT "${MPI_BASE_DIR}/bin") + else() + set(MPI_BIN_DIR_DEFAULT "") + endif() + multiline_set( DOC "Path to the bin directory where the MPI compiler" " and runtime executables are found" ) - ADVANCED_SET( MPI_BIN_DIR ${MPI_BIN_DIR_DEFAULT} CACHE PATH ${DOC} ) - PRINT_NONEMPTY_VAR(MPI_BIN_DIR) + advanced_set( MPI_BIN_DIR ${MPI_BIN_DIR_DEFAULT} CACHE PATH ${DOC} ) + print_nonempty_var(MPI_BIN_DIR) - MULTILINE_SET( DOC + multiline_set( DOC "If set to 'ON', then the MPI compiler wrappers will be used." " Set MPI_[C,CXX,Fortran]_COMPILER:FILEPATH=XXX to set compilers." ) - ADVANCED_SET( MPI_USE_COMPILER_WRAPPERS ON CACHE BOOL ${DOC} ) - PRINT_VAR(MPI_USE_COMPILER_WRAPPERS) - - FILE(TO_CMAKE_PATH "$ENV{ProgramFiles}" PROGRAM_FILES) - IF(MPI_BIN_DIR) - SET(MPI_BIN_DIR_PATHS ${MPI_BIN_DIR}) - ELSE() - SET(MPI_BIN_DIR_PATHS + advanced_set( MPI_USE_COMPILER_WRAPPERS ON CACHE BOOL ${DOC} ) + print_var(MPI_USE_COMPILER_WRAPPERS) + + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" PROGRAM_FILES) + if(MPI_BIN_DIR) + set(MPI_BIN_DIR_PATHS ${MPI_BIN_DIR}) + else() + set(MPI_BIN_DIR_PATHS /usr/local/mpi/bin /usr/local/bin /usr/bin @@ -120,91 +120,91 @@ FUNCTION(TRIBITS_SETUP_MPI) "C:/Program Files/MPICH/SDK/Bin" "C:/Program Files/MPICH2/Bin" ) - ENDIF() + endif() # # B) Get the MPI compilers and/or just the raw include paths and libraries # - IF (MPI_USE_COMPILER_WRAPPERS) + if (MPI_USE_COMPILER_WRAPPERS) # B.1) Set up to use the MPI wrappers - TRIBITS_FIND_MPI_COMPILER(C mpicc) + tribits_find_mpi_compiler(C mpicc) - TRIBITS_FIND_MPI_COMPILER(CXX mpicxx mpic++ mpiCC) + tribits_find_mpi_compiler(CXX mpicxx mpic++ mpiCC) - TRIBITS_FIND_MPI_COMPILER(Fortran mpif90 mpif77) + tribits_find_mpi_compiler(Fortran mpif90 mpif77) - ELSE() + else() # B.2) Set up to use raw configure options - ADVANCED_SET( MPI_COMPILE_FLAGS "" + advanced_set( MPI_COMPILE_FLAGS "" CACHE STRING "List of general compiler flags (excluding include directories)." ) - ADVANCED_SET( MPI_LINK_FLAGS "" + advanced_set( MPI_LINK_FLAGS "" CACHE STRING "Link Flags for MPI executables." ) # NOTE: Test rest of the flags will be set up by the # FindTPLMPI.cmake module! - ENDIF() + endif() # # C) Get the MPI executable # - FIND_PROGRAM_PLUS( MPI_EXEC + find_program_plus( MPI_EXEC NAMES mpiexec mpirun PATHS ${MPI_BIN_DIR_PATHS} DOC "MPI executable used to run MPI programs" ) - MARK_AS_ADVANCED(MPI_EXEC) + mark_as_advanced(MPI_EXEC) - IF(MPI_EXEC) + if(MPI_EXEC) - GET_FILENAME_COMPONENT( MPI_EXEC_NAME "${MPI_EXEC}" PATH ) + get_filename_component( MPI_EXEC_NAME "${MPI_EXEC}" PATH ) - IF(MPI_EXEC_NAME STREQUAL mpiexec) - SET(MPI_EXEC_NUMPROCS_FLAG_DEFAULT -n) - ELSE() - SET(MPI_EXEC_NUMPROCS_FLAG_DEFAULT -np) - ENDIF() - ADVANCED_SET( MPI_EXEC_NUMPROCS_FLAG + if(MPI_EXEC_NAME STREQUAL mpiexec) + set(MPI_EXEC_NUMPROCS_FLAG_DEFAULT -n) + else() + set(MPI_EXEC_NUMPROCS_FLAG_DEFAULT -np) + endif() + advanced_set( MPI_EXEC_NUMPROCS_FLAG ${MPI_EXEC_NUMPROCS_FLAG_DEFAULT} CACHE STRING "Flag setting the number of processors to use with MPI run command." ) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - PRINT_NONEMPTY_VAR(MPI_EXEC_NUMPROCS_FLAG) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + print_nonempty_var(MPI_EXEC_NUMPROCS_FLAG) + endif() - ADVANCED_SET( MPI_EXEC_DEFAULT_NUMPROCS "4" + advanced_set( MPI_EXEC_DEFAULT_NUMPROCS "4" CACHE STRING - "The default mumber of processes to use when running MPI programs." ) + "The default number of processes to use when running MPI programs." ) - IF ( "${MPI_EXEC_MAX_NUMPROCS_DEFAULT}" STREQUAL "" ) - SET(MPI_EXEC_MAX_NUMPROCS_DEFAULT 4) - ENDIF() - ADVANCED_SET( MPI_EXEC_MAX_NUMPROCS ${MPI_EXEC_MAX_NUMPROCS_DEFAULT} + if ( "${MPI_EXEC_MAX_NUMPROCS_DEFAULT}" STREQUAL "" ) + set(MPI_EXEC_MAX_NUMPROCS_DEFAULT 4) + endif() + advanced_set( MPI_EXEC_MAX_NUMPROCS ${MPI_EXEC_MAX_NUMPROCS_DEFAULT} CACHE STRING - "The maximum mumber of processes to use when running MPI programs. Tests with more procs are excluded." ) + "The maximum number of processes to use when running MPI programs. Tests with more procs are excluded." ) - ADVANCED_SET( MPI_EXEC_PRE_NUMPROCS_FLAGS "" + advanced_set( MPI_EXEC_PRE_NUMPROCS_FLAGS "" CACHE STRING "Extra command-line args to the MPI exec before num-procs args." ) - ADVANCED_SET( MPI_EXEC_POST_NUMPROCS_FLAGS "" + advanced_set( MPI_EXEC_POST_NUMPROCS_FLAGS "" CACHE STRING "Extra command-line args to the MPI exec after num-procs args." ) - ENDIF() + endif() - #MESSAGE(FATAL_ERROR "Stopping!") + #message(FATAL_ERROR "Stopping!") -ENDFUNCTION() +endfunction() -# 2009/01/23: rabartl: ToDo: Above: create util FIND_PROGRAM_PATH_FIRST(...) +# 2009/01/23: rabartl: ToDo: Above: create util find_program_path_first(...) # in order to implement looking in the input path first and not last diff --git a/cmake/tribits/core/package_arch/TribitsSetupStrongCompileWarnings.cmake b/cmake/tribits/core/package_arch/TribitsSetupStrongCompileWarnings.cmake index a20b577a5637..8365377574d5 100644 --- a/cmake/tribits/core/package_arch/TribitsSetupStrongCompileWarnings.cmake +++ b/cmake/tribits/core/package_arch/TribitsSetupStrongCompileWarnings.cmake @@ -37,8 +37,8 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsDefineStandardCompileVars) -INCLUDE(DualScopePrependCmndlineArgs) +include(TribitsDefineStandardCompileVars) +include(DualScopePrependCmndlineArgs) # @@ -46,63 +46,63 @@ INCLUDE(DualScopePrependCmndlineArgs) # -MACRO(TRIBITS_SET_LANGUAGE_STRONG_WARNING_FLAGS LANG) +macro(tribits_set_language_strong_warning_flags LANG) - #MESSAGE("Entering TRIBITS_SET_LANGUAGE_STRONG_WARNING_FLAGS(${LANG})") - #PRINT_VAR(${PROJECT_NAME}_ENABLE_STRONG_${LANG}_COMPILE_WARNINGS) + #message("Entering tribits_set_language_strong_warning_flags(${LANG})") + #print_var(${PROJECT_NAME}_ENABLE_STRONG_${LANG}_COMPILE_WARNINGS) - DUAL_SCOPE_PREPEND_CMNDLINE_ARGS(CMAKE_${LANG}_FLAGS + dual_scope_prepend_cmndline_args(CMAKE_${LANG}_FLAGS "${${LANG}_STRONG_COMPILE_WARNING_FLAGS}") - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE(STATUS "Adding strong ${LANG} warning flags \"${${LANG}_STRONG_COMPILE_WARNING_FLAGS}\"") - PRINT_VAR(CMAKE_${LANG}_FLAGS) - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message(STATUS "Adding strong ${LANG} warning flags \"${${LANG}_STRONG_COMPILE_WARNING_FLAGS}\"") + print_var(CMAKE_${LANG}_FLAGS) + endif() -ENDMACRO() +endmacro() -FUNCTION(TRIBITS_SETUP_STRONG_COMPILE_WARNINGS ENABLE_SHADOWING_WARNINGS) +function(tribits_setup_strong_compile_warnings ENABLE_SHADOWING_WARNINGS) - #MESSAGE("Entering TRIBITS_SETUP_STRONG_COMPILE_WARNINGS(${ENABLE_SHADOWING_WARNINGS})") + #message("Entering tribits_setup_strong_compile_warnings(${ENABLE_SHADOWING_WARNINGS})") # # Setup and general flags # - TRIBITS_DEFINE_STANDARD_COMPILE_FLAGS_VARS(${ENABLE_SHADOWING_WARNINGS}) + tribits_define_standard_compile_flags_vars(${ENABLE_SHADOWING_WARNINGS}) # # C compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_C CMAKE_C_COMPILER_ID) - IF (${PROJECT_NAME}_ENABLE_C + assert_defined(${PROJECT_NAME}_ENABLE_C CMAKE_C_COMPILER_ID) + if (${PROJECT_NAME}_ENABLE_C AND CMAKE_C_COMPILER_ID STREQUAL "GNU" AND ${PROJECT_NAME}_ENABLE_STRONG_C_COMPILE_WARNINGS ) - TRIBITS_SET_LANGUAGE_STRONG_WARNING_FLAGS(C) - ENDIF() + tribits_set_language_strong_warning_flags(C) + endif() # # C++ compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_CXX CMAKE_CXX_COMPILER_ID) - IF (${PROJECT_NAME}_ENABLE_CXX + assert_defined(${PROJECT_NAME}_ENABLE_CXX CMAKE_CXX_COMPILER_ID) + if (${PROJECT_NAME}_ENABLE_CXX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND ${PROJECT_NAME}_ENABLE_STRONG_CXX_COMPILE_WARNINGS ) - TRIBITS_SET_LANGUAGE_STRONG_WARNING_FLAGS(CXX) - ENDIF() + tribits_set_language_strong_warning_flags(CXX) + endif() # # Fortran compiler options # - ASSERT_DEFINED(${PROJECT_NAME}_ENABLE_Fortran) - IF (${PROJECT_NAME}_ENABLE_Fortran AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + assert_defined(${PROJECT_NAME}_ENABLE_Fortran) + if (${PROJECT_NAME}_ENABLE_Fortran AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # ToDo: Add Fortran warnings? - ENDIF() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsSortListAccordingToMasterList.cmake b/cmake/tribits/core/package_arch/TribitsSortListAccordingToMasterList.cmake index 80e58df038a3..5d079a417461 100644 --- a/cmake/tribits/core/package_arch/TribitsSortListAccordingToMasterList.cmake +++ b/cmake/tribits/core/package_arch/TribitsSortListAccordingToMasterList.cmake @@ -37,8 +37,8 @@ # ************************************************************************ # @HEADER -INCLUDE(PrintVar) -INCLUDE(AppendSet) +include(PrintVar) +include(AppendSet) # # Function that does an in-place sort of a list of items according to the @@ -49,28 +49,28 @@ INCLUDE(AppendSet) # number of packages/TPLs and n is the number of passed-in packages/TPLs. # However, since N is not likely to ever be more than a few hundred, this is # likely not going to be a big performance problem. If this does become a -# performance problem, LIST(SORT ...) could be used but would require some +# performance problem, list(SORT ...) could be used but would require some # work to build up the datastructures to make this very efficient. # -FUNCTION(TRIBITS_SORT_LIST_ACCORDING_TO_MASTER_LIST MASTER_LIST LIST_VAR_INOUT) +function(tribits_sort_list_according_to_master_list MASTER_LIST LIST_VAR_INOUT) - #MESSAGE("TRIBITS_SORT_LIST_ACCORDING_TO_MASTER_LIST:") - #PRINT_VAR(MASTER_LIST) - #PRINT_VAR(LIST_VAR_INOUT) - #PRINT_VAR(${LIST_VAR_INOUT}) + #message("TRIBITS_SORT_LIST_ACCORDING_TO_MASTER_LIST:") + #print_var(MASTER_LIST) + #print_var(LIST_VAR_INOUT) + #print_var(${LIST_VAR_INOUT}) - SET(SORTED_LIST) + set(SORTED_LIST) - FOREACH(ITEM ${MASTER_LIST}) - LIST(FIND ${LIST_VAR_INOUT} ${ITEM} ITEM_IDX) - IF (NOT ITEM_IDX EQUAL -1) - LIST(APPEND SORTED_LIST ${ITEM}) - ENDIF() - ENDFOREACH() + foreach(ITEM ${MASTER_LIST}) + list(FIND ${LIST_VAR_INOUT} ${ITEM} ITEM_IDX) + if (NOT ITEM_IDX EQUAL -1) + list(APPEND SORTED_LIST ${ITEM}) + endif() + endforeach() - #PRINT_VAR(SORTED_LIST) + #print_var(SORTED_LIST) - SET(${LIST_VAR_INOUT} ${SORTED_LIST} PARENT_SCOPE) + set(${LIST_VAR_INOUT} ${SORTED_LIST} PARENT_SCOPE) -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsSubPackageMacros.cmake b/cmake/tribits/core/package_arch/TribitsSubPackageMacros.cmake index 433ebbeb6e9d..1cbc9e8bb74d 100644 --- a/cmake/tribits/core/package_arch/TribitsSubPackageMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsSubPackageMacros.cmake @@ -37,19 +37,19 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsPackageMacros) -INCLUDE(TribitsReportInvalidTribitsUsage) +include(TribitsPackageMacros) +include(TribitsReportInvalidTribitsUsage) # -# @MACRO: TRIBITS_SUBPACKAGE() +# @MACRO: tribits_subpackage() # # Forward declare a `TriBITS Subpackage`_ called at the top of the # subpackage's `//CMakeLists.txt`_ file. # # Usage:: # -# TRIBITS_SUBPACKAGE() +# tribits_subpackage() # # Once called, the following local variables are in scope: # @@ -72,67 +72,67 @@ INCLUDE(TribitsReportInvalidTribitsUsage) # # Inside the subpackage, the same as ``SUBPACKAGE_FULLNAME``. # -MACRO(TRIBITS_SUBPACKAGE SUBPACKAGE_NAME_IN) +macro(tribits_subpackage SUBPACKAGE_NAME_IN) - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nSUBPACKAGE: ${SUBPACKAGE_NAME_IN}") - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nSUBPACKAGE: ${SUBPACKAGE_NAME_IN}") + endif() # check that this is not being called from a package - IF (NOT CURRENTLY_PROCESSING_SUBPACKAGE) + if (NOT CURRENTLY_PROCESSING_SUBPACKAGE) # we are in a package - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Cannot call TRIBITS_SUBPACKAGE() from a package." - " Use TRIBITS_PACKAGE() instead" + tribits_report_invalid_tribits_usage( + "Cannot call tribits_subpackage() from a package." + " Use tribits_package() instead" " ${CURRENT_PACKAGE_CMAKELIST_FILE}") - ELSE() + else() # We are in a subpackage # check to see if postprocess is called before subpackage - IF(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "TRIBITS_SUBPACKAGE_POSTPROCESS() called before TRIBITS_SUBPACKAGE()") - ENDIF() + if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "tribits_subpackage_postprocess() called before tribits_subpackage()") + endif() # check to see if we have already called this macro - IF(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "Already called TRIBITS_SUBPACKGE() for the" + if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) + tribits_report_invalid_tribits_usage( + "Already called tribits_subpackge() for the" " ${PARENT_PACKAGE_NAME} subpackage ${TRIBITS_SUBPACKAGE}") - ENDIF() + 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( + 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") - ENDIF() - ENDIF() + endif() + endif() # To provide context for various macros - SET(PACKAGE_NAME ${SUBPACKAGE_FULLNAME}) + set(PACKAGE_NAME ${SUBPACKAGE_FULLNAME}) - SET(PARENT_PACKAGE_SOURCE_DIR "${PACKAGE_SOURCE_DIR}") - SET(PARENT_PACKAGE_BINARY_DIR "${PACKAGE_BINARY_DIR}") + set(PARENT_PACKAGE_SOURCE_DIR "${PACKAGE_SOURCE_DIR}") + set(PARENT_PACKAGE_BINARY_DIR "${PACKAGE_BINARY_DIR}") # Now override the package-like variables - TRIBITS_SET_COMMON_VARS(${SUBPACKAGE_FULLNAME}) - TRIBITS_DEFINE_LINKAGE_VARS(${SUBPACKAGE_FULLNAME}) + tribits_set_common_vars(${SUBPACKAGE_FULLNAME}) + tribits_define_linkage_vars(${SUBPACKAGE_FULLNAME}) # Set flags that are used to check that macros are called in the correct order - SET(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED TRUE) - SET(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED FALSE) + set(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED TRUE) + set(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED FALSE) -ENDMACRO() +endmacro() # -# @MACRO: TRIBITS_SUBPACKAGE_POSTPROCESS() +# @MACRO: tribits_subpackage_postprocess() # # Macro that performs standard post-processing after defining a `TriBITS # Subpackage`_ which is called at the bottom of a subpackage's @@ -140,45 +140,45 @@ ENDMACRO() # # Usage:: # -# TRIBITS_SUBPACKAGE_POSTPROCESS() +# tribits_subpackage_postprocess() # # NOTE: It is unfortunate that a Subpackages's CMakeLists.txt file must call # this macro but limitations of the CMake language make it necessary to do so. # -MACRO(TRIBITS_SUBPACKAGE_POSTPROCESS) +macro(tribits_subpackage_postprocess) # check that this is not being called from a package - IF (NOT CURRENTLY_PROCESSING_SUBPACKAGE) + 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" + tribits_report_invalid_tribits_usage( + "Cannot call tribits_subpackage_postprocess() from a package." + " Use tribits_package_postprocess() instead" " ${CURRENT_PACKAGE_CMAKELIST_FILE}") - ELSE() + else() # This is being caleld 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( - "Already called TRIBITS_SUBPACKGE_POSTPROCESS() for the" + if (${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED) + tribits_report_invalid_tribits_usage( + "Already called tribits_subpackge_postprocess() for the" " ${PARENT_PACKAGE_NAME} subpackage ${TRIBITS_SUBPACKAGE}") - ENDIF() + endif() # make sure subpackage is called prior to subpackage postprocess - IF(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) - TRIBITS_REPORT_INVALID_TRIBITS_USAGE( - "TRIBITS_SUBPACKAGE() must be called before TRIBITS_SUBPACKAGE_POSTPROCESS()" + if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED) + tribits_report_invalid_tribits_usage( + "tribits_subpackage() must be called before tribits_subpackage_postprocess()" " for the ${PARENT_PACKAGE_NAME} subpackage ${TRIBITS_SUBPACKAGE}") - ENDIF() + endif() - 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) + dual_scope_set(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED TRUE) - TRIBITS_PACKAGE_POSTPROCESS_COMMON() + tribits_package_postprocess_common() -ENDMACRO() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst b/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst index e2accf82761b..00cdb56c7ee7 100644 --- a/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst +++ b/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst @@ -1,5 +1,5 @@ -TriBITS System Data Structures and Functions --------------------------------------------- +TriBITS System Data Structures +------------------------------ This section describes the global CMake variables that make up the data-structures and the functions that create them that define the TriBITS @@ -10,6 +10,13 @@ graph of external packages (i.e. TPLs) and internal packages (i.e. buildable CMake packages). This information is meant for maintainers of the TriBITS system itself and should not need to be known by TriBITS Project maintainers. +In addition to the variables listed below are the variables documented in: + +* `TriBITS Project Core Variables`_ +* `TriBITS Repository Core Variables`_ +* `TriBITS Package Core Variables`_ +* `TriBITS Subpackage Core Variables`_ + Lists of external and internal packages +++++++++++++++++++++++++++++++++++++++ @@ -61,8 +68,8 @@ is treated as an internal or external package is determined by the variable:: ${PACKAGE_NAME}_PACKAGE_STATUS=[INTERNAL|EXTERNAL] -which gets set variouscriteria as described in section `Determining if a -package is internal or external`_. This varaible determines what +which gets set various criteria as described in section `Determining if a +package is internal or external`_. This variable determines what pre-built/pre-installed packages must be found out on the system if enabled and what internal packages need to be built if enabled. @@ -73,13 +80,13 @@ is used with an adjective, it is usually meant in this more general context. ToDo: Describe the data-structures of all "Packages" which includes subpackages as well and the lists of enabled packages. -These data-stractures as well as the package dependencies graph is built up in -the macro `TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH()`_ with the +These data-structures as well as the package dependencies graph is built up in +the macro `tribits_read_all_project_deps_files_create_deps_graph()`_ with the call graph described in the section `Function call tree for constructing package dependency graph`_. A set of enable/disable logic is applied in the macro -`TRIBITS_ADJUST_PACKAGE_ENABLES()`_. Once all of this logic has been applied, +`tribits_adjust_package_enables()`_. Once all of this logic has been applied, the final list of enabled external packages, internal packages, and all enabled packages are given in the list variables:: @@ -129,12 +136,12 @@ project-level non-cache list variable:: That list is created from the information in the `/PackagesList.cmake`_ and `/cmake/Dependencies.cmake`_ files for the top-level packages read and processed in the macro -`TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH()`_ using macros in the file:: +`tribits_read_deps_files_create_deps_graph()`_ using macros in the file:: TribitsAdjustPackageEnables.cmake One can determine if a package in this list is a top-level parent package or a -sub-subpackage based on the value of the varaible +sub-subpackage based on the value of the variable `${PACKAGE_NAME}_PARENT_PACKAGE`_. If the value is non empty, then ``${PACKAGE_NAME}`` is a subpackage. If the value is empty "", then ``${PACKAGE_NAME}`` is a parent package. @@ -161,7 +168,6 @@ The full list of defined TPLs is stored in the variable:: This list is created from the `/TPLsList.cmake`_ files from each defined TriBITS Repository. Along with this, the following variables for each of these TriBITS TPLs are defined:: - * `${TPL_NAME}_FINDMOD`_ * `${TPL_NAME}_TESTGROUP`_ @@ -334,7 +340,7 @@ a given package's capabilities: Defines list of *only* the libraries associated with the given (sub)package and does *not* list libraries in upstream packages. Linkages to upstream packages is taken care of with calls to - TARGET_LINK_LIBRARIES(...) and the dependency management system in CMake + target_link_libraries(...) and the dependency management system in CMake takes care of adding these to various link lines as needed (this is what CMake does well). However, when a package has no libraries of its own (which is often the case for packages that have subpackages, for example), @@ -343,7 +349,7 @@ a given package's capabilities: be handled correctly in downstream packages and executables in the same package. In this case, ${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES will be false. The primary purpose of this variable is to passe to - TARGET_LINK_LIBRARIES(...) by downstream libraries and executables. + target_link_libraries(...) by downstream libraries and executables. ``${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES`` @@ -364,9 +370,9 @@ a given package's capabilities: ``${PARENT_PACKAGE_NAME}_LIB_TARGETS`` Lists all of the library targets for this package only that are as part of - this package added by the `TRIBITS_ADD_LIBRARY()`_ function. This is used + this package added by the `tribits_add_library()`_ function. This is used to define a target called ${PACKAGE_NAME}_libs that is then used by - `TRIBITS_CTEST_DRIVER()`_ in the package-by-package mode. If a package + `tribits_ctest_driver()`_ in the package-by-package mode. If a package has no libraries, then the library targets for all of the immediate upstream direct dependent packages will be added. This is needed for the chain of dependencies to work correctly. Note that subpackages don't have @@ -375,8 +381,8 @@ a given package's capabilities: ``${PARENT_PACKAGE_NAME}_ALL_TARGETS`` Lists all of the targets associated with this package. This includes all - libraries and tests added with `TRIBITS_ADD_LIBRARY()`_ and - `TRIBITS_ADD_EXECUTABLE()`_. If this package has no targets (no libraries + libraries and tests added with `tribits_add_library()`_ and + `tribits_add_executable()`_. If this package has no targets (no libraries or executables) this this will have the dependency only on ${PARENT_PACKAGE_NAME}_libs. Note that subpackages don't have this variable defined for them. @@ -421,42 +427,42 @@ Function call tree for constructing package dependency graph Below is the CMake macro and function call graph for constructing the packages lists and dependency data-structures described above. -| `TRIBITS_READ_ALL_PROJECT_DEPS_FILES_CREATE_DEPS_GRAPH()`_ -| `TRIBITS_READ_DEFINED_EXTERNAL_AND_INTENRAL_TOPLEVEL_PACKAGES_LISTS()`_ +| `tribits_read_all_project_deps_files_create_deps_graph()`_ +| `tribits_read_defined_external_and_internal_toplevel_packages_lists()`_ | Foreach ```` in ``${PROJECT_NAME}_ALL_REPOSITORIES``: -| ``INCLUDE(`` `/TPLsList.cmake`_ ``)`` -| `TRIBITS_PROCESS_TPLS_LISTS()`_ -| ``INCLUDE(`` `/PackagesList.cmake`_ ``)`` -| `TRIBITS_PROCESS_PACKAGES_AND_DIRS_LISTS()`_ -| `TRIBITS_READ_DEPS_FILES_CREATE_DEPS_GRAPH()`_ -| `TRIBITS_PROCESS_ALL_REPOSITORY_DEPS_SETUP_FILES()`_ +| ``include(`` `/TPLsList.cmake`_ ``)`` +| `tribits_process_tpls_lists()`_ +| ``include(`` `/PackagesList.cmake`_ ``)`` +| `tribits_process_packages_and_dirs_lists()`_ +| `tribits_read_deps_files_create_deps_graph()`_ +| `tribits_process_all_repository_deps_setup_files()`_ | Foreach ```` in ``${PROJECT_NAME}_ALL_REPOSITORIES``: -| ``INCLUDE(`` `/cmake/RepositoryDependenciesSetup.cmake`_ ``)`` -| `TRIBITS_PROCESS_PROJECT_DEPENDENCY_SETUP_FILE()`_ -| ``INCLUDE(`` `/cmake/ProjectDependenciesSetup.cmake`_ ``)`` -| `TRIBITS_READ_ALL_PACKAGE_DEPS_FILES_CREATE_DEPS_GRAPH()`_ +| ``include(`` `/cmake/RepositoryDependenciesSetup.cmake`_ ``)`` +| `tribits_process_project_dependency_setup_file()`_ +| ``include(`` `/cmake/ProjectDependenciesSetup.cmake`_ ``)`` +| `tribits_read_all_package_deps_files_create_deps_graph()`_ | Foreach ``TOPLEVEL_PACKAGE``: -| `TRIBITS_READ_TOPLEVEL_PACKAGE_DEPS_FILES_ADD_TO_GRAPH()`_ -| `TRIBITS_PREP_TO_READ_DEPENDENCIES()`_ -| ``INCLUDE(`` `/cmake/Dependencies.cmake`_ ``)`` -| `TRIBITS_ASSERT_READ_DEPENDENCY_VARS()`_ -| `TRIBITS_SAVE_OFF_DEPENDENCIES_VARS()`_ -| `TRIBITS_PARSE_SUBPACKAGES_APPEND_SE_PACKAGES_ADD_OPTIONS()`_ -| `TRIBITS_READ_PACKAGE_SUBPACKAGE_DEPS_FILES_ADD_TO_GRAPH()`_ +| `tribits_read_toplevel_package_deps_files_add_to_graph()`_ +| `tribits_prep_to_read_dependencies()`_ +| ``include(`` `/cmake/Dependencies.cmake`_ ``)`` +| `tribits_assert_read_dependency_vars()`_ +| `tribits_save_off_dependency_vars()`_ +| `tribits_parse_subpackages_append_se_packages_add_options()`_ +| `tribits_read_package_subpackage_deps_files_add_to_graph()`_ | Foreach ``SUBPACKAGE``: -| `TRIBITS_READ_SUBPACKAGE_DEPS_FILE_ADD_TO_GRAPH()`_ -| `TRIBITS_PREP_TO_READ_DEPENDENCIES()`_ -| ``INCLUDE(`` `//cmake/Dependencies.cmake`_ ``)`` -| `TRIBITS_ASSERT_READ_DEPENDENCY_VARS()`_ -| `TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS()`_ +| `tribits_read_subpackage_deps_file_add_to_graph()`_ +| `tribits_prep_to_read_dependencies()`_ +| ``include(`` `//cmake/Dependencies.cmake`_ ``)`` +| `tribits_assert_read_dependency_vars()`_ +| `tribits_process_package_dependencies_lists()`_ | See same call stack for this macro as shown below -| `TRIBITS_READ_BACK_DEPENDENCIES_VARS()`_ -| `TRIBITS_PROCESS_PACKAGE_DEPENDENCIES_LISTS()`_ -| `TRIBITS_SET_DEP_PACKAGES()`_ -| `TRIBITS_ABORT_ON_SELF_DEP()`_ -| `TRIBITS_ABORT_ON_MISSING_PACKAGE()`_ -| `TRIBITS_APPEND_FORWARD_DEP_PACKAGES()`_ -| `TRIBITS_ABORT_ON_MISSING_PACKAGE()`_ +| `tribits_read_back_dependencies_vars()`_ +| `tribits_process_package_dependencies_lists()`_ +| `tribits_set_dep_packages()`_ +| `tribits_abort_on_self_dep()`_ +| `tribits_abort_on_missing_package()`_ +| `tribits_append_forward_dep_packages()`_ +| `tribits_abort_on_missing_package()`_ Notes on dependency logic diff --git a/cmake/tribits/core/package_arch/TribitsTestCategories.cmake b/cmake/tribits/core/package_arch/TribitsTestCategories.cmake index d344f73c2fc0..c0058c9c7cd8 100644 --- a/cmake/tribits/core/package_arch/TribitsTestCategories.cmake +++ b/cmake/tribits/core/package_arch/TribitsTestCategories.cmake @@ -37,13 +37,13 @@ # ************************************************************************ # @HEADER -INCLUDE(FindListElement) -INCLUDE(MessageWrapper) -INCLUDE(Join) +include(FindListElement) +include(MessageWrapper) +include(Join) # Define the valid categories that will be recognized in the CATEGORIES keyword -SET(${PROJECT_NAME}_VALID_CATEGORIES BASIC CONTINUOUS NIGHTLY HEAVY WEEKLY PERFORMANCE) +set(${PROJECT_NAME}_VALID_CATEGORIES BASIC CONTINUOUS NIGHTLY HEAVY WEEKLY PERFORMANCE) # TODO: ABove, We may want only the final project to define these categories # and not just be general categories for all projects based on ProjectArch. @@ -51,58 +51,58 @@ SET(${PROJECT_NAME}_VALID_CATEGORIES BASIC CONTINUOUS NIGHTLY HEAVY WEEKLY # recognized. # This is a string used in help and error messages -JOIN(${PROJECT_NAME}_VALID_CATEGORIES_STR ", " FALSE ${${PROJECT_NAME}_VALID_CATEGORIES}) +join(${PROJECT_NAME}_VALID_CATEGORIES_STR ", " FALSE ${${PROJECT_NAME}_VALID_CATEGORIES}) # # Check for invalid categories called as: # -# TRIBITS_GET_INVALID_CATEGORIES(INVLAID_CATEGORIES CATEGORIES_LIST) +# tribits_get_invalid_categories(INVLAID_CATEGORIES CATEGORIES_LIST) # # The list of categories to check comes in through the ARGN list. # -FUNCTION(TRIBITS_GET_INVALID_CATEGORIES INVALID_CATEGORIES_OUT) - #MESSAGE("TRIBITS_GET_INVALID_CATEGORIES: ${INVALID_CATEGORIES_OUT} ${ARGN}") - SET(INVALID_CATEGORIES "") - FOREACH(CATEGORY_IN ${ARGN}) - #PRINT_VAR(CATEGORY_IN) - SET(FOUND_CATEGORY FALSE) - FIND_LIST_ELEMENT(${PROJECT_NAME}_VALID_CATEGORIES ${CATEGORY_IN} FOUND_CATEGORY) - IF (NOT FOUND_CATEGORY) - #MESSAGE(STATUS "Not found in list of valid categories!") - SET(INVALID_CATEGORIES ${INVALID_CATEGORIES} ${CATEGORY_IN}) - ENDIF() - #PRINT_VAR(INVALID_CATEGORIES) - ENDFOREACH() - SET(${INVALID_CATEGORIES_OUT} ${INVALID_CATEGORIES} PARENT_SCOPE) - #PRINT_VAR(${INVALID_CATEGORIES_OUT}) -ENDFUNCTION() +function(tribits_get_invalid_categories INVALID_CATEGORIES_OUT) + #message("TRIBITS_GET_INVALID_CATEGORIES: ${INVALID_CATEGORIES_OUT} ${ARGN}") + set(INVALID_CATEGORIES "") + foreach(CATEGORY_IN ${ARGN}) + #print_var(CATEGORY_IN) + set(FOUND_CATEGORY FALSE) + find_list_element(${PROJECT_NAME}_VALID_CATEGORIES ${CATEGORY_IN} FOUND_CATEGORY) + if (NOT FOUND_CATEGORY) + #message(STATUS "Not found in list of valid categories!") + set(INVALID_CATEGORIES ${INVALID_CATEGORIES} ${CATEGORY_IN}) + endif() + #print_var(INVALID_CATEGORIES) + endforeach() + set(${INVALID_CATEGORIES_OUT} ${INVALID_CATEGORIES} PARENT_SCOPE) + #print_var(${INVALID_CATEGORIES_OUT}) +endfunction() # # Assert there are no invalid categories called as: # -# TRIBITS_ASSERT_VALID_CATEGORIES(CATEGORIES_LIST) +# tribits_assert_valid_categories(CATEGORIES_LIST) # # The list of categories to check comes in through the ARGN list. # -FUNCTION(TRIBITS_FILTER_AND_ASSERT_CATEGORIES CATEGORIES_VAR_INOUT) - #MESSAGE("TRIBITS_ASSERT_VALID_CATEGORIES: ${ARGN}") - SET(INVALID_CATEGORIES "DUMMYCAT") - TRIBITS_GET_INVALID_CATEGORIES(INVALID_CATEGORIES ${${CATEGORIES_VAR_INOUT}}) - #PRINT_VAR(INVALID_CATEGORIES) - IF (INVALID_CATEGORIES) - MESSAGE_WRAPPER(SEND_ERROR "Error: The categories '${INVALID_CATEGORIES}' are not" +function(tribits_filter_and_assert_categories CATEGORIES_VAR_INOUT) + #message("TRIBITS_ASSERT_VALID_CATEGORIES: ${ARGN}") + set(INVALID_CATEGORIES "DUMMYCAT") + tribits_get_invalid_categories(INVALID_CATEGORIES ${${CATEGORIES_VAR_INOUT}}) + #print_var(INVALID_CATEGORIES) + if (INVALID_CATEGORIES) + message_wrapper(SEND_ERROR "Error: The categories '${INVALID_CATEGORIES}' are not" " in the list of valid categories '${${PROJECT_NAME}_VALID_CATEGORIES_STR}'!") - ENDIF() - SET(CATEGORIES_OUT) - FOREACH(CATEGORY ${${CATEGORIES_VAR_INOUT}}) - IF (CATEGORY STREQUAL "WEEKLY") - MESSAGE_WRAPPER(WARNING "Warning: The test category 'WEEKLY' is deprecated" + endif() + set(CATEGORIES_OUT) + foreach(CATEGORY ${${CATEGORIES_VAR_INOUT}}) + if (CATEGORY STREQUAL "WEEKLY") + message_wrapper(WARNING "Warning: The test category 'WEEKLY' is deprecated" " and is replaced with 'HEAVY'. Please change to use 'HEAVY' instead.") - LIST(APPEND CATEGORIES_OUT "HEAVY") - ELSE() - LIST(APPEND CATEGORIES_OUT ${CATEGORY}) - ENDIF() - ENDFOREACH() - SET(${CATEGORIES_VAR_INOUT} ${CATEGORIES_OUT} PARENT_SCOPE) -ENDFUNCTION() + list(APPEND CATEGORIES_OUT "HEAVY") + else() + list(APPEND CATEGORIES_OUT ${CATEGORY}) + endif() + endforeach() + set(${CATEGORIES_VAR_INOUT} ${CATEGORIES_OUT} PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsTplDeclareLibraries.cmake b/cmake/tribits/core/package_arch/TribitsTplDeclareLibraries.cmake index 0b670174b77f..16e8bae9e60e 100644 --- a/cmake/tribits/core/package_arch/TribitsTplDeclareLibraries.cmake +++ b/cmake/tribits/core/package_arch/TribitsTplDeclareLibraries.cmake @@ -37,16 +37,16 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsTplFindIncludeDirsAndLibraries) +include(TribitsTplFindIncludeDirsAndLibraries) -FUNCTION(TRIBITS_TPL_DECLARE_LIBRARIES TPL_NAME) - MESSAGE(WARNING - "WARNING: TRIBITS_TPL_DECLARE_LIBRARIES() is deprecated, instead use" - " TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES()!" +function(tribits_tpl_declare_libraries TPL_NAME) + message(WARNING + "WARNING: tribits_tpl_declare_libraries() is deprecated, instead use" + " tribits_tpl_find_include_dirs_and_libraries()!" " Make this change in the file:\n" " ${${TPL_NAME}_FINDMOD}\n" "which is pointed to by the file:\n" " ${${TPL_NAME}_TPLS_LIST_FILE}\n" ) - TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES(${TPL_NAME} ${ARGN}) -ENDFUNCTION() + tribits_tpl_find_include_dirs_and_libraries(${TPL_NAME} ${ARGN}) +endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake b/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake index a652850a942f..dfcedc290a7a 100644 --- a/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake +++ b/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake @@ -37,33 +37,33 @@ # ************************************************************************ # @HEADER -IF (TribitsTplFindIncludeDirsAndLibraries_INCLUDED) - RETURN() -ELSE() - SET(TribitsTplFindIncludeDirsAndLibraries_INCLUDED TRUE) -ENDIF() - -INCLUDE(AdvancedSet) -INCLUDE(AppendSet) -INCLUDE(AssertDefined) -INCLUDE(DualScopeSet) -INCLUDE(GlobalNullSet) -INCLUDE(GlobalSet) -INCLUDE(MultilineSet) -INCLUDE(CMakeParseArguments) -INCLUDE(SetNotFound) -INCLUDE(Split) - -# -# @FUNCTION: TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE() +if (TribitsTplFindIncludeDirsAndLibraries_INCLUDED) + return() +else() + set(TribitsTplFindIncludeDirsAndLibraries_INCLUDED TRUE) +endif() + +include(AdvancedSet) +include(AppendSet) +include(AssertDefined) +include(DualScopeSet) +include(GlobalNullSet) +include(GlobalSet) +include(MultilineSet) +include(CMakeParseArguments) +include(SetNotFound) +include(Split) + +# +# @FUNCTION: tribits_tpl_allow_pre_find_package() # # Function that determines if a TriBITS find module file -# ``FindTPL.cmake`` is allowed to call ``FIND_PACKAGE( -# ...)`` before calling `TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES()`_. +# ``FindTPL.cmake`` is allowed to call ``find_package( +# ...)`` before calling `tribits_tpl_find_include_dirs_and_libraries()`_. # # Usage:: # -# TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE( +# tribits_tpl_allow_pre_find_package( # ) # # The required arguments are: @@ -71,7 +71,7 @@ INCLUDE(Split) # ```` : The input name of the TriBITS TPL (e.g. ``HDF5``). # # ```` : Name of a variable which will be set to -# ``TRUE`` on output if ``FIND_PACKAGE( ...)`` should be called to +# ``TRUE`` on output if ``find_package( ...)`` should be called to # find the TPL ```` or ``FALSE`` if it should not be called. # # This function will set ```` to ``FALSE`` if any of @@ -90,64 +90,64 @@ INCLUDE(Split) # The variable ``_FORCE_PRE_FIND_PACKAGE`` is needed to allow users # (or the ``FindTPL.cmake`` module itself) to avoid name clashes with # the variables ``_INCLUDE_DIRS`` or ``_LIBRARY_DIRS`` in -# the usage of ``FIND_PACKAGE( ...)`` because a lot of default +# the usage of ``find_package( ...)`` because a lot of default # ``Find.cmake`` modules also use these variables. This function # sets ``_FORCE_PRE_FIND_PACKAGE`` as a cache variable with default # value ``FALSE`` to maintain backward compatibility with existing # ``FindTPL.cmake`` modules. # -# See `How to use FIND_PACKAGE() for a TriBITS TPL`_ for details in how to use +# See `How to use find_package() for a TriBITS TPL`_ for details in how to use # this function to create a ``FindTPL.cmake`` module file. # -FUNCTION(TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE TPL_NAME ALLOW_PACKAGE_PREFIND_OUT) +function(tribits_tpl_allow_pre_find_package TPL_NAME ALLOW_PACKAGE_PREFIND_OUT) - IF (TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE_DEBUG) - MESSAGE("TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE: '${TPL_NAME}' '${ALLOW_PACKAGE_PREFIND_OUT}'") - PRINT_VAR(${TPL_NAME}_INCLUDE_DIRS) - PRINT_VAR(${TPL_NAME}_LIBRARY_NAMES) - PRINT_VAR(${TPL_NAME}_LIBRARY_DIRS) - PRINT_VAR(${TPL_NAME}_FORCE_PRE_FIND_PACKAGE) - ENDIF() + if (TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE_DEBUG) + message("TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE: '${TPL_NAME}' '${ALLOW_PACKAGE_PREFIND_OUT}'") + print_var(${TPL_NAME}_INCLUDE_DIRS) + print_var(${TPL_NAME}_LIBRARY_NAMES) + print_var(${TPL_NAME}_LIBRARY_DIRS) + print_var(${TPL_NAME}_FORCE_PRE_FIND_PACKAGE) + endif() - ADVANCED_SET(${TPL_NAME}_FORCE_PRE_FIND_PACKAGE FALSE + advanced_set(${TPL_NAME}_FORCE_PRE_FIND_PACKAGE FALSE CACHE BOOL - "Determines if the variables ${TPL_NAME}_[INCLUDE_DIRS,LIBRARY_NAMES,LIBRARY_DIRS] should be ignored and the pre-find FIND_PACKAGE(${TPL_NAME} should be performed anyway. But this will *not* do the pre-find if any of the TPL_${TPL_NAME}_[INCLUDE_DIRS,LIBRARY_NAMES,LIBRARY_DIRS] vars are set." ) + "Determines if the variables ${TPL_NAME}_[INCLUDE_DIRS,LIBRARY_NAMES,LIBRARY_DIRS] should be ignored and the pre-find find_package(${TPL_NAME} should be performed anyway. But this will *not* do the pre-find if any of the TPL_${TPL_NAME}_[INCLUDE_DIRS,LIBRARY_NAMES,LIBRARY_DIRS] vars are set." ) # Start out with TRUE and set to FALSE in logic below - SET(ALLOW_PACKAGE_PREFIND TRUE) + set(ALLOW_PACKAGE_PREFIND TRUE) - IF ( + if ( (NOT "${TPL_${TPL_NAME}_INCLUDE_DIRS}" STREQUAL "") OR (NOT "${TPL_${TPL_NAME}_LIBRARIES}" STREQUAL "") OR (NOT "${TPL_${TPL_NAME}_LIBRARY_DIRS}" STREQUAL "") ) # The user has selected one or more of the final vars so skip calling - # FIND_PACKAGE(${TPL_NAME} ...) ... - SET(ALLOW_PACKAGE_PREFIND FALSE) - ELSEIF ( + # find_package(${TPL_NAME} ...) ... + set(ALLOW_PACKAGE_PREFIND FALSE) + elseif ( (NOT "${${TPL_NAME}_INCLUDE_DIRS}" STREQUAL "") OR (NOT "${${TPL_NAME}_LIBRARY_NAMES}" STREQUAL "") OR (NOT "${${TPL_NAME}_LIBRARY_DIRS}" STREQUAL "") ) # One ore more of the ${TPL_NAME}_XXX variables are set - IF (${TPL_NAME}_FORCE_PRE_FIND_PACKAGE) + if (${TPL_NAME}_FORCE_PRE_FIND_PACKAGE) # Even with one or more of the ${TPL_NAME}_XXX vars set, we still want - # to do the FIND_PACKAGE(${TPL_NAME} ...) search and ignore this + # to do the find_package(${TPL_NAME} ...) search and ignore this # override. - ELSE() + else() # We will not ignore the override of these variables and will instead go # ahead and skip the pre-find. - SET(ALLOW_PACKAGE_PREFIND FALSE) - ENDIF() - ENDIF() + set(ALLOW_PACKAGE_PREFIND FALSE) + endif() + endif() - SET(${ALLOW_PACKAGE_PREFIND_OUT} ${ALLOW_PACKAGE_PREFIND} PARENT_SCOPE) + set(${ALLOW_PACKAGE_PREFIND_OUT} ${ALLOW_PACKAGE_PREFIND} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # -# @FUNCTION: TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() +# @FUNCTION: tribits_tpl_find_include_dirs_and_libraries() # # Function that sets up cache variables for users to specify where to find a # `TriBITS TPL`_'s headers and libraries. This function is typically called @@ -156,7 +156,7 @@ ENDFUNCTION() # # Usage:: # -# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( +# tribits_tpl_find_include_dirs_and_libraries( # # [REQUIRED_HEADERS ...] # [MUST_FIND_ALL_HEADERS] @@ -177,7 +177,7 @@ ENDFUNCTION() # ``REQUIRED_HEADERS`` # # List of header files that are searched in order to find the TPL's -# include directories files using ``FIND_PATH()``. +# include directories files using ``find_path()``. # # ``MUST_FIND_ALL_HEADERS`` # @@ -187,7 +187,7 @@ ENDFUNCTION() # ``REQUIRED_LIBS_NAMES`` # # List of libraries that are searched for when looking for the TPL's -# libraries using ``FIND_LIBRARY()``. This list can be overridden by the +# libraries using ``find_library()``. This list can be overridden by the # user by setting ``_LIBRARY_DIRS`` (see below). # # ``MUST_FIND_ALL_LIBS`` @@ -239,7 +239,7 @@ ENDFUNCTION() # ``TPL__LIBRARIES`` (type ``FILEPATH``) # # A list of commons-separated full library names (i.e. output from -# ``FIND_LIBRARY()``) for all of the libraries found for the TPL. If this +# ``find_library()``) for all of the libraries found for the TPL. If this # variable is set before calling this function, then no libraries are # searched for and this variable will be assumed to have the correct list # of libraries to link to. @@ -253,14 +253,14 @@ ENDFUNCTION() # # Note, if ``TPL_TENTATIVE_ENABLE_=ON``, then if all of the parts of # the TPL can't be found, then ``TPL_ENABLE_`` will be (forced) set -# to ``OFF`` in the cache. See `TRIBITS_TPL_TENTATIVELY_ENABLE()`_. +# to ``OFF`` in the cache. See `tribits_tpl_tentatively_enable()`_. # -FUNCTION(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES TPL_NAME) +function(tribits_tpl_find_include_dirs_and_libraries TPL_NAME) # Make sure the right name is used - ASSERT_DEFINED(TPL_ENABLE_${TPL_NAME}) + assert_defined(TPL_ENABLE_${TPL_NAME}) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -272,38 +272,38 @@ FUNCTION(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES TPL_NAME) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) - SET(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE TRUE) - ENDIF() + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + set(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE TRUE) + endif() - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - MESSAGE("TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES: ${TPL_NAME}") - PRINT_VAR(PARSE_REQUIRED_HEADERS) - PRINT_VAR(PARSE_REQUIRED_LIBS_NAMES) - PRINT_VAR(TPL_${TPL_NAME}_INCLUDE_DIRS) - PRINT_VAR(TPL_${TPL_NAME}_LIBRARIES) - ENDIF() + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + message("TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES: ${TPL_NAME}") + print_var(PARSE_REQUIRED_HEADERS) + print_var(PARSE_REQUIRED_LIBS_NAMES) + print_var(TPL_${TPL_NAME}_INCLUDE_DIRS) + print_var(TPL_${TPL_NAME}_LIBRARIES) + endif() - IF (TPL_TENTATIVE_ENABLE_${TPL_NAME}) - MESSAGE("-- Attempting to tentatively enable TPL '${TPL_NAME}' ...") - SET(ERROR_MSG_MODE) - ELSE() - SET(ERROR_MSG_MODE SEND_ERROR) - ENDIF() + if (TPL_TENTATIVE_ENABLE_${TPL_NAME}) + message("-- Attempting to tentatively enable TPL '${TPL_NAME}' ...") + set(ERROR_MSG_MODE) + else() + set(ERROR_MSG_MODE SEND_ERROR) + endif() # # User options # - IF (PARSE_REQUIRED_LIBS_NAMES) + if (PARSE_REQUIRED_LIBS_NAMES) # Library directories - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "List of semi-colon separated paths to look for the TPL ${TPL_NAME}" - " libraries. This list of paths will be passed into a FIND_LIBRARY(...)" + " libraries. This list of paths will be passed into a find_library(...)" " command to find the libraries listed in ${TPL_NAME}_LIBRARY_NAMES." " Note that this set of paths is also the default value used for" " ${TPL_NAME}_LIBRARY_DIRS. Therefore, if the headers exist in the" @@ -311,194 +311,194 @@ FUNCTION(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES TPL_NAME) " ${TPL_NAME}_LIBRARY_DIRS." ) - ADVANCED_SET(${TPL_NAME}_LIBRARY_DIRS "" CACHE PATH ${DOCSTR}) - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - PRINT_VAR(${TPL_NAME}_LIBRARY_DIRS) - ENDIF() + advanced_set(${TPL_NAME}_LIBRARY_DIRS "" CACHE PATH ${DOCSTR}) + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + print_var(${TPL_NAME}_LIBRARY_DIRS) + endif() # Libraries - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "List of semi-colon separated names of libraries needed to link to for" " the TPL ${TPL_NAME}. This list of libraries will be search for in" - " FIND_LIBRARY(...) calls along with the directories specified with" + " find_library(...) calls along with the directories specified with" " ${TPL_NAME}_LIBRARY_DIRS. NOTE: This is not the final list of libraries" " used for linking. That is specified by TPL_${TPL_NAME}_LIBRARIES!" ) - ADVANCED_SET(${TPL_NAME}_LIBRARY_NAMES ${PARSE_REQUIRED_LIBS_NAMES} + advanced_set(${TPL_NAME}_LIBRARY_NAMES ${PARSE_REQUIRED_LIBS_NAMES} CACHE STRING ${DOCSTR}) - SPLIT("${${TPL_NAME}_LIBRARY_NAMES}" "," ${TPL_NAME}_LIBRARY_NAMES) - PRINT_VAR(${TPL_NAME}_LIBRARY_NAMES) + split("${${TPL_NAME}_LIBRARY_NAMES}" "," ${TPL_NAME}_LIBRARY_NAMES) + print_var(${TPL_NAME}_LIBRARY_NAMES) # Let the user override what the names of the libraries which might # actually mean that no libraries are searched for. - SET(REQUIRED_LIBS_NAMES ${${TPL_NAME}_LIBRARY_NAMES}) + set(REQUIRED_LIBS_NAMES ${${TPL_NAME}_LIBRARY_NAMES}) - IF (${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS) - SET(MUST_FIND_ALL_LIBS TRUE) - ELSE() - SET(MUST_FIND_ALL_LIBS ${PARSE_MUST_FIND_ALL_LIBS}) - ENDIF() + if (${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS) + set(MUST_FIND_ALL_LIBS TRUE) + else() + set(MUST_FIND_ALL_LIBS ${PARSE_MUST_FIND_ALL_LIBS}) + endif() - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - PRINT_VAR(${TPL_NAME}_LIBRARY_NAMES) - PRINT_VAR(REQUIRED_LIBS_NAMES) - ENDIF() + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + print_var(${TPL_NAME}_LIBRARY_NAMES) + print_var(REQUIRED_LIBS_NAMES) + endif() - ELSE() + else() - SET(${TPL_NAME}_LIBRARY_DIRS) # Just to ignore below! + set(${TPL_NAME}_LIBRARY_DIRS) # Just to ignore below! - ENDIF() + endif() # Include directories - IF (PARSE_REQUIRED_HEADERS) + if (PARSE_REQUIRED_HEADERS) - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "List of semi-colon separated paths to look for the TPL ${TPL_NAME}" - " headers. This list of paths will be passed into a FIND_PATH(...)" + " headers. This list of paths will be passed into a find_path(...)" " command to find the headers for ${TPL_NAME} (which are known in advance)." ) - ADVANCED_SET(${TPL_NAME}_INCLUDE_DIRS ${${TPL_NAME}_LIBRARY_DIRS} + advanced_set(${TPL_NAME}_INCLUDE_DIRS ${${TPL_NAME}_LIBRARY_DIRS} CACHE PATH ${DOCSTR}) - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - PRINT_VAR(${TPL_NAME}_LIBRARY_DIRS) - PRINT_VAR(${TPL_NAME}_INCLUDE_DIRS) - PRINT_VAR(PARSE_REQUIRED_HEADERS) - ENDIF() + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + print_var(${TPL_NAME}_LIBRARY_DIRS) + print_var(${TPL_NAME}_INCLUDE_DIRS) + print_var(PARSE_REQUIRED_HEADERS) + endif() - ENDIF() + endif() # # Set the lib extensions to find # # Save the default the first time through - IF (NOT CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT) - SET(TPL_CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES}) - #PRINT_VAR(TPL_CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT) - ENDIF() + if (NOT CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT) + set(TPL_CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES}) + #print_var(TPL_CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT) + endif() - #PRINT_VAR(TPL_FIND_SHARED_LIBS) - #PRINT_VAR(CMAKE_FIND_LIBRARY_SUFFIXES) + #print_var(TPL_FIND_SHARED_LIBS) + #print_var(CMAKE_FIND_LIBRARY_SUFFIXES) # Set libraries to find - IF (TPL_FIND_SHARED_LIBS) + if (TPL_FIND_SHARED_LIBS) # The default should be to find shared libs first - SET(TPL_CMAKE_FIND_LIBRARY_SUFFIXES ${TPL_CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT}) - ELSE() - IF (WIN32) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a) - ELSE() - SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ) - ENDIF() - ENDIF() - #PRINT_VAR(CMAKE_FIND_LIBRARY_SUFFIXES) + set(TPL_CMAKE_FIND_LIBRARY_SUFFIXES ${TPL_CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT}) + else() + if (WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) + endif() + endif() + #print_var(CMAKE_FIND_LIBRARY_SUFFIXES) # # Direct build options # - SET(_${TPL_NAME}_ENABLE_SUCCESS TRUE) + set(_${TPL_NAME}_ENABLE_SUCCESS TRUE) - IF (REQUIRED_LIBS_NAMES) + if (REQUIRED_LIBS_NAMES) # Libraries - IF (MUST_FIND_ALL_LIBS) - SET(LIB_NOT_FOUND_MSG_PREFIX "ERROR:") - ELSE() - SET(LIB_NOT_FOUND_MSG_PREFIX "NOTE:") - ENDIF() + if (MUST_FIND_ALL_LIBS) + set(LIB_NOT_FOUND_MSG_PREFIX "ERROR:") + else() + set(LIB_NOT_FOUND_MSG_PREFIX "NOTE:") + endif() - IF (NOT TPL_${TPL_NAME}_LIBRARIES) + if (NOT TPL_${TPL_NAME}_LIBRARIES) - IF (MUST_FIND_ALL_LIBS) - MESSAGE("-- Must find at least one lib in each of the" + if (MUST_FIND_ALL_LIBS) + message("-- Must find at least one lib in each of the" " lib sets \"${REQUIRED_LIBS_NAMES}\"") - ENDIF() + endif() - MESSAGE( "-- Searching for libs in ${TPL_NAME}_LIBRARY_DIRS='${${TPL_NAME}_LIBRARY_DIRS}'") + message( "-- Searching for libs in ${TPL_NAME}_LIBRARY_DIRS='${${TPL_NAME}_LIBRARY_DIRS}'") - SET(LIBRARIES_FOUND) + set(LIBRARIES_FOUND) - FOREACH(LIBNAME_SET ${${TPL_NAME}_LIBRARY_NAMES}) + foreach(LIBNAME_SET ${${TPL_NAME}_LIBRARY_NAMES}) - MESSAGE("-- Searching for a lib in the set \"${LIBNAME_SET}\":") + message("-- Searching for a lib in the set \"${LIBNAME_SET}\":") - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - PRINT_VAR(LIBNAME_SET) - ENDIF() + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + print_var(LIBNAME_SET) + endif() - SET(LIBNAME_LIST ${LIBNAME_SET}) - SEPARATE_ARGUMENTS(LIBNAME_LIST) + set(LIBNAME_LIST ${LIBNAME_SET}) + separate_arguments(LIBNAME_LIST) - SET(LIBNAME_SET_LIB) + set(LIBNAME_SET_LIB) - FOREACH(LIBNAME ${LIBNAME_LIST}) + foreach(LIBNAME ${LIBNAME_LIST}) - MESSAGE("-- Searching for lib '${LIBNAME}' ...") + message("-- Searching for lib '${LIBNAME}' ...") - IF (${TPL_NAME}_LIBRARY_DIRS) - SET(PATHS_ARG PATHS ${${TPL_NAME}_LIBRARY_DIRS}) - ELSE() - SET(PATHS_ARG PATHS) - ENDIF() + if (${TPL_NAME}_LIBRARY_DIRS) + set(PATHS_ARG PATHS ${${TPL_NAME}_LIBRARY_DIRS}) + else() + set(PATHS_ARG PATHS) + endif() - SET_NOTFOUND(_${TPL_NAME}_${LIBNAME}_LIBRARY) - FIND_LIBRARY( _${TPL_NAME}_${LIBNAME}_LIBRARY + set_notfound(_${TPL_NAME}_${LIBNAME}_LIBRARY) + find_library( _${TPL_NAME}_${LIBNAME}_LIBRARY NAMES ${LIBNAME} ${PATHS_ARG} NO_DEFAULT_PATH ) - FIND_LIBRARY( _${TPL_NAME}_${LIBNAME}_LIBRARY + find_library( _${TPL_NAME}_${LIBNAME}_LIBRARY NAMES ${LIBNAME} ) - MARK_AS_ADVANCED(_${TPL_NAME}_${LIBNAME}_LIBRARY) + mark_as_advanced(_${TPL_NAME}_${LIBNAME}_LIBRARY) - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - PRINT_VAR(_${TPL_NAME}_${LIBNAME}_LIBRARY) - ENDIF() + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + print_var(_${TPL_NAME}_${LIBNAME}_LIBRARY) + endif() - IF (_${TPL_NAME}_${LIBNAME}_LIBRARY) - MESSAGE("-- Found lib '${_${TPL_NAME}_${LIBNAME}_LIBRARY}'") - SET(LIBNAME_SET_LIB ${_${TPL_NAME}_${LIBNAME}_LIBRARY}) - BREAK() - ENDIF() + if (_${TPL_NAME}_${LIBNAME}_LIBRARY) + message("-- Found lib '${_${TPL_NAME}_${LIBNAME}_LIBRARY}'") + set(LIBNAME_SET_LIB ${_${TPL_NAME}_${LIBNAME}_LIBRARY}) + break() + endif() - ENDFOREACH() + endforeach() - IF (NOT LIBNAME_SET_LIB) - MESSAGE( + if (NOT LIBNAME_SET_LIB) + message( "-- ${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) - ELSE() - BREAK() - ENDIF() - ENDIF() + if (MUST_FIND_ALL_LIBS) + set(_${TPL_NAME}_ENABLE_SUCCESS FALSE) + else() + break() + endif() + endif() - APPEND_SET(LIBRARIES_FOUND ${LIBNAME_SET_LIB}) + append_set(LIBRARIES_FOUND ${LIBNAME_SET_LIB}) - ENDFOREACH() + endforeach() - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "List of semi-colon separated full paths to the libraries for the TPL" " ${TPL_NAME}. This is the final variable that is used in the link" " commands. The user variable ${TPL_NAME}_LIBRARY_DIRS is used to look" " for the know library names but but is just a suggestion." " This variable, however, is the final value and will not be touched." ) - ADVANCED_SET( TPL_${TPL_NAME}_LIBRARIES ${LIBRARIES_FOUND} + advanced_set( TPL_${TPL_NAME}_LIBRARIES ${LIBRARIES_FOUND} CACHE FILEPATH ${DOCSTR} FORCE) # Above, we have to force the set in case the find failed the last # configure in which case this cache var will be empty. NOTE: If the # user specified a non-empty TPL_${TPL_NAME}_LIBRARIES, then we would # never get here in the first place! - IF (NOT TPL_${TPL_NAME}_LIBRARIES OR NOT _${TPL_NAME}_ENABLE_SUCCESS) - MESSAGE( + if (NOT TPL_${TPL_NAME}_LIBRARIES OR NOT _${TPL_NAME}_ENABLE_SUCCESS) + message( "-- ERROR: Could not find the libraries for the TPL '${TPL_NAME}'!") - MESSAGE( + message( "-- TIP: If the TPL '${TPL_NAME}' is on your system then you can set:\n" " -D${TPL_NAME}_LIBRARY_DIRS=';;...'\n" " to point to the directories where these libraries may be found.\n" @@ -508,91 +508,91 @@ FUNCTION(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES TPL_NAME) " bypass any search for libraries and these libraries will be used without\n" " question in the build. (But this will result in a build-time error\n" " if not all of the necessary symbols are found.)") - TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_HANDLE_FAIL() - ENDIF() + tribits_tpl_find_include_dirs_and_libraries_handle_fail() + endif() - ENDIF() + endif() # Print the final value to be used *always* - MESSAGE("-- TPL_${TPL_NAME}_LIBRARIES='${TPL_${TPL_NAME}_LIBRARIES}'") + message("-- TPL_${TPL_NAME}_LIBRARIES='${TPL_${TPL_NAME}_LIBRARIES}'") - ELSE() + else() # There are no libraries so set the libraries to null but don't # change the cache which should not even have this variable in it. # This set command is only to follow the standards for the package # support CMake code. - GLOBAL_NULL_SET(TPL_${TPL_NAME}_LIBRARIES) + global_null_set(TPL_${TPL_NAME}_LIBRARIES) - ENDIF() + endif() # Include directories - IF (PARSE_REQUIRED_HEADERS) + if (PARSE_REQUIRED_HEADERS) - IF (NOT TPL_${TPL_NAME}_INCLUDE_DIRS) + if (NOT TPL_${TPL_NAME}_INCLUDE_DIRS) - IF (PARSE_MUST_FIND_ALL_HEADERS) - MESSAGE("-- Must find at least one header in each of the" + if (PARSE_MUST_FIND_ALL_HEADERS) + message("-- Must find at least one header in each of the" " header sets \"${PARSE_REQUIRED_HEADERS}\"") - ENDIF() + endif() - MESSAGE( "-- Searching for headers in ${TPL_NAME}_INCLUDE_DIRS='${${TPL_NAME}_INCLUDE_DIRS}'") + message( "-- Searching for headers in ${TPL_NAME}_INCLUDE_DIRS='${${TPL_NAME}_INCLUDE_DIRS}'") - FOREACH(INCLUDE_FILE_SET ${PARSE_REQUIRED_HEADERS}) + foreach(INCLUDE_FILE_SET ${PARSE_REQUIRED_HEADERS}) - MESSAGE("-- Searching for a header file in the set \"${INCLUDE_FILE_SET}\":") + message("-- Searching for a header file in the set \"${INCLUDE_FILE_SET}\":") - SET(INCLUDE_FILE_LIST ${INCLUDE_FILE_SET}) - SEPARATE_ARGUMENTS(INCLUDE_FILE_LIST) - SET(INCLUDE_FILE_SET_PATH) # Start out as empty list + set(INCLUDE_FILE_LIST ${INCLUDE_FILE_SET}) + separate_arguments(INCLUDE_FILE_LIST) + set(INCLUDE_FILE_SET_PATH) # Start out as empty list - FOREACH(INCLUDE_FILE ${INCLUDE_FILE_LIST}) + foreach(INCLUDE_FILE ${INCLUDE_FILE_LIST}) - MESSAGE("-- Searching for header '${INCLUDE_FILE}' ...") + message("-- Searching for header '${INCLUDE_FILE}' ...") - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - PRINT_VAR(INCLUDE_FILE) - ENDIF() + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + print_var(INCLUDE_FILE) + endif() - SET_NOTFOUND(_${TPL_NAME}_${INCLUDE_FILE}_PATH) - FIND_PATH( _${TPL_NAME}_${INCLUDE_FILE}_PATH + set_notfound(_${TPL_NAME}_${INCLUDE_FILE}_PATH) + find_path( _${TPL_NAME}_${INCLUDE_FILE}_PATH NAMES ${INCLUDE_FILE} PATHS ${${TPL_NAME}_INCLUDE_DIRS} NO_DEFAULT_PATH) - FIND_PATH( _${TPL_NAME}_${INCLUDE_FILE}_PATH + find_path( _${TPL_NAME}_${INCLUDE_FILE}_PATH NAMES ${INCLUDE_FILE} ) - MARK_AS_ADVANCED(_${TPL_NAME}_${INCLUDE_FILE}_PATH) + mark_as_advanced(_${TPL_NAME}_${INCLUDE_FILE}_PATH) - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - PRINT_VAR(_${TPL_NAME}_${INCLUDE_FILE}_PATH) - ENDIF() + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + print_var(_${TPL_NAME}_${INCLUDE_FILE}_PATH) + endif() - IF(_${TPL_NAME}_${INCLUDE_FILE}_PATH) - MESSAGE( "-- Found header '${_${TPL_NAME}_${INCLUDE_FILE}_PATH}/${INCLUDE_FILE}'") - APPEND_SET(INCLUDE_FILE_SET_PATH ${_${TPL_NAME}_${INCLUDE_FILE}_PATH}) - BREAK() - ENDIF() + if(_${TPL_NAME}_${INCLUDE_FILE}_PATH) + message( "-- Found header '${_${TPL_NAME}_${INCLUDE_FILE}_PATH}/${INCLUDE_FILE}'") + append_set(INCLUDE_FILE_SET_PATH ${_${TPL_NAME}_${INCLUDE_FILE}_PATH}) + break() + endif() - ENDFOREACH() + endforeach() - IF(NOT INCLUDE_FILE_SET_PATH) - MESSAGE("-- ERROR: Could not find a header file in" + if(NOT INCLUDE_FILE_SET_PATH) + message("-- ERROR: Could not find a header file in" " the set \"${INCLUDE_FILE_SET}\"") - IF(PARSE_MUST_FIND_ALL_HEADERS) - SET(_${TPL_NAME}_ENABLE_SUCCESS FALSE) - ENDIF() - ENDIF() + if(PARSE_MUST_FIND_ALL_HEADERS) + set(_${TPL_NAME}_ENABLE_SUCCESS FALSE) + endif() + endif() - APPEND_SET(INCLUDES_FOUND ${INCLUDE_FILE_SET_PATH}) + append_set(INCLUDES_FOUND ${INCLUDE_FILE_SET_PATH}) - ENDFOREACH(INCLUDE_FILE_SET ${PARSE_REQUIRED_HEADERS}) + endforeach(INCLUDE_FILE_SET ${PARSE_REQUIRED_HEADERS}) - IF (INCLUDES_FOUND) - LIST(REMOVE_DUPLICATES INCLUDES_FOUND) - ENDIF() + if (INCLUDES_FOUND) + list(REMOVE_DUPLICATES INCLUDES_FOUND) + endif() - MULTILINE_SET(DOCSTR + multiline_set(DOCSTR "List of semi-colon separated paths to append to the compile invocations" " to find the headers for the TPL ${TPL_NAME}. This is the final variable" " that is used in the build commands. The user variable ${TPL_NAME}_INCLUDE_DIRS" @@ -600,17 +600,17 @@ FUNCTION(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES TPL_NAME) " This variable, however, is the final value and will not be touched." ) - ADVANCED_SET(TPL_${TPL_NAME}_INCLUDE_DIRS ${INCLUDES_FOUND} + advanced_set(TPL_${TPL_NAME}_INCLUDE_DIRS ${INCLUDES_FOUND} CACHE PATH ${DOCSTR} FORCE) # Above, we have to force the set in case the find failed the last # configure in which case this cache var will be empty. NOTE: If the # user specified a non-empty TPL_${TPL_NAME}_INCLUDE_DIRS, then we would # never get here in the first place! - IF (NOT TPL_${TPL_NAME}_INCLUDE_DIRS OR NOT _${TPL_NAME}_ENABLE_SUCCESS) - MESSAGE( + if (NOT TPL_${TPL_NAME}_INCLUDE_DIRS OR NOT _${TPL_NAME}_ENABLE_SUCCESS) + message( "-- ERROR: Could not find the include directories for TPL '${TPL_NAME}'!") - MESSAGE( + message( "-- TIP: If the TPL '${TPL_NAME}' is on your system then you can set:\n" " -D${TPL_NAME}_INCLUDE_DIRS=';;...'\n" " to point to directories where these header files may be found.\n" @@ -621,77 +621,77 @@ FUNCTION(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES TPL_NAME) " question in the build. (But this will result in a build-time error\n" " obviously if the necessary header files are not found in these\n" " include directories.)") - TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_HANDLE_FAIL() - ENDIF() + tribits_tpl_find_include_dirs_and_libraries_handle_fail() + endif() - IF (TPL_${TPL_NAME}_INCLUDE_DIRS) - MESSAGE("-- Found TPL '${TPL_NAME}' include dirs '${TPL_${TPL_NAME}_INCLUDE_DIRS}'") - ENDIF() - ELSE() + if (TPL_${TPL_NAME}_INCLUDE_DIRS) + message("-- Found TPL '${TPL_NAME}' include dirs '${TPL_${TPL_NAME}_INCLUDE_DIRS}'") + endif() + else() # TPL_${TPL_NAME}_INCLUDE_DIRS is already in the cache so leave it alone! - ENDIF() + endif() # Print the final value to be used *always* - MESSAGE("-- TPL_${TPL_NAME}_INCLUDE_DIRS='${TPL_${TPL_NAME}_INCLUDE_DIRS}'") + message("-- TPL_${TPL_NAME}_INCLUDE_DIRS='${TPL_${TPL_NAME}_INCLUDE_DIRS}'") - ELSE() + else() - IF (${TPL_NAME}_INCLUDE_DIRS) - ADVANCED_SET(TPL_${TPL_NAME}_INCLUDE_DIRS ${${TPL_NAME}_INCLUDE_DIRS} + if (${TPL_NAME}_INCLUDE_DIRS) + advanced_set(TPL_${TPL_NAME}_INCLUDE_DIRS ${${TPL_NAME}_INCLUDE_DIRS} CACHE PATH "User provided include dirs in the absence of include files.") - ELSE() + else() # Library has no header files, no user override, so just set them to null - GLOBAL_NULL_SET(TPL_${TPL_NAME}_INCLUDE_DIRS) - ENDIF() + global_null_set(TPL_${TPL_NAME}_INCLUDE_DIRS) + endif() - ENDIF() + endif() # Set library directories to null always. We do this because # the package support code expects this variable and it is used # for package dependencies. Therefore, we need it to allow # TPLs and internal packages to be treated in the same way. - GLOBAL_NULL_SET(TPL_${TPL_NAME}_LIBRARY_DIRS) + global_null_set(TPL_${TPL_NAME}_LIBRARY_DIRS) - IF (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) - PRINT_VAR(TPL_${TPL_NAME}_LIBRARY_DIRS) - ENDIF() + if (TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_VERBOSE) + print_var(TPL_${TPL_NAME}_LIBRARY_DIRS) + endif() # 2011/05/09: rabartl: ToDo: Remove this above variable from everywhere! - #PRINT_VAR(TPL_TENTATIVE_ENABLE_${TPL_NAME}) - #PRINT_VAR(_${TPL_NAME}_ENABLE_SUCCESS) - IF (TPL_TENTATIVE_ENABLE_${TPL_NAME}) - IF (_${TPL_NAME}_ENABLE_SUCCESS) - IF (NOT PARSE_NO_PRINT_ENABLE_SUCCESS_FAIL) - MESSAGE("-- Attempt to tentatively enable TPL '${TPL_NAME}' passed!") - ENDIF() - ELSE() - IF (NOT PARSE_NO_PRINT_ENABLE_SUCCESS_FAIL) - MESSAGE("-- Attempt to tentatively enable TPL '${TPL_NAME}' failed!" + #print_var(TPL_TENTATIVE_ENABLE_${TPL_NAME}) + #print_var(_${TPL_NAME}_ENABLE_SUCCESS) + if (TPL_TENTATIVE_ENABLE_${TPL_NAME}) + if (_${TPL_NAME}_ENABLE_SUCCESS) + if (NOT PARSE_NO_PRINT_ENABLE_SUCCESS_FAIL) + message("-- Attempt to tentatively enable TPL '${TPL_NAME}' passed!") + endif() + else() + if (NOT PARSE_NO_PRINT_ENABLE_SUCCESS_FAIL) + message("-- Attempt to tentatively enable TPL '${TPL_NAME}' failed!" " Setting TPL_ENABLE_${TPL_NAME}=OFF") - ENDIF() - SET(TPL_ENABLE_${TPL_NAME} OFF CACHE STRING + endif() + set(TPL_ENABLE_${TPL_NAME} OFF CACHE STRING "Forced off since tentative enable failed!" FORCE) - ENDIF() - ENDIF() + endif() + endif() - IF (_${TPL_NAME}_ENABLE_SUCCESS) - GLOBAL_SET(TPL_${TPL_NAME}_NOT_FOUND FALSE) - ENDIF() + if (_${TPL_NAME}_ENABLE_SUCCESS) + global_set(TPL_${TPL_NAME}_NOT_FOUND FALSE) + endif() -ENDFUNCTION() +endfunction() # -# @FUNCTION: TRIBITS_TPL_TENTATIVELY_ENABLE() +# @FUNCTION: tribits_tpl_tentatively_enable() # # Function that sets up for an optionally enabled TPL that is attempted to be # enabled but will be disabled if all of the parts are not found. # # Usage:: # -# TRIBITS_TPL_TENTATIVELY_ENABLE() +# tribits_tpl_tentatively_enable() # # This function can be called from any CMakeLists.txt file to put a TPL in # tentative enable mode. But typically, it is called from an SE Package's @@ -712,33 +712,33 @@ ENDFUNCTION() # disabled (i.e. ``-D TPL_ENABLE_=OFF``), then this function has no # effect and the TPL will be unconditionally enabled or disabled. # -FUNCTION(TRIBITS_TPL_TENTATIVELY_ENABLE TPL_NAME) +function(tribits_tpl_tentatively_enable TPL_NAME) - IF ("${TPL_ENABLE_${TPL_NAME}}" STREQUAL "") + if ("${TPL_ENABLE_${TPL_NAME}}" STREQUAL "") # The TPL's enable status has not been set so tentatively enable it. - SET(TPL_ENABLE_${TPL_NAME} ON CACHE STRING - "Set by TRIBITS_TPL_TENTATIVELY_ENABLE()" FORCE) - ADVANCED_SET(TPL_TENTATIVE_ENABLE_${TPL_NAME} ON CACHE STRING - "Set by TRIBITS_TPL_TENTATIVELY_ENABLE()" FORCE) - ELSE() + set(TPL_ENABLE_${TPL_NAME} ON CACHE STRING + "Set by tribits_tpl_tentatively_enable()" FORCE) + advanced_set(TPL_TENTATIVE_ENABLE_${TPL_NAME} ON CACHE STRING + "Set by tribits_tpl_tentatively_enable()" FORCE) + else() # The TPL's enable status has already be hard set to be ON or OFF so we # will leave it alone. - ENDIF() + endif() -ENDFUNCTION() +endfunction() # # Utility macro # -MACRO(TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES_HANDLE_FAIL) - SET(_${TPL_NAME}_ENABLE_SUCCESS FALSE) - GLOBAL_SET(TPL_${TPL_NAME}_NOT_FOUND TRUE) - MESSAGE( +macro(tribits_tpl_find_include_dirs_and_libraries_handle_fail) + set(_${TPL_NAME}_ENABLE_SUCCESS FALSE) + global_set(TPL_${TPL_NAME}_NOT_FOUND TRUE) + message( "-- ERROR: Failed finding all of the parts of TPL '${TPL_NAME}' (see above), Aborting!\n" ) - IF ("${ERROR_MSG_MODE}" STREQUAL "SEND_ERROR") - #MESSAGE("ERROR_MSG_MODE=SEND_ERROR, Aborting") - RETURN() - ENDIF() -ENDMACRO() + if ("${ERROR_MSG_MODE}" STREQUAL "SEND_ERROR") + #message("ERROR_MSG_MODE=SEND_ERROR, Aborting") + return() + endif() +endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsVerbosePrintVar.cmake b/cmake/tribits/core/package_arch/TribitsVerbosePrintVar.cmake index 8ddff4a9ede4..ef4496c92d4b 100644 --- a/cmake/tribits/core/package_arch/TribitsVerbosePrintVar.cmake +++ b/cmake/tribits/core/package_arch/TribitsVerbosePrintVar.cmake @@ -38,35 +38,35 @@ # @HEADER -IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) +if (${PROJECT_NAME}_VERBOSE_CONFIGURE) # -# @FUNCTION: TRIBITS_VERBOSE_PRINT_VAR() +# @FUNCTION: tribits_verbose_print_var() # # print a variable giving its name then value if # ``${PROJECT_NAME}_VERBOSE_CONFIGURE=TRUE``. # # Usage:: # -# TRIBITS_VERBOSE_PRINT_VAR() +# tribits_verbose_print_var() # # This prints:: # -# MESSAGE("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") +# message("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") # # The variable ```` can be defined or undefined or empty. This uses # an explicit "-- " line prefix so that it prints nice even on Windows CMake. # -FUNCTION(TRIBITS_VERBOSE_PRINT_VAR VARIBLE_NAME) - MESSAGE("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") -ENDFUNCTION() +function(tribits_verbose_print_var VARIBLE_NAME) + message("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") +endfunction() -ELSE() # ${PROJECT_NAME}_VERBOSE_CONFIGURE +else() # ${PROJECT_NAME}_VERBOSE_CONFIGURE -FUNCTION(TRIBITS_VERBOSE_PRINT_VAR VARIBLE_NAME) -ENDFUNCTION() +function(tribits_verbose_print_var VARIBLE_NAME) +endfunction() -ENDIF() # ${PROJECT_NAME}_VERBOSE_CONFIGURE +endif() # ${PROJECT_NAME}_VERBOSE_CONFIGURE diff --git a/cmake/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake b/cmake/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake index bba1b347d86f..537ff85e9558 100644 --- a/cmake/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake +++ b/cmake/tribits/core/package_arch/TribitsWriteClientExportFiles.cmake @@ -37,7 +37,7 @@ # ************************************************************************ # @HEADER -INCLUDE(TribitsGeneralMacros) +include(TribitsGeneralMacros) ### ### WARNING: See "NOTES TO DEVELOPERS" at the bottom of the file @@ -48,15 +48,15 @@ INCLUDE(TribitsGeneralMacros) # This function will take a list and turn it into a space separated string # adding the prefix to the front of every entry. # -FUNCTION(TRIBITS_LIST_TO_STRING LIST PREFIX OUTPUT_STRING) - SET(LIST_STRING "") +function(tribits_list_to_string LIST PREFIX OUTPUT_STRING) + set(LIST_STRING "") - FOREACH(ITEM ${LIST}) - SET(LIST_STRING "${LIST_STRING} ${PREFIX}${ITEM}") - ENDFOREACH() + foreach(ITEM ${LIST}) + set(LIST_STRING "${LIST_STRING} ${PREFIX}${ITEM}") + endforeach() - SET(${OUTPUT_STRING} ${LIST_STRING} PARENT_SCOPE) -ENDFUNCTION() + set(${OUTPUT_STRING} ${LIST_STRING} PARENT_SCOPE) +endfunction() # # This function will take a list of libraries and turn it into a space @@ -66,20 +66,20 @@ ENDFUNCTION() # with any decorations the system uses. When an absolute path is given # the entry is used verbatim. # -FUNCTION(TRIBITS_LIBRARY_LIST_TO_STRING LIST PREFIX OUTPUT_STRING) - SET(LIST_STRING "") +function(tribits_library_list_to_string LIST PREFIX OUTPUT_STRING) + set(LIST_STRING "") - FOREACH(ITEM ${LIST}) - STRING(SUBSTRING ${ITEM} 0 1 OPTION_FLAG) - IF(EXISTS ${ITEM} OR OPTION_FLAG STREQUAL "-") - SET(LIST_STRING "${LIST_STRING} ${ITEM}") - ELSE() - SET(LIST_STRING "${LIST_STRING} ${PREFIX}${ITEM}") - ENDIF() - ENDFOREACH() + foreach(ITEM ${LIST}) + string(SUBSTRING ${ITEM} 0 1 OPTION_FLAG) + if(EXISTS ${ITEM} OR OPTION_FLAG STREQUAL "-") + set(LIST_STRING "${LIST_STRING} ${ITEM}") + else() + set(LIST_STRING "${LIST_STRING} ${PREFIX}${ITEM}") + endif() + endforeach() - SET(${OUTPUT_STRING} ${LIST_STRING} PARENT_SCOPE) -ENDFUNCTION() + set(${OUTPUT_STRING} ${LIST_STRING} PARENT_SCOPE) +endfunction() # # CMAKE_CURRENT_LIST_DIR is not defined in CMake versions < 2.8.3, but the @@ -95,35 +95,35 @@ ENDFUNCTION() # to ensure that the CMAKE_CURRENT_LIST_DIR will be defined on the installation # target machine, even if it has an older version of cmake. # -FUNCTION(TRIBITS_SET_DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET) - SET(DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET " +function(tribits_set_define_cmake_current_list_dir_code_snippet) + set(DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET " # Include guard -IF (${EXPORT_FILE_VAR_PREFIX}_CONFIG_INCLUDED) - RETURN() -ENDIF() -SET(${EXPORT_FILE_VAR_PREFIX}_CONFIG_INCLUDED TRUE) +if (${EXPORT_FILE_VAR_PREFIX}_CONFIG_INCLUDED) + return() +endif() +set(${EXPORT_FILE_VAR_PREFIX}_CONFIG_INCLUDED TRUE) # Make sure CMAKE_CURRENT_LIST_DIR is usable -IF (NOT DEFINED CMAKE_CURRENT_LIST_DIR) - GET_FILENAME_COMPONENT(_THIS_SCRIPT_PATH \${CMAKE_CURRENT_LIST_FILE} PATH) - SET(CMAKE_CURRENT_LIST_DIR \${_THIS_SCRIPT_PATH}) -ENDIF() +if (NOT DEFINED CMAKE_CURRENT_LIST_DIR) + get_filename_component(_THIS_SCRIPT_PATH \${CMAKE_CURRENT_LIST_FILE} PATH) + set(CMAKE_CURRENT_LIST_DIR \${_THIS_SCRIPT_PATH}) +endif() " PARENT_SCOPE ) -ENDFUNCTION() +endfunction() # -# @FUNCTION: TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES() +# @FUNCTION: tribits_write_flexible_package_client_export_files() # # Utility function for writing ``${PACKAGE_NAME}Config.cmake`` and/or the # ``Makefile.export.${PACKAGE_NAME}`` files for package ``${PACKAGE_NAME}`` # with some greater flexibility than what is provided by the function -# ``TRIBITS_WRITE_PACKAGE_CLIENT_EXPORT_FILES()``. +# ``tribits_write_package_client_export_files()``. # # Usage:: # -# TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES( +# tribits_write_flexible_package_client_export_files( # PACKAGE_NAME # [EXPORT_FILE_VAR_PREFIX ] # [WRITE_CMAKE_CONFIG_FILE ] @@ -180,22 +180,22 @@ ENDFUNCTION() # file but this file needs to be generated for a subset of enabled packages on # the fly during a one-pass configure. # -# NOTE: This function does *not* contain the ``INSTALL()`` commands because +# NOTE: This function does *not* contain the ``install()`` commands because # CMake will not allow those to even be present in scripting mode that is used # for unit testing this function. Instead, the files to be installed are only # generated in the build tree and the install targets are added else where. # -FUNCTION(TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES) +function(tribits_write_flexible_package_client_export_files) - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - MESSAGE("\nTRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES(${ARGN})") - ENDIF() + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + message("\ntribits_write_flexible_package_client_export_files(${ARGN})") + endif() # # A) Process the command-line arguments # - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -207,96 +207,96 @@ FUNCTION(TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - IF (NOT ${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES) - MESSAGE(SEND_ERROR "Error: Can't generate export depenency files because" + if (NOT ${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES) + message(SEND_ERROR "Error: Can't generate export dependency files because" " ${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES is not ON!") - RETURN() - ENDIF() + return() + endif() - SET(PACKAGE_NAME ${PARSE_PACKAGE_NAME}) - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - PRINT_VAR(PACKAGE_NAME) - ENDIF() + set(PACKAGE_NAME ${PARSE_PACKAGE_NAME}) + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + print_var(PACKAGE_NAME) + endif() - SET(EXPORT_FILE_VAR_PREFIX ${PACKAGE_NAME}) - IF (PARSE_EXPORT_FILE_VAR_PREFIX) - SET(EXPORT_FILE_VAR_PREFIX ${PARSE_EXPORT_FILE_VAR_PREFIX}) - ENDIF() - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - PRINT_VAR(EXPORT_FILE_VAR_PREFIX) - ENDIF() + set(EXPORT_FILE_VAR_PREFIX ${PACKAGE_NAME}) + if (PARSE_EXPORT_FILE_VAR_PREFIX) + set(EXPORT_FILE_VAR_PREFIX ${PARSE_EXPORT_FILE_VAR_PREFIX}) + endif() + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + print_var(EXPORT_FILE_VAR_PREFIX) + endif() - TRIBITS_SET_DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET() + tribits_set_define_cmake_current_list_dir_code_snippet() # # B) Get the set of upstream packages for this package that are enabled, # libraries, library dirs, and include dirs # - SET(FULL_PACKAGE_SET "") - SET(FULL_LIBRARY_SET "") - - SET(SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM TRUE) - IF (${PACKAGE_NAME}_INCLUDE_DIRS) - SET(FULL_INCLUDE_DIRS_SET ${${PACKAGE_NAME}_INCLUDE_DIRS}) - SET(FULL_LIBRARY_DIRS_SET ${${PACKAGE_NAME}_LIBRARY_DIRS}) - SET(SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM FALSE) - ELSE() - SET(FULL_INCLUDE_DIRS_SET "") - SET(FULL_LIBRARY_DIRS_SET "") - ENDIF() - - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - PRINT_VAR(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) - ENDIF() - - FOREACH(TRIBITS_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) - - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - PRINT_VAR(TRIBITS_PACKAGE) - IF (${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) - PRINT_VAR(${TRIBITS_PACKAGE}_HAS_NATIVE_LIBRARIES_TO_INSTALL) - ENDIF() - ENDIF() - - SET(APPEND_THE_PACKAGE TRUE) - SET(APPEND_THE_PACKAGE_LIBS TRUE) - - IF (NOT ${TRIBITS_PACKAGE}_HAS_NATIVE_LIBRARIES_TO_INSTALL) - SET(APPEND_THE_PACKAGE_LIBS FALSE) - ENDIF() - - IF (APPEND_THE_PACKAGE) - LIST(APPEND FULL_PACKAGE_SET ${TRIBITS_PACKAGE}) - IF (APPEND_THE_PACKAGE_LIBS) - APPEND_SET(FULL_LIBRARY_SET ${${TRIBITS_PACKAGE}_LIBRARIES}) - IF (SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM) - APPEND_SET(FULL_INCLUDE_DIRS_SET ${${TRIBITS_PACKAGE}_INCLUDE_DIRS}) - APPEND_SET(FULL_LIBRARY_DIRS_SET ${${TRIBITS_PACKAGE}_LIBRARY_DIRS}) - ENDIF() - ELSE() - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - MESSAGE("-- " "Skipping adding the package libs!") - ENDIF() - ENDIF() - ELSE() - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - MESSAGE("-- " "Skipping adding the package!") - ENDIF() - ENDIF() - - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - PRINT_VAR(FULL_PACKAGE_SET) - PRINT_VAR(FULL_LIBRARY_SET) - IF (SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM) - PRINT_VAR(FULL_INCLUDE_DIRS_SET) - PRINT_VAR(FULL_LIBRARY_DIRS_SET) - ENDIF() - ENDIF() - - ENDFOREACH() + set(FULL_PACKAGE_SET "") + set(FULL_LIBRARY_SET "") + + set(SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM TRUE) + if (${PACKAGE_NAME}_INCLUDE_DIRS) + set(FULL_INCLUDE_DIRS_SET ${${PACKAGE_NAME}_INCLUDE_DIRS}) + set(FULL_LIBRARY_DIRS_SET ${${PACKAGE_NAME}_LIBRARY_DIRS}) + set(SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM FALSE) + else() + set(FULL_INCLUDE_DIRS_SET "") + set(FULL_LIBRARY_DIRS_SET "") + endif() + + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + print_var(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) + endif() + + foreach(TRIBITS_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) + + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + print_var(TRIBITS_PACKAGE) + if (${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) + print_var(${TRIBITS_PACKAGE}_HAS_NATIVE_LIBRARIES_TO_INSTALL) + endif() + endif() + + set(APPEND_THE_PACKAGE TRUE) + set(APPEND_THE_PACKAGE_LIBS TRUE) + + if (NOT ${TRIBITS_PACKAGE}_HAS_NATIVE_LIBRARIES_TO_INSTALL) + set(APPEND_THE_PACKAGE_LIBS FALSE) + endif() + + if (APPEND_THE_PACKAGE) + list(APPEND FULL_PACKAGE_SET ${TRIBITS_PACKAGE}) + if (APPEND_THE_PACKAGE_LIBS) + append_set(FULL_LIBRARY_SET ${${TRIBITS_PACKAGE}_LIBRARIES}) + if (SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM) + append_set(FULL_INCLUDE_DIRS_SET ${${TRIBITS_PACKAGE}_INCLUDE_DIRS}) + append_set(FULL_LIBRARY_DIRS_SET ${${TRIBITS_PACKAGE}_LIBRARY_DIRS}) + endif() + else() + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + message("-- " "Skipping adding the package libs!") + endif() + endif() + else() + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + message("-- " "Skipping adding the package!") + endif() + endif() + + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + print_var(FULL_PACKAGE_SET) + print_var(FULL_LIBRARY_SET) + if (SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM) + print_var(FULL_INCLUDE_DIRS_SET) + print_var(FULL_LIBRARY_DIRS_SET) + endif() + endif() + + endforeach() # Must prepend the current package and its libraries itself so that we get # its TPLs libraries. However, if the current package has no native @@ -304,27 +304,27 @@ FUNCTION(TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES) # TPLs. Why would a package list TPLs (with actual libraries) if itself # does not have libraries to export? Note, this does not affect internal # tests and examples which could have TPLs but no native libraries. - IF (${PACKAGE_NAME}_LIBRARIES AND ${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES_TO_INSTALL) - PREPEND_SET(FULL_PACKAGE_SET ${PACKAGE_NAME}) - PREPEND_SET(FULL_LIBRARY_SET ${${PACKAGE_NAME}_LIBRARIES}) - ENDIF() - - IF (SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM) - IF (FULL_INCLUDE_DIRS_SET) - LIST(REMOVE_DUPLICATES FULL_INCLUDE_DIRS_SET) - ENDIF() - IF (FULL_LIBRARY_DIRS_SET) - LIST(REMOVE_DUPLICATES FULL_LIBRARY_DIRS_SET) - ENDIF() - ENDIF() - - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - MESSAGE("-- " "*** Final sets of packages, libs, include dirs, and lib dirs:") - PRINT_VAR(FULL_PACKAGE_SET) - PRINT_VAR(FULL_LIBRARY_SET) - PRINT_VAR(FULL_INCLUDE_DIRS_SET) - PRINT_VAR(FULL_LIBRARY_DIRS_SET) - ENDIF() + if (${PACKAGE_NAME}_LIBRARIES AND ${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES_TO_INSTALL) + prepend_set(FULL_PACKAGE_SET ${PACKAGE_NAME}) + prepend_set(FULL_LIBRARY_SET ${${PACKAGE_NAME}_LIBRARIES}) + endif() + + if (SET_INCLUDE_LIBRARY_DIRS_FROM_UPSTREAM) + if (FULL_INCLUDE_DIRS_SET) + list(REMOVE_DUPLICATES FULL_INCLUDE_DIRS_SET) + endif() + if (FULL_LIBRARY_DIRS_SET) + list(REMOVE_DUPLICATES FULL_LIBRARY_DIRS_SET) + endif() + endif() + + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + message("-- " "*** Final sets of packages, libs, include dirs, and lib dirs:") + print_var(FULL_PACKAGE_SET) + print_var(FULL_LIBRARY_SET) + print_var(FULL_INCLUDE_DIRS_SET) + print_var(FULL_LIBRARY_DIRS_SET) + endif() # # C) Get the set of TPLs for this package that are enabled @@ -332,52 +332,52 @@ FUNCTION(TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES) # C.1) Get the set of enabled TPLs - SET(FULL_TPL_SET "") - FOREACH(TRIBITS_PACKAGE ${FULL_PACKAGE_SET}) - LIST(APPEND FULL_TPL_SET ${${TRIBITS_PACKAGE}_LIB_REQUIRED_DEP_TPLS}) - SET(OPTIONAL_TPLS ${${TRIBITS_PACKAGE}_LIB_OPTIONAL_DEP_TPLS}) - FOREACH(TPL ${OPTIONAL_TPLS}) + set(FULL_TPL_SET "") + foreach(TRIBITS_PACKAGE ${FULL_PACKAGE_SET}) + list(APPEND FULL_TPL_SET ${${TRIBITS_PACKAGE}_LIB_REQUIRED_DEP_TPLS}) + set(OPTIONAL_TPLS ${${TRIBITS_PACKAGE}_LIB_OPTIONAL_DEP_TPLS}) + foreach(TPL ${OPTIONAL_TPLS}) # Only add if support for the optional TPL is enabled in this # package. Don't just check if the TPL is enabled! - IF(${TRIBITS_PACKAGE}_ENABLE_${TPL}) - LIST(APPEND FULL_TPL_SET ${TPL}) - ENDIF() - ENDFOREACH() - ENDFOREACH() - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - PRINT_VAR(FULL_TPL_SET) - ENDIF() + if(${TRIBITS_PACKAGE}_ENABLE_${TPL}) + list(APPEND FULL_TPL_SET ${TPL}) + endif() + endforeach() + endforeach() + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + print_var(FULL_TPL_SET) + endif() # C.2) Sort the TPLs according to the master TPL list #We will use the complete list of supported tpls for the project #to help us create a properly ordered list of tpls. - IF (FULL_TPL_SET) - SET(ORDERED_FULL_TPL_SET ${FULL_TPL_SET}) - TRIBITS_SORT_LIST_ACCORDING_TO_MASTER_LIST("${${PROJECT_NAME}_REVERSE_TPLS}" + if (FULL_TPL_SET) + set(ORDERED_FULL_TPL_SET ${FULL_TPL_SET}) + tribits_sort_list_according_to_master_list("${${PROJECT_NAME}_REVERSE_TPLS}" ORDERED_FULL_TPL_SET) - ENDIF() + endif() - IF (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) - PRINT_VAR(ORDERED_FULL_TPL_SET) - ENDIF() + if (TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES_DEBUG_DUMP) + print_var(ORDERED_FULL_TPL_SET) + endif() # # D) Get the libraries, library dirs, and the include dirs for the # upstream enabled TPLs # - SET(${PACKAGE_NAME}_TPL_LIBRARIES "") - SET(${PACKAGE_NAME}_TPL_INCLUDE_DIRS "") - SET(${PACKAGE_NAME}_TPL_LIBRARY_DIRS "") - FOREACH(TPL ${ORDERED_FULL_TPL_SET}) - LIST(APPEND ${PACKAGE_NAME}_TPL_LIBRARIES ${TPL_${TPL}_LIBRARIES}) - LIST(APPEND ${PACKAGE_NAME}_TPL_INCLUDE_DIRS ${TPL_${TPL}_INCLUDE_DIRS}) - LIST(APPEND ${PACKAGE_NAME}_TPL_LIBRARY_DIRS ${TPL_${TPL}_LIBRARY_DIRS}) - ENDFOREACH() + set(${PACKAGE_NAME}_TPL_LIBRARIES "") + set(${PACKAGE_NAME}_TPL_INCLUDE_DIRS "") + set(${PACKAGE_NAME}_TPL_LIBRARY_DIRS "") + foreach(TPL ${ORDERED_FULL_TPL_SET}) + list(APPEND ${PACKAGE_NAME}_TPL_LIBRARIES ${TPL_${TPL}_LIBRARIES}) + list(APPEND ${PACKAGE_NAME}_TPL_INCLUDE_DIRS ${TPL_${TPL}_INCLUDE_DIRS}) + list(APPEND ${PACKAGE_NAME}_TPL_LIBRARY_DIRS ${TPL_${TPL}_LIBRARY_DIRS}) + endforeach() # Generate a note discouraging editing of the Config.cmake file - SET(DISCOURAGE_EDITING "Do not edit: This file was generated automatically by CMake.") + set(DISCOURAGE_EDITING "Do not edit: This file was generated automatically by CMake.") # # E) Deal with the library rpath issues with shared libs @@ -386,11 +386,11 @@ FUNCTION(TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES) # Write the specification of the rpath if necessary. This is only needed if # we're building shared libraries. - IF(BUILD_SHARED_LIBS) - STRING(REPLACE ";" ":" SHARED_LIB_RPATH_COMMAND "${FULL_LIBRARY_DIRS_SET}") - SET(SHARED_LIB_RPATH_COMMAND + if(BUILD_SHARED_LIBS) + string(REPLACE ";" ":" SHARED_LIB_RPATH_COMMAND "${FULL_LIBRARY_DIRS_SET}") + set(SHARED_LIB_RPATH_COMMAND ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}${SHARED_LIB_RPATH_COMMAND}) - ENDIF() + endif() # # F) Create the contents of the cmake Config.cmake file for the build tree @@ -401,18 +401,18 @@ FUNCTION(TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES) # nice. # - IF (PARSE_WRITE_CMAKE_CONFIG_FILE) + if (PARSE_WRITE_CMAKE_CONFIG_FILE) # Custom code in configuration file. - SET(PACKAGE_CONFIG_CODE "") + set(PACKAGE_CONFIG_CODE "") # Include configurations of dependent packages - FOREACH(DEP_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) + foreach(DEP_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) # Could use file(RELATIVE_PATH ...), but probably not necessary # since unlike install trees, build trees need not be relocatable - SET(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} -INCLUDE(\"${${DEP_PACKAGE}_BINARY_DIR}/${DEP_PACKAGE}Config.cmake\")" + set(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} +include(\"${${DEP_PACKAGE}_BINARY_DIR}/${DEP_PACKAGE}Config.cmake\")" ) - ENDFOREACH() + endforeach() # Import build tree targets into applications. # @@ -423,28 +423,28 @@ INCLUDE(\"${${DEP_PACKAGE}_BINARY_DIR}/${DEP_PACKAGE}Config.cmake\")" # are sub-packages. We'd like to export per-package, but deps # won't be satisfied, so we export one file for the project for # now... - IF(${TRIBITS_PACKAGE}_HAS_NATIVE_LIBRARIES_TO_INSTALL) - EXPORT(TARGETS ${${PACKAGE_NAME}_LIBRARIES} FILE + if(${TRIBITS_PACKAGE}_HAS_NATIVE_LIBRARIES_TO_INSTALL) + export(TARGETS ${${PACKAGE_NAME}_LIBRARIES} FILE "${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Targets.cmake" APPEND) - SET(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} + set(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} # Import ${PACKAGE_NAME} targets -INCLUDE(\"${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Targets.cmake\")" +include(\"${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Targets.cmake\")" ) - ENDIF() + endif() - TRIBITS_SET_COMPILER_VARS_FOR_CONFIG_FILE(BUILD_DIR) + tribits_set_compiler_vars_for_config_file(BUILD_DIR) - IF ("${CMAKE_CXX_FLAGS}" STREQUAL "") - SET(CMAKE_CXX_FLAGS_ESCAPED "") - ELSE() + if ("${CMAKE_CXX_FLAGS}" STREQUAL "") + set(CMAKE_CXX_FLAGS_ESCAPED "") + else() # Replace " by \". - STRING(REGEX REPLACE "\"" "\\\\\"" CMAKE_CXX_FLAGS_ESCAPED ${CMAKE_CXX_FLAGS}) - ENDIF() - CONFIGURE_FILE( + string(REGEX REPLACE "\"" "\\\\\"" CMAKE_CXX_FLAGS_ESCAPED ${CMAKE_CXX_FLAGS}) + endif() + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}/TribitsPackageConfigTemplate.cmake.in "${PARSE_WRITE_CMAKE_CONFIG_FILE}" ) - ENDIF() + endif() # # G) Create the export makefile for the build tree @@ -453,34 +453,34 @@ INCLUDE(\"${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Targets.cmake\")" # it can be directly imported into a Makefile. # - IF(PARSE_WRITE_EXPORT_MAKEFILE) + if(PARSE_WRITE_EXPORT_MAKEFILE) - TRIBITS_LIST_TO_STRING("${FULL_LIBRARY_SET}" ${CMAKE_LINK_LIBRARY_FLAG} MAKEFILE_FULL_LIBRARY_SET) - TRIBITS_LIST_TO_STRING("${FULL_LIBRARY_DIRS_SET}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_LIBRARY_DIRS) - TRIBITS_LIST_TO_STRING("${FULL_INCLUDE_DIRS_SET}" "-I" MAKEFILE_INCLUDE_DIRS) - TRIBITS_LIST_TO_STRING("${${PACKAGE_NAME}_TPL_INCLUDE_DIRS}" "-I" MAKEFILE_${PACKAGE_NAME}_TPL_INCLUDE_DIRS) - TRIBITS_LIST_TO_STRING("${${PACKAGE_NAME}_TPL_LIBRARY_DIRS}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_${PACKAGE_NAME}_TPL_LIBRARY_DIRS) + tribits_list_to_string("${FULL_LIBRARY_SET}" ${CMAKE_LINK_LIBRARY_FLAG} MAKEFILE_FULL_LIBRARY_SET) + tribits_list_to_string("${FULL_LIBRARY_DIRS_SET}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_LIBRARY_DIRS) + tribits_list_to_string("${FULL_INCLUDE_DIRS_SET}" "-I" MAKEFILE_INCLUDE_DIRS) + tribits_list_to_string("${${PACKAGE_NAME}_TPL_INCLUDE_DIRS}" "-I" MAKEFILE_${PACKAGE_NAME}_TPL_INCLUDE_DIRS) + tribits_list_to_string("${${PACKAGE_NAME}_TPL_LIBRARY_DIRS}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_${PACKAGE_NAME}_TPL_LIBRARY_DIRS) #the TPL library names have to be treated differently - TRIBITS_LIBRARY_LIST_TO_STRING("${${PACKAGE_NAME}_TPL_LIBRARIES}" ${CMAKE_LINK_LIBRARY_FLAG} MAKEFILE_${PACKAGE_NAME}_TPL_LIBRARIES) + tribits_library_list_to_string("${${PACKAGE_NAME}_TPL_LIBRARIES}" ${CMAKE_LINK_LIBRARY_FLAG} MAKEFILE_${PACKAGE_NAME}_TPL_LIBRARIES) - TRIBITS_LIBRARY_LIST_TO_STRING("${${TPL_MPI_LIBRARIES}}" ${CMAKE_LINK_LIBRARY_FLAG} "MAKEFILE_TPL_MPI_LIBRARIES") - TRIBITS_LIST_TO_STRING("${${TPL_MPI_LIBRARY_DIRS}}" ${CMAKE_LIBRARY_PATH_FLAG} "MAKEFILE_TPL_MPI_LIBRARY_DIRS") - TRIBITS_LIST_TO_STRING("${${TPL_MPI_INCLUDE_DIRS}}" "-I" "MAKEFILE_TPL_MPI_INCLUDE_DIRS") + tribits_library_list_to_string("${${TPL_MPI_LIBRARIES}}" ${CMAKE_LINK_LIBRARY_FLAG} "MAKEFILE_TPL_MPI_LIBRARIES") + tribits_list_to_string("${${TPL_MPI_LIBRARY_DIRS}}" ${CMAKE_LIBRARY_PATH_FLAG} "MAKEFILE_TPL_MPI_LIBRARY_DIRS") + tribits_list_to_string("${${TPL_MPI_INCLUDE_DIRS}}" "-I" "MAKEFILE_TPL_MPI_INCLUDE_DIRS") - TRIBITS_LIST_TO_STRING("${FULL_PACKAGE_SET}" "" MAKEFILE_FULL_PACKAGE_SET) - TRIBITS_LIST_TO_STRING("${ORDERED_FULL_TPL_SET}" "" MAKEFILE_ORDERED_FULL_TPL_SET) + tribits_list_to_string("${FULL_PACKAGE_SET}" "" MAKEFILE_FULL_PACKAGE_SET) + tribits_list_to_string("${ORDERED_FULL_TPL_SET}" "" MAKEFILE_ORDERED_FULL_TPL_SET) # create an upper case name of the package so that we can make deprecated # versions of them to help people transistioning from the autotools # version diagnose any missed variables. - STRING(TOUPPER ${EXPORT_FILE_VAR_PREFIX} EXPORT_FILE_VAR_PREFIX_UPPER) + string(TOUPPER ${EXPORT_FILE_VAR_PREFIX} EXPORT_FILE_VAR_PREFIX_UPPER) - ASSERT_DEFINED(${PROJECT_NAME}_TRIBITS_DIR) - CONFIGURE_FILE( + assert_defined(${PROJECT_NAME}_TRIBITS_DIR) + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}/TribitsPackageConfigTemplate.export.in "${PARSE_WRITE_EXPORT_MAKEFILE}" ) - ENDIF() + endif() # # H) Create the cmake Config.cmake file for the install tree. @@ -506,117 +506,117 @@ INCLUDE(\"${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Targets.cmake\")" # k is the number of components in . Extract those here. # This doesn't work if ${${PROJECT_NAME}_INSTALL_LIB_DIR} contains "./" or # "../" components, but really, it never did. All of this should actually be - # handled by CMake's CONFIGURE_PACKAGE_CONFIG_FILE(). - STRING(REPLACE "/" ";" PATH_LIST ${${PROJECT_NAME}_INSTALL_LIB_DIR}) - SET(RELATIVE_PATH "../..") - FOREACH(PATH ${PATH_LIST}) - SET(RELATIVE_PATH "${RELATIVE_PATH}/..") - ENDFOREACH() - SET(FULL_LIBRARY_DIRS_SET "\${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_PATH}/${${PROJECT_NAME}_INSTALL_LIB_DIR}") - SET(FULL_INCLUDE_DIRS_SET "\${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_PATH}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") + # handled by CMake's configure_package_config_file(). + string(REPLACE "/" ";" PATH_LIST ${${PROJECT_NAME}_INSTALL_LIB_DIR}) + set(RELATIVE_PATH "../..") + foreach(PATH ${PATH_LIST}) + set(RELATIVE_PATH "${RELATIVE_PATH}/..") + endforeach() + set(FULL_LIBRARY_DIRS_SET "\${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_PATH}/${${PROJECT_NAME}_INSTALL_LIB_DIR}") + set(FULL_INCLUDE_DIRS_SET "\${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_PATH}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") # Custom code in configuration file. - SET(PACKAGE_CONFIG_CODE "") + set(PACKAGE_CONFIG_CODE "") - IF (${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) - SET(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} + if (${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) + set(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} # Include configuration of dependent packages") - ENDIF() - FOREACH(DEP_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) - SET(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} -INCLUDE(\"\${CMAKE_CURRENT_LIST_DIR}/../${DEP_PACKAGE}/${DEP_PACKAGE}Config.cmake\")" + endif() + foreach(DEP_PACKAGE ${${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES}) + set(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} +include(\"\${CMAKE_CURRENT_LIST_DIR}/../${DEP_PACKAGE}/${DEP_PACKAGE}Config.cmake\")" ) - ENDFOREACH() - IF(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) - SET(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE}\n") - ENDIF() + endforeach() + if(${PACKAGE_NAME}_FULL_ENABLED_DEP_PACKAGES) + set(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE}\n") + endif() # Import install tree targets into applications. - GET_PROPERTY(HAS_INSTALL_TARGETS GLOBAL PROPERTY ${PACKAGE_NAME}_HAS_INSTALL_TARGETS) - IF(HAS_INSTALL_TARGETS) - SET(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} + get_property(HAS_INSTALL_TARGETS GLOBAL PROPERTY ${PACKAGE_NAME}_HAS_INSTALL_TARGETS) + if(HAS_INSTALL_TARGETS) + set(PACKAGE_CONFIG_CODE "${PACKAGE_CONFIG_CODE} # Import ${PACKAGE_NAME} targets -INCLUDE(\"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_NAME}Targets.cmake\")" +include(\"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_NAME}Targets.cmake\")" ) - ENDIF() + endif() # Write the specification of the rpath if necessary. This is only needed if we're building shared libraries. - IF(BUILD_SHARED_LIBS) - SET(SHARED_LIB_RPATH_COMMAND ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}) - ENDIF() + if(BUILD_SHARED_LIBS) + set(SHARED_LIB_RPATH_COMMAND ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}) + endif() - TRIBITS_SET_COMPILER_VARS_FOR_CONFIG_FILE(INSTALL_DIR) + tribits_set_compiler_vars_for_config_file(INSTALL_DIR) - IF (PARSE_WRITE_INSTALL_CMAKE_CONFIG_FILE) + if (PARSE_WRITE_INSTALL_CMAKE_CONFIG_FILE) - CONFIGURE_FILE( + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}/TribitsPackageConfigTemplate.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PACKAGE_NAME}Config_install.cmake ) - ENDIF() + endif() # # I) Write the export makefile for the install tree # - IF (PARSE_WRITE_INSTALL_EXPORT_MAKEFILE) + if (PARSE_WRITE_INSTALL_EXPORT_MAKEFILE) # Generated Make imports must use CMAKE_INSTALL_PREFIX, rather # than the more platform friendly method of locating the libraries # and includes using the config file path above. The underlying # assumption here is that a generator that uses # CMAKE_INSTALL_PREFIX is being used. - SET(FULL_LIBRARY_DIRS_SET ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}) - SET(FULL_INCLUDE_DIRS_SET ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}) + set(FULL_LIBRARY_DIRS_SET ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}) + set(FULL_INCLUDE_DIRS_SET ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}) - TRIBITS_LIST_TO_STRING("${FULL_LIBRARY_DIRS_SET}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_LIBRARY_DIRS) - TRIBITS_LIST_TO_STRING("${FULL_INCLUDE_DIRS_SET}" "-I" MAKEFILE_INCLUDE_DIRS) + tribits_list_to_string("${FULL_LIBRARY_DIRS_SET}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_LIBRARY_DIRS) + tribits_list_to_string("${FULL_INCLUDE_DIRS_SET}" "-I" MAKEFILE_INCLUDE_DIRS) - CONFIGURE_FILE( + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}/TribitsPackageConfigTemplate.export.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Makefile.export.${PACKAGE_NAME}_install ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # # Set the install targets for the package config and export makefiles. # -# The INSTALL() commands must be in a different subroutine or CMake will not -# allow you to call the rountine, even if you if() it out! +# The install() commands must be in a different subroutine or CMake will not +# allow you to call the routine, even if you if() it out! # -FUNCTION(TRIBITS_WRITE_PROJECT_CLIENT_EXPORT_FILES_INSTALL_TARGETS PACKAGE_NAME) +function(tribits_write_project_client_export_files_install_targets PACKAGE_NAME) - IF (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) - INSTALL( + if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PACKAGE_NAME}Config_install.cmake DESTINATION "${${PROJECT_NAME}_INSTALL_LIB_DIR}/cmake/${PACKAGE_NAME}" RENAME ${PACKAGE_NAME}Config.cmake ) - IF(${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES_TO_INSTALL) - INSTALL( + if(${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES_TO_INSTALL) + install( EXPORT ${PACKAGE_NAME} DESTINATION "${${PROJECT_NAME}_INSTALL_LIB_DIR}/cmake/${PACKAGE_NAME}" FILE ${PACKAGE_NAME}Targets.cmake ) - ENDIF() - ENDIF() + endif() + endif() - IF(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) + if(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) - INSTALL( + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Makefile.export.${PACKAGE_NAME}_install DESTINATION "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}" RENAME Makefile.export.${PACKAGE_NAME} ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() # @@ -626,41 +626,41 @@ ENDFUNCTION() # ToDo: Finish documentation! # -FUNCTION(TRIBITS_WRITE_PACKAGE_CLIENT_EXPORT_FILES PACKAGE_NAME) +function(tribits_write_package_client_export_files PACKAGE_NAME) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("\nTRIBITS_WRITE_PACKAGE_CLIENT_EXPORT_FILES: ${PACKAGE_NAME}") - ENDIF() + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("\nTRIBITS_WRITE_PACKAGE_CLIENT_EXPORT_FILES: ${PACKAGE_NAME}") + endif() - SET(EXPORT_FILES_ARGS PACKAGE_NAME ${PACKAGE_NAME}) + set(EXPORT_FILES_ARGS PACKAGE_NAME ${PACKAGE_NAME}) - IF (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) - SET(WRITE_CMAKE_CONFIG_FILE + if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) + set(WRITE_CMAKE_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("For package ${PACKAGE_NAME} creating ${WRITE_CMAKE_CONFIG_FILE}") - ENDIF() - APPEND_SET(EXPORT_FILES_ARGS + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("For package ${PACKAGE_NAME} creating ${WRITE_CMAKE_CONFIG_FILE}") + endif() + append_set(EXPORT_FILES_ARGS WRITE_CMAKE_CONFIG_FILE "${WRITE_CMAKE_CONFIG_FILE}" WRITE_INSTALL_CMAKE_CONFIG_FILE) - ENDIF() + endif() - IF(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) - SET(WRITE_EXPORT_MAKEFILE + if(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) + set(WRITE_EXPORT_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/Makefile.export.${PACKAGE_NAME}) - IF(${PROJECT_NAME}_VERBOSE_CONFIGURE) - MESSAGE("For package ${PACKAGE_NAME} creating ${WRITE_EXPORT_MAKEFILE}") - ENDIF() - APPEND_SET(EXPORT_FILES_ARGS + if(${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("For package ${PACKAGE_NAME} creating ${WRITE_EXPORT_MAKEFILE}") + endif() + append_set(EXPORT_FILES_ARGS WRITE_EXPORT_MAKEFILE "${WRITE_EXPORT_MAKEFILE}" WRITE_INSTALL_EXPORT_MAKEFILE) - ENDIF() + endif() - TRIBITS_WRITE_FLEXIBLE_PACKAGE_CLIENT_EXPORT_FILES(${EXPORT_FILES_ARGS}) + tribits_write_flexible_package_client_export_files(${EXPORT_FILES_ARGS}) - TRIBITS_WRITE_PROJECT_CLIENT_EXPORT_FILES_INSTALL_TARGETS(${PACKAGE_NAME}) + tribits_write_project_client_export_files_install_targets(${PACKAGE_NAME}) -ENDFUNCTION() +endfunction() # @@ -672,168 +672,168 @@ ENDFUNCTION() # ToDo: Finish documentation! # -FUNCTION(TRIBITS_WRITE_PROJECT_CLIENT_EXPORT_FILES) +function(tribits_write_project_client_export_files) - SET(EXPORT_FILE_VAR_PREFIX ${PROJECT_NAME}) - TRIBITS_SET_DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET() + set(EXPORT_FILE_VAR_PREFIX ${PROJECT_NAME}) + tribits_set_define_cmake_current_list_dir_code_snippet() # Reversing the package list so that libraries will be produced in order of # most dependent to least dependent. - SET(PACKAGE_LIST ${${PROJECT_NAME}_SE_PACKAGES}) - IF (PACKAGE_LIST) - LIST(REVERSE PACKAGE_LIST) - ENDIF() + set(PACKAGE_LIST ${${PROJECT_NAME}_SE_PACKAGES}) + if (PACKAGE_LIST) + list(REVERSE PACKAGE_LIST) + endif() # Loop over all packages to determine which were enabled. Then build a list # of all their libraries/includes in the proper order for linking - SET(FULL_PACKAGE_SET "") - SET(FULL_LIBRARY_SET "") - SET(FULL_INCLUDE_DIRS_SET "") - SET(FULL_LIBRARY_DIRS_SET "") - FOREACH(TRIBITS_PACKAGE ${PACKAGE_LIST}) - IF(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) - LIST(APPEND FULL_PACKAGE_SET ${TRIBITS_PACKAGE}) - LIST(APPEND FULL_LIBRARY_SET ${${TRIBITS_PACKAGE}_LIBRARIES}) - LIST(APPEND FULL_INCLUDE_DIRS_SET ${${TRIBITS_PACKAGE}_INCLUDE_DIRS}) - LIST(APPEND FULL_LIBRARY_DIRS_SET ${${TRIBITS_PACKAGE}_LIBRARY_DIRS}) - ENDIF() - ENDFOREACH() - - SET(${PROJECT_NAME}_CONFIG_LIBRARIES ${FULL_LIBRARY_SET}) + set(FULL_PACKAGE_SET "") + set(FULL_LIBRARY_SET "") + set(FULL_INCLUDE_DIRS_SET "") + set(FULL_LIBRARY_DIRS_SET "") + foreach(TRIBITS_PACKAGE ${PACKAGE_LIST}) + if(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}) + list(APPEND FULL_PACKAGE_SET ${TRIBITS_PACKAGE}) + list(APPEND FULL_LIBRARY_SET ${${TRIBITS_PACKAGE}_LIBRARIES}) + list(APPEND FULL_INCLUDE_DIRS_SET ${${TRIBITS_PACKAGE}_INCLUDE_DIRS}) + list(APPEND FULL_LIBRARY_DIRS_SET ${${TRIBITS_PACKAGE}_LIBRARY_DIRS}) + endif() + endforeach() + + set(${PROJECT_NAME}_CONFIG_LIBRARIES ${FULL_LIBRARY_SET}) # Reversing the tpl list so that the list of tpls will be produced in # order of most dependent to least dependent. - IF (${PROJECT_NAME}_TPLS) - SET(TPL_LIST ${${PROJECT_NAME}_TPLS}) - LIST(REVERSE TPL_LIST) - ENDIF() + if (${PROJECT_NAME}_TPLS) + set(TPL_LIST ${${PROJECT_NAME}_TPLS}) + list(REVERSE TPL_LIST) + endif() # Loop over all TPLs to determine which were enabled. Then build a list # of all their libraries/includes in the proper order for linking - SET(FULL_TPL_SET "") - SET(FULL_TPL_LIBRARY_SET "") - SET(FULL_TPL_INCLUDE_DIRS_SET "") - SET(FULL_TPL_LIBRARY_DIRS_SET "") - FOREACH(TPL ${TPL_LIST}) - IF(TPL_ENABLE_${TPL}) - LIST(APPEND FULL_TPL_SET ${TPL}) - LIST(APPEND FULL_TPL_LIBRARY_SET ${TPL_${TPL}_LIBRARIES}) - LIST(APPEND FULL_TPL_INCLUDE_DIRS_SET ${TPL_${TPL}_INCLUDE_DIRS}) - LIST(APPEND FULL_TPL_LIBRARY_DIRS_SET ${TPL_${TPL}_LIBRARY_DIRS}) - ENDIF() - ENDFOREACH() + set(FULL_TPL_SET "") + set(FULL_TPL_LIBRARY_SET "") + set(FULL_TPL_INCLUDE_DIRS_SET "") + set(FULL_TPL_LIBRARY_DIRS_SET "") + foreach(TPL ${TPL_LIST}) + if(TPL_ENABLE_${TPL}) + list(APPEND FULL_TPL_SET ${TPL}) + list(APPEND FULL_TPL_LIBRARY_SET ${TPL_${TPL}_LIBRARIES}) + list(APPEND FULL_TPL_INCLUDE_DIRS_SET ${TPL_${TPL}_INCLUDE_DIRS}) + list(APPEND FULL_TPL_LIBRARY_DIRS_SET ${TPL_${TPL}_LIBRARY_DIRS}) + endif() + endforeach() # it is possible that tpls are in the same directory, to keep from # having a very long include path or library path we will strip out # any duplicates. This shouldn't affect which include or library is # found since the first instance of any path will be the one that is # kept. - LIST(REMOVE_DUPLICATES FULL_TPL_INCLUDE_DIRS_SET) - LIST(REMOVE_DUPLICATES FULL_TPL_LIBRARY_DIRS_SET) + list(REMOVE_DUPLICATES FULL_TPL_INCLUDE_DIRS_SET) + list(REMOVE_DUPLICATES FULL_TPL_LIBRARY_DIRS_SET) - SET(${PROJECT_NAME}_CONFIG_TPL_INCLUDE_DIRS ${FULL_TPL_INCLUDE_DIRS_SET}) - SET(${PROJECT_NAME}_CONFIG_TPL_LIBRARY_DIRS ${FULL_TPL_LIBRARY_DIRS_SET}) - SET(${PROJECT_NAME}_CONFIG_TPL_LIBRARIES ${FULL_TPL_LIBRARY_SET}) + set(${PROJECT_NAME}_CONFIG_TPL_INCLUDE_DIRS ${FULL_TPL_INCLUDE_DIRS_SET}) + set(${PROJECT_NAME}_CONFIG_TPL_LIBRARY_DIRS ${FULL_TPL_LIBRARY_DIRS_SET}) + set(${PROJECT_NAME}_CONFIG_TPL_LIBRARIES ${FULL_TPL_LIBRARY_SET}) # # Configure two files for finding ${PROJECT_NAME}. One for the build tree and one for installing # # Generate a note discouraging editing of the Config.cmake file - SET(DISCOURAGE_EDITING "Do not edit: This file was generated automatically by CMake.") + set(DISCOURAGE_EDITING "Do not edit: This file was generated automatically by CMake.") #Config file for setting variables and finding include/library paths from the build directory - SET(${PROJECT_NAME}_CONFIG_INCLUDE_DIRS ${FULL_INCLUDE_DIRS_SET}) - SET(${PROJECT_NAME}_CONFIG_LIBRARY_DIRS ${FULL_LIBRARY_DIRS_SET}) + set(${PROJECT_NAME}_CONFIG_INCLUDE_DIRS ${FULL_INCLUDE_DIRS_SET}) + set(${PROJECT_NAME}_CONFIG_LIBRARY_DIRS ${FULL_LIBRARY_DIRS_SET}) # Write the specification of the rpath if necessary. This is only needed if we're building shared libraries. - IF(BUILD_SHARED_LIBS) - STRING(REPLACE ";" ":" SHARED_LIB_RPATH_COMMAND "${${PROJECT_NAME}_CONFIG_LIBRARY_DIRS}") - SET(SHARED_LIB_RPATH_COMMAND ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}${SHARED_LIB_RPATH_COMMAND}) - ENDIF() + if(BUILD_SHARED_LIBS) + string(REPLACE ";" ":" SHARED_LIB_RPATH_COMMAND "${${PROJECT_NAME}_CONFIG_LIBRARY_DIRS}") + set(SHARED_LIB_RPATH_COMMAND ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}${SHARED_LIB_RPATH_COMMAND}) + endif() # Custom code in configuration file. - SET(PROJECT_CONFIG_CODE "") + set(PROJECT_CONFIG_CODE "") # # Export targets from the build tree. - # IF(FULL_LIBRARY_SET) - # LIST(SORT FULL_LIBRARY_SET) - # LIST(REMOVE_DUPLICATES FULL_LIBRARY_SET) - # SET(FULL_LIBRARY_TARGET_SET) - # FOREACH(LIB_ELE ${FULL_LIBRARY_SET}) - # IF (TARGET ${LIB_ELE}) - # LIST(APPEND FULL_LIBRARY_TARGET_SET ${LIB_ELE}) - # ENDIF() - # ENDFOREACH() - # EXPORT(TARGETS ${FULL_LIBRARY_TARGET_SET} FILE + # if(FULL_LIBRARY_SET) + # list(SORT FULL_LIBRARY_SET) + # list(REMOVE_DUPLICATES FULL_LIBRARY_SET) + # set(FULL_LIBRARY_TARGET_SET) + # foreach(LIB_ELE ${FULL_LIBRARY_SET}) + # if (TARGET ${LIB_ELE}) + # list(APPEND FULL_LIBRARY_TARGET_SET ${LIB_ELE}) + # endif() + # endforeach() + # export(TARGETS ${FULL_LIBRARY_TARGET_SET} FILE # "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake") # # Import the targets in applications. - # SET(PROJECT_CONFIG_CODE "${PROJECT_CONFIG_CODE} + # set(PROJECT_CONFIG_CODE "${PROJECT_CONFIG_CODE} ## Import ${PROJECT_NAME} targets - #IF(NOT ${PROJECT_NAME}_TARGETS_IMPORTED) - # SET(${PROJECT_NAME}_TARGETS_IMPORTED 1) - # INCLUDE(\"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake\") - #ENDIF() + #if(NOT ${PROJECT_NAME}_TARGETS_IMPORTED) + # set(${PROJECT_NAME}_TARGETS_IMPORTED 1) + # include(\"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake\") + #endif() #") - # ENDIF() + # endif() # Appending the logic to include each package's config file. - SET(LOAD_CODE "# Load configurations from enabled packages") - FOREACH(TRIBITS_PACKAGE ${FULL_PACKAGE_SET}) - SET(LOAD_CODE "${LOAD_CODE} + set(LOAD_CODE "# Load configurations from enabled packages") + foreach(TRIBITS_PACKAGE ${FULL_PACKAGE_SET}) + set(LOAD_CODE "${LOAD_CODE} include(\"${${TRIBITS_PACKAGE}_BINARY_DIR}/${TRIBITS_PACKAGE}Config.cmake\")") - ENDFOREACH() - SET(PROJECT_CONFIG_CODE "${PROJECT_CONFIG_CODE}\n${LOAD_CODE}") + endforeach() + set(PROJECT_CONFIG_CODE "${PROJECT_CONFIG_CODE}\n${LOAD_CODE}") - TRIBITS_SET_COMPILER_VARS_FOR_CONFIG_FILE(INSTALL_DIR) + tribits_set_compiler_vars_for_config_file(INSTALL_DIR) - IF (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) + if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) # In TribitsProjectConfigTemplate.cmake.in, we would like to preserve # ${}-variables after the conversion to TribitsProjectConfigTemplate.cmake. # To this end, one typically uses the @-syntax for variables. That doesn't # support nested variables, however. Use ${PDOLLAR} as a workaround, cf. # . - SET(PDOLLAR "$") - CONFIGURE_FILE( + set(PDOLLAR "$") + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}/TribitsProjectConfigTemplate.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake ) - ENDIF() + endif() - IF(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) + if(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) ###### # Create a Makefile.export. for the build tree. This is the equivalent # of the cmake version only slightly changed so that it can be directly imported into # a Makefile. ###### - TRIBITS_LIST_TO_STRING("${${PROJECT_NAME}_CONFIG_LIBRARIES}" ${CMAKE_LINK_LIBRARY_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_LIBRARIES) - TRIBITS_LIST_TO_STRING("${${PROJECT_NAME}_CONFIG_LIBRARY_DIRS}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_LIBRARY_DIRS) - TRIBITS_LIST_TO_STRING("${${PROJECT_NAME}_CONFIG_INCLUDE_DIRS}" "-I" MAKEFILE_${PROJECT_NAME}_CONFIG_INCLUDE_DIRS) - TRIBITS_LIST_TO_STRING("${${PROJECT_NAME}_CONFIG_TPL_INCLUDE_DIRS}" "-I" MAKEFILE_${PROJECT_NAME}_CONFIG_TPL_INCLUDE_DIRS) - TRIBITS_LIST_TO_STRING("${${PROJECT_NAME}_CONFIG_TPL_LIBRARY_DIRS}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_TPL_LIBRARY_DIRS) + tribits_list_to_string("${${PROJECT_NAME}_CONFIG_LIBRARIES}" ${CMAKE_LINK_LIBRARY_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_LIBRARIES) + tribits_list_to_string("${${PROJECT_NAME}_CONFIG_LIBRARY_DIRS}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_LIBRARY_DIRS) + tribits_list_to_string("${${PROJECT_NAME}_CONFIG_INCLUDE_DIRS}" "-I" MAKEFILE_${PROJECT_NAME}_CONFIG_INCLUDE_DIRS) + tribits_list_to_string("${${PROJECT_NAME}_CONFIG_TPL_INCLUDE_DIRS}" "-I" MAKEFILE_${PROJECT_NAME}_CONFIG_TPL_INCLUDE_DIRS) + tribits_list_to_string("${${PROJECT_NAME}_CONFIG_TPL_LIBRARY_DIRS}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_TPL_LIBRARY_DIRS) #the TPL library names have to be treated differently - TRIBITS_LIBRARY_LIST_TO_STRING("${${PROJECT_NAME}_CONFIG_TPL_LIBRARIES}" ${CMAKE_LINK_LIBRARY_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_TPL_LIBRARIES) + tribits_library_list_to_string("${${PROJECT_NAME}_CONFIG_TPL_LIBRARIES}" ${CMAKE_LINK_LIBRARY_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_TPL_LIBRARIES) - TRIBITS_LIBRARY_LIST_TO_STRING("${${TPL_MPI_LIBRARIES}}" ${CMAKE_LINK_LIBRARY_FLAG} "MAKEFILE_TPL_MPI_LIBRARIES") - TRIBITS_LIST_TO_STRING("${${TPL_MPI_LIBRARY_DIRS}}" ${CMAKE_LIBRARY_PATH_FLAG} "MAKEFILE_TPL_MPI_LIBRARY_DIRS") - TRIBITS_LIST_TO_STRING("${${TPL_MPI_INCLUDE_DIRS}}" "-I" "MAKEFILE_TPL_MPI_INCLUDE_DIRS") + tribits_library_list_to_string("${${TPL_MPI_LIBRARIES}}" ${CMAKE_LINK_LIBRARY_FLAG} "MAKEFILE_TPL_MPI_LIBRARIES") + tribits_list_to_string("${${TPL_MPI_LIBRARY_DIRS}}" ${CMAKE_LIBRARY_PATH_FLAG} "MAKEFILE_TPL_MPI_LIBRARY_DIRS") + tribits_list_to_string("${${TPL_MPI_INCLUDE_DIRS}}" "-I" "MAKEFILE_TPL_MPI_INCLUDE_DIRS") - TRIBITS_LIST_TO_STRING("${FULL_PACKAGE_SET}" "" MAKEFILE_FULL_PACKAGE_SET) - TRIBITS_LIST_TO_STRING("${FULL_TPL_SET}" "" MAKEFILE_FULL_TPL_SET) + tribits_list_to_string("${FULL_PACKAGE_SET}" "" MAKEFILE_FULL_PACKAGE_SET) + tribits_list_to_string("${FULL_TPL_SET}" "" MAKEFILE_FULL_TPL_SET) - IF (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) + if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) # In TribitsProjectConfigTemplate.cmake.in, we would like to preserve # ${}-variables after the conversion to # TribitsProjectConfigTemplate.cmake. To this end, one typically uses the # @-syntax for variables. That doesn't support nested variables, however. # Use ${PDOLLAR} as a workaround, cf. # . - SET(PDOLLAR "$") - CONFIGURE_FILE( + set(PDOLLAR "$") + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}/TribitsProjectConfigTemplate.export.in ${PROJECT_BINARY_DIR}/Makefile.export.${PROJECT_NAME}) - ENDIF() - ENDIF() + endif() + endif() ###### # Create a configure file for the install tree and set the install target for it. This @@ -854,38 +854,38 @@ include(\"${${TRIBITS_PACKAGE}_BINARY_DIR}/${TRIBITS_PACKAGE}Config.cmake\")") # k is the number of components in . Extract those here. # This doesn't work if ${${PROJECT_NAME}_INSTALL_LIB_DIR} contains "./" or # "../" components, but really, it never did. All of this should actually be - # handled by CMake's CONFIGURE_PACKAGE_CONFIG_FILE(). - STRING(REPLACE "/" ";" PATH_LIST ${${PROJECT_NAME}_INSTALL_LIB_DIR}) - SET(RELATIVE_PATH "../..") - FOREACH(PATH ${PATH_LIST}) - SET(RELATIVE_PATH "${RELATIVE_PATH}/..") - ENDFOREACH() - SET(${PROJECT_NAME}_CONFIG_INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_PATH}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") - SET(${PROJECT_NAME}_CONFIG_LIBRARY_DIRS "\${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_PATH}/${${PROJECT_NAME}_INSTALL_LIB_DIR}") + # handled by CMake's configure_package_config_file(). + string(REPLACE "/" ";" PATH_LIST ${${PROJECT_NAME}_INSTALL_LIB_DIR}) + set(RELATIVE_PATH "../..") + foreach(PATH ${PATH_LIST}) + set(RELATIVE_PATH "${RELATIVE_PATH}/..") + endforeach() + set(${PROJECT_NAME}_CONFIG_INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_PATH}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}") + set(${PROJECT_NAME}_CONFIG_LIBRARY_DIRS "\${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_PATH}/${${PROJECT_NAME}_INSTALL_LIB_DIR}") # Write the specification of the rpath if necessary. This is only needed if we're building shared libraries. - IF(BUILD_SHARED_LIBS) - SET(SHARED_LIB_RPATH_COMMAND ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}) - ENDIF() + if(BUILD_SHARED_LIBS) + set(SHARED_LIB_RPATH_COMMAND ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}) + endif() # Custom code in configuration file. - SET(PROJECT_CONFIG_CODE "") + set(PROJECT_CONFIG_CODE "") - TRIBITS_SET_COMPILER_VARS_FOR_CONFIG_FILE(INSTALL_DIR) + tribits_set_compiler_vars_for_config_file(INSTALL_DIR) - IF (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) - CONFIGURE_FILE( + if (${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES) + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}/TribitsProjectConfigTemplate.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config_install.cmake ) - INSTALL( + install( FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config_install.cmake DESTINATION "${${PROJECT_NAME}_INSTALL_LIB_DIR}/cmake/${PROJECT_NAME}" RENAME ${PROJECT_NAME}Config.cmake ) - ENDIF() + endif() - IF(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) + if(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES) ###### # Create a Makefile.export. for the install tree. This is the equivalent # of the cmake version only slightly changed so that it can be directly imported into @@ -897,57 +897,57 @@ include(\"${${TRIBITS_PACKAGE}_BINARY_DIR}/${TRIBITS_PACKAGE}Config.cmake\")") # and includes using the config file path above. The underlying # assumption here is that a generator that uses # CMAKE_INSTALL_PREFIX is being used. - SET(${PROJECT_NAME}_CONFIG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}) - SET(${PROJECT_NAME}_CONFIG_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}) + set(${PROJECT_NAME}_CONFIG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}) + set(${PROJECT_NAME}_CONFIG_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_LIB_DIR}) - TRIBITS_LIST_TO_STRING("${${PROJECT_NAME}_CONFIG_LIBRARY_DIRS}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_LIBRARY_DIRS) - TRIBITS_LIST_TO_STRING("${${PROJECT_NAME}_CONFIG_INCLUDE_DIRS}" "-I" MAKEFILE_${PROJECT_NAME}_CONFIG_INCLUDE_DIRS) + tribits_list_to_string("${${PROJECT_NAME}_CONFIG_LIBRARY_DIRS}" ${CMAKE_LIBRARY_PATH_FLAG} MAKEFILE_${PROJECT_NAME}_CONFIG_LIBRARY_DIRS) + tribits_list_to_string("${${PROJECT_NAME}_CONFIG_INCLUDE_DIRS}" "-I" MAKEFILE_${PROJECT_NAME}_CONFIG_INCLUDE_DIRS) - CONFIGURE_FILE( + configure_file( ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}/TribitsProjectConfigTemplate.export.in ${PROJECT_BINARY_DIR}/Makefile.export.${PROJECT_NAME}_install ) - INSTALL( + install( FILES ${PROJECT_BINARY_DIR}/Makefile.export.${PROJECT_NAME}_install DESTINATION "${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}" RENAME Makefile.export.${PROJECT_NAME} ) - ENDIF() + endif() # # Configure the version file for ${PROJECT_NAME} # - INCLUDE(CMakePackageConfigHelpers) - IF ("${${PROJECT_NAME}_VERSION}" STREQUAL "") - SET(${PROJECT_NAME}_VERSION 0.0.0) - ENDIF() - WRITE_BASIC_PACKAGE_VERSION_FILE( + include(CMakePackageConfigHelpers) + if ("${${PROJECT_NAME}_VERSION}" STREQUAL "") + set(${PROJECT_NAME}_VERSION 0.0.0) + endif() + write_basic_package_version_file( ${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${${PROJECT_NAME}_VERSION} COMPATIBILITY SameMajorVersion ) - INSTALL( + install( FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake DESTINATION "${${PROJECT_NAME}_INSTALL_LIB_DIR}/cmake/${PROJECT_NAME}" ) -ENDFUNCTION() +endfunction() -MACRO(TRIBITS_SET_COMPILER_VAR_FOR_CONFIG_FILE LANG FOR_DIR) - IF (NOT "${CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE_${FOR_DIR}}" STREQUAL "") - SET(CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE +macro(tribits_set_compiler_var_for_config_file LANG FOR_DIR) + if (NOT "${CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE_${FOR_DIR}}" STREQUAL "") + set(CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE "${CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE_${FOR_DIR}}") - ELSE() - SET(CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE + else() + set(CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE "${CMAKE_${LANG}_COMPILER}") - ENDIF() - #MESSAGE("${FOR_DIR}: CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE='${CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE}'") -ENDMACRO() + endif() + #message("${FOR_DIR}: CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE='${CMAKE_${LANG}_COMPILER_FOR_CONFIG_FILE}'") +endmacro() -MACRO(TRIBITS_SET_COMPILER_VARS_FOR_CONFIG_FILE FOR_DIR) - TRIBITS_SET_COMPILER_VAR_FOR_CONFIG_FILE(CXX ${FOR_DIR}) - TRIBITS_SET_COMPILER_VAR_FOR_CONFIG_FILE(C ${FOR_DIR}) - TRIBITS_SET_COMPILER_VAR_FOR_CONFIG_FILE(Fortran ${FOR_DIR}) -ENDMACRO() +macro(tribits_set_compiler_vars_for_config_file FOR_DIR) + tribits_set_compiler_var_for_config_file(CXX ${FOR_DIR}) + tribits_set_compiler_var_for_config_file(C ${FOR_DIR}) + tribits_set_compiler_var_for_config_file(Fortran ${FOR_DIR}) +endmacro() diff --git a/cmake/tribits/core/package_arch/Tribits_version.h.in b/cmake/tribits/core/package_arch/Tribits_version.h.in index b3b535e8bcd9..a8fd0c78438a 100644 --- a/cmake/tribits/core/package_arch/Tribits_version.h.in +++ b/cmake/tribits/core/package_arch/Tribits_version.h.in @@ -48,7 +48,7 @@ * * In this way, client code can just examine the version number in this file * and know exactly what version of @REPOSITORY_NAME@ they are working with with no - * ambiguity no mater what. + * ambiguity no matter what. */ diff --git a/cmake/tribits/core/package_arch/Tribits_version_date.h.in b/cmake/tribits/core/package_arch/Tribits_version_date.h.in index d60f419986a4..b572cedda752 100644 --- a/cmake/tribits/core/package_arch/Tribits_version_date.h.in +++ b/cmake/tribits/core/package_arch/Tribits_version_date.h.in @@ -12,7 +12,7 @@ * with a maximum value of 2^32 / 2 - 1 = 2147483647. Therefore, the maximum * date that can be handled is the year 2147 with the max date/time of 2147 12 * 31 23 = 2147123123. Modern C/C++ compilers (and other implementations of - * the C preprocesor) should be able to handle 32-bit integers. + * the C preprocessor) should be able to handle 32-bit integers. * * This header file is meant to be included by downstream codes to determine * the version of @REPOSITORY_NAME@ being used and allows diff --git a/cmake/tribits/core/package_arch/tribits_get_version_date.cmake b/cmake/tribits/core/package_arch/tribits_get_version_date.cmake index 471b08f39e3d..e51b64d8a422 100644 --- a/cmake/tribits/core/package_arch/tribits_get_version_date.cmake +++ b/cmake/tribits/core/package_arch/tribits_get_version_date.cmake @@ -28,7 +28,7 @@ endif() # B) Include modules set(${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_LIST_DIR}/../..") -SET(CMAKE_MODULE_PATH +set(CMAKE_MODULE_PATH ${${PROJECT_NAME}_TRIBITS_DIR}/core/utils ${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch ) diff --git a/cmake/tribits/core/std_tpls/FindTPLCUDA.cmake b/cmake/tribits/core/std_tpls/FindTPLCUDA.cmake index 2374de9ece11..86028fd4b666 100644 --- a/cmake/tribits/core/std_tpls/FindTPLCUDA.cmake +++ b/cmake/tribits/core/std_tpls/FindTPLCUDA.cmake @@ -55,27 +55,27 @@ # Check for CUDA support -SET(_CUDA_FAILURE OFF) +set(_CUDA_FAILURE OFF) # Have CMake find CUDA -IF(NOT _CUDA_FAILURE) - FIND_PACKAGE(CUDA REQUIRED) - IF (NOT CUDA_FOUND) - SET(_CUDA_FAILURE ON) - ENDIF() -ENDIF() +if(NOT _CUDA_FAILURE) + find_package(CUDA REQUIRED) + if (NOT CUDA_FOUND) + set(_CUDA_FAILURE ON) + endif() +endif() # # Test that CUDA compiler works -# IF(NOT _CUDA_FAILURE) -# INCLUDE(TrilinosCUDASupport) -# SET(SRC " +# if(NOT _CUDA_FAILURE) +# include(TrilinosCUDASupport) +# set(SRC " # #include -# __global__ void vecAdd(const float* a, const float* b, float* c, int N) +# __global__ void vecadd(const float* a, const float* b, float* c, int N) # { # int i = blockDim.x * blockIdx.x + threadIdx.x; # if (i < N) c[i] = a[i] + b[i]; # } -# __global__ void vecInit(float* x, float val, int N) +# __global__ void vecinit(float* x, float val, int N) # { # int i = blockDim.x * blockIdx.x + threadIdx.x; # if (i < N) x[i] = val; @@ -87,9 +87,9 @@ ENDIF() # float* a = NULL; # float* b = NULL; # float* c = NULL; -# cudaMalloc((void**)&a, N); -# cudaMalloc((void**)&b, N); -# cudaMalloc((void**)&c, N); +# cudamalloc((void**)&a, N); +# cudamalloc((void**)&b, N); +# cudamalloc((void**)&c, N); # // init # vecInit<<>>(a,1.0f,N); # vecInit<<>>(b,2.0f,N); @@ -98,22 +98,22 @@ ENDIF() # vecAdd<<>>(a, b, c, N); # } # ") -# CHECK_CUDA_SOURCE_COMPILES(${SRC} _NVCC_SUCCESS) -# IF(NOT _NVCC_SUCCESS) -# SET(_CUDA_FAILURE ON) -# ENDIF() -# ENDIF() +# check_cuda_source_compiles(${SRC} _NVCC_SUCCESS) +# if(NOT _NVCC_SUCCESS) +# set(_CUDA_FAILURE ON) +# endif() +# endif() -IF(NOT _CUDA_FAILURE) +if(NOT _CUDA_FAILURE) # if we haven't met failure - macro(PACKAGE_ADD_CUDA_LIBRARY cuda_target) - TRIBITS_ADD_LIBRARY(${cuda_target} ${ARGN} CUDALIBRARY) + macro(package_add_cuda_library cuda_target) + tribits_add_library(${cuda_target} ${ARGN} CUDALIBRARY) endmacro() - GLOBAL_SET(TPL_CUDA_LIBRARY_DIRS) - GLOBAL_SET(TPL_CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE}) - GLOBAL_SET(TPL_CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY} ${CUDA_cublas_LIBRARY} + global_set(TPL_CUDA_LIBRARY_DIRS) + global_set(TPL_CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE}) + global_set(TPL_CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY} ${CUDA_cublas_LIBRARY} ${CUDA_cufft_LIBRARY}) -ELSE() - SET(TPL_ENABLE_CUDA OFF PARENT_SCOPE) - MESSAGE(FATAL_ERROR "\nDid not find acceptable version of CUDA compiler") -ENDIF() +else() + set(TPL_ENABLE_CUDA OFF PARENT_SCOPE) + message(FATAL_ERROR "\nDid not find acceptable version of CUDA compiler") +endif() diff --git a/cmake/tribits/core/std_tpls/FindTPLMPI.cmake b/cmake/tribits/core/std_tpls/FindTPLMPI.cmake index 4544155a6dbb..b3a5bf4644c3 100644 --- a/cmake/tribits/core/std_tpls/FindTPLMPI.cmake +++ b/cmake/tribits/core/std_tpls/FindTPLMPI.cmake @@ -39,14 +39,14 @@ # 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) - INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH}) - GLOBAL_SET(TPL_MPI_INCLUDE_DIRS ${MPI_INCLUDE_PATH}) - GLOBAL_SET(TPL_MPI_LIBRARIES ${MPI_LIBRARIES}) -ENDIF() +if(WIN32 AND TPL_ENABLE_MPI) + find_package(MPI) + include_directories(${MPI_INCLUDE_PATH}) + global_set(TPL_MPI_INCLUDE_DIRS ${MPI_INCLUDE_PATH}) + global_set(TPL_MPI_LIBRARIES ${MPI_LIBRARIES}) +endif() diff --git a/cmake/tribits/core/utils/AddSubdirectories.cmake b/cmake/tribits/core/utils/AddSubdirectories.cmake index 23d2e7ff1910..5ce3615c5eb3 100644 --- a/cmake/tribits/core/utils/AddSubdirectories.cmake +++ b/cmake/tribits/core/utils/AddSubdirectories.cmake @@ -38,23 +38,23 @@ # @HEADER # -# @MACRO: ADD_SUBDIRECTORIES() +# @MACRO: add_subdirectories() # # Macro that adds a list of subdirectories all at once (removes boiler-plate # code). # # Usage:: # -# ADD_SUBDIRECTORIES( ...) +# add_subdirectories( ...) # # instead of:: # -# ADD_SUBDIRECTORY() -# ADD_SUBDIRECTORY() +# add_subdirectory() +# add_subdirectory() # ... # -MACRO(ADD_SUBDIRECTORIES) - FOREACH(DIR ${ARGV}) - ADD_SUBDIRECTORY(${DIR}) - ENDFOREACH() -ENDMACRO() +macro(add_subdirectories) + foreach(DIR ${ARGV}) + add_subdirectory(${DIR}) + endforeach() +endmacro() diff --git a/cmake/tribits/core/utils/AdvancedOption.cmake b/cmake/tribits/core/utils/AdvancedOption.cmake index de841aba41bd..22eee54e1ebe 100644 --- a/cmake/tribits/core/utils/AdvancedOption.cmake +++ b/cmake/tribits/core/utils/AdvancedOption.cmake @@ -38,21 +38,21 @@ # @HEADER # -# @MACRO: ADVANCED_OPTION() +# @MACRO: advanced_option() # # Macro that sets an option and marks it as advanced (removes boiler-plate and # duplication). # # Usage:: # -# ADVANCED_OPTION( [other arguments]) +# advanced_option( [other arguments]) # # This just calls the built-in CMake commands:: # -# OPTION( [other arguments]) -# MARK_AS_ADVANCED() +# option( [other arguments]) +# mark_as_advanced() # -MACRO(ADVANCED_OPTION VARNAME) - OPTION(${VARNAME} ${ARGN}) - MARK_AS_ADVANCED(${VARNAME}) -ENDMACRO() +macro(advanced_option VARNAME) + option(${VARNAME} ${ARGN}) + mark_as_advanced(${VARNAME}) +endmacro() diff --git a/cmake/tribits/core/utils/AdvancedSet.cmake b/cmake/tribits/core/utils/AdvancedSet.cmake index 60334529ceb6..1939e14e67b1 100644 --- a/cmake/tribits/core/utils/AdvancedSet.cmake +++ b/cmake/tribits/core/utils/AdvancedSet.cmake @@ -39,21 +39,21 @@ # -# @MACRO: ADVANCED_SET() +# @MACRO: advanced_set() # # Macro that sets a variable and marks it as advanced (removes boiler-plate # and duplication). # # Usage:: # -# ADVANCED_SET( [other arguments]) +# advanced_set( [other arguments]) # # This just calls the built-in commands:: # -# SET( [other arguments]) -# MARK_AS_ADVANCED() +# set( [other arguments]) +# mark_as_advanced() # -MACRO(ADVANCED_SET VARNAME) - SET(${VARNAME} ${ARGN}) - MARK_AS_ADVANCED(${VARNAME}) -ENDMACRO() +macro(advanced_set VARNAME) + set(${VARNAME} ${ARGN}) + mark_as_advanced(${VARNAME}) +endmacro() diff --git a/cmake/tribits/core/utils/AppendCmndlineArgs.cmake b/cmake/tribits/core/utils/AppendCmndlineArgs.cmake index baaf86b70399..f444b3daecd6 100644 --- a/cmake/tribits/core/utils/AppendCmndlineArgs.cmake +++ b/cmake/tribits/core/utils/AppendCmndlineArgs.cmake @@ -38,24 +38,24 @@ # @HEADER # -# @FUNCTION: APPEND_CMNDLINE_ARGS() +# @FUNCTION: append_cmndline_args() # # Utility function that appends command-line arguments to a variable of # command-line arguments. # # Usage:: # -# APPEND_CMNDLINE_ARGS( "") +# append_cmndline_args( "") # # This function just appends the command-line arguments in the string # ``""`` but does not add an extra space if ```` is empty on # input. This just makes the formatting of command-line arguments easier. # -FUNCTION(APPEND_CMNDLINE_ARGS CMNDLINE_VAR_NAME EXTRAARGS) - IF (${CMNDLINE_VAR_NAME}) - SET(${CMNDLINE_VAR_NAME} "${${CMNDLINE_VAR_NAME}} ${EXTRAARGS}" PARENT_SCOPE) - ELSE() - SET(${CMNDLINE_VAR_NAME} "${EXTRAARGS}" PARENT_SCOPE) - ENDIF() -# PRINT_VAR(${CMNDLINE_VAR_NAME}) -ENDFUNCTION() +function(append_cmndline_args CMNDLINE_VAR_NAME EXTRAARGS) + if (${CMNDLINE_VAR_NAME}) + set(${CMNDLINE_VAR_NAME} "${${CMNDLINE_VAR_NAME}} ${EXTRAARGS}" PARENT_SCOPE) + else() + set(${CMNDLINE_VAR_NAME} "${EXTRAARGS}" PARENT_SCOPE) + endif() +# print_var(${CMNDLINE_VAR_NAME}) +endfunction() diff --git a/cmake/tribits/core/utils/AppendGlob.cmake b/cmake/tribits/core/utils/AppendGlob.cmake index 6707341a3096..7576f2595cce 100644 --- a/cmake/tribits/core/utils/AppendGlob.cmake +++ b/cmake/tribits/core/utils/AppendGlob.cmake @@ -37,21 +37,21 @@ # ************************************************************************ # @HEADER -INCLUDE(AppendSet) +include(AppendSet) # -# @MACRO: APPEND_GLOB() +# @MACRO: append_glob() # -# Utility macro that does a ``FILE(GLOB ...)`` and appends to an existing list +# Utility macro that does a ``file(GLOB ...)`` and appends to an existing list # (removes boiler-plate code). # # Usage:: # -# APPEND_GLOB( ...) +# append_glob( ...) # # On output, ```` will have the list of glob files appended. # -MACRO(APPEND_GLOB VAR) - FILE(GLOB LOCAL_TMP_VAR ${ARGN}) - APPEND_SET(${VAR} ${LOCAL_TMP_VAR}) -ENDMACRO() +macro(append_glob VAR) + file(GLOB LOCAL_TMP_VAR ${ARGN}) + append_set(${VAR} ${LOCAL_TMP_VAR}) +endmacro() diff --git a/cmake/tribits/core/utils/AppendGlobalSet.cmake b/cmake/tribits/core/utils/AppendGlobalSet.cmake index 62d5a3095dc5..1280ffb2ae98 100644 --- a/cmake/tribits/core/utils/AppendGlobalSet.cmake +++ b/cmake/tribits/core/utils/AppendGlobalSet.cmake @@ -37,24 +37,24 @@ # ************************************************************************ # @HEADER -INCLUDE(GlobalSet) -INCLUDE(AssertDefined) +include(GlobalSet) +include(AssertDefined) # -# @FUNCTION: APPEND_GLOBAL_SET() +# @FUNCTION: append_global_set() # # Utility macro that appends arguments to a global variable (reduces # boiler-plate code and mistakes). # # Usage:: # -# APPEND_GLOBAL_SET( ...) +# append_global_set( ...) # # NOTE: The variable ```` must exist before calling this function. -# To set it empty initially use `GLOBAL_NULL_SET()`_. +# To set it empty initially use `global_null_set()`_. # -FUNCTION(APPEND_GLOBAL_SET VARNAME) - ASSERT_DEFINED(${VARNAME}) - LIST(APPEND ${VARNAME} ${ARGN}) - GLOBAL_SET(${VARNAME} ${${VARNAME}}) -ENDFUNCTION() +function(append_global_set VARNAME) + assert_defined(${VARNAME}) + list(APPEND ${VARNAME} ${ARGN}) + global_set(${VARNAME} ${${VARNAME}}) +endfunction() diff --git a/cmake/tribits/core/utils/AppendSet.cmake b/cmake/tribits/core/utils/AppendSet.cmake index 990abda6831f..2ae8decbf560 100644 --- a/cmake/tribits/core/utils/AppendSet.cmake +++ b/cmake/tribits/core/utils/AppendSet.cmake @@ -38,22 +38,22 @@ # @HEADER # -# @MACRO: APPEND_SET() +# @MACRO: append_set() # # Utility function to append elements to a variable (reduces boiler-plate # code). # # Usage:: # -# APPEND_SET( ...) +# append_set( ...) # # This just calls:: # -# LIST(APPEND ...) +# list(APPEND ...) # # There is better error reporting if one misspells ``APPEND_SET`` than if one # misspells ``APPEND``. # -MACRO(APPEND_SET VARNAME) - LIST(APPEND ${VARNAME} ${ARGN}) -ENDMACRO() +macro(append_set VARNAME) + list(APPEND ${VARNAME} ${ARGN}) +endmacro() diff --git a/cmake/tribits/core/utils/AppendStringVar.cmake b/cmake/tribits/core/utils/AppendStringVar.cmake index cbd9e2f8d567..63d5cc7b4a7f 100644 --- a/cmake/tribits/core/utils/AppendStringVar.cmake +++ b/cmake/tribits/core/utils/AppendStringVar.cmake @@ -37,47 +37,47 @@ # ************************************************************************ # @HEADER -INCLUDE(ConcatStrings) -INCLUDE(PrintVar) +include(ConcatStrings) +include(PrintVar) # -# @FUNCTION: APPEND_STRING_VAR() +# @FUNCTION: append_string_var() # # Append strings to an existing string variable (reduces boiler-place code and # reduces mistakes). # # Usage:: # -# APPEND_STRING_VAR( "" "" ...) +# append_string_var( "" "" ...) # # Note that the usage of the characters ``'['``, ``']'``, ``'{'``, ``'}'`` are # taken by CMake to bypass the meaning of ';' to separate string characters. # If one wants to ignore the meaning of these special characters and are okay -# with just adding one string at a time, then use `APPEND_STRING_VAR_EXT()`_. -# -FUNCTION(APPEND_STRING_VAR STRING_VAR_OUT) - #MESSAGE("APPEND_STRING_VAR: ${STRING_VAR_OUT} {${ARGN}}") - CONCAT_STRINGS( STRING_VAR "${${STRING_VAR_OUT}}" ${ARGN} ) - #PRINT_VAR( STRING_VAR ) - SET(${STRING_VAR_OUT} "${STRING_VAR}" PARENT_SCOPE) - #PRINT_VAR(STRING_VAR_OUT) -ENDFUNCTION() +# with just adding one string at a time, then use `append_string_var_ext()`_. +# +function(append_string_var STRING_VAR_OUT) + #message("APPEND_STRING_VAR: ${STRING_VAR_OUT} {${ARGN}}") + concat_strings( STRING_VAR "${${STRING_VAR_OUT}}" ${ARGN} ) + #print_var( STRING_VAR ) + set(${STRING_VAR_OUT} "${STRING_VAR}" PARENT_SCOPE) + #print_var(STRING_VAR_OUT) +endfunction() # -# @FUNCTION: APPEND_STRING_VAR_EXT() +# @FUNCTION: append_string_var_ext() # # Append a single string to an existing string variable, ignoring ';' (reduces # boiler-place code and reduces mistakes). # # Usage:: # -# APPEND_STRING_VAR_EXT( "") +# append_string_var_ext( "") # # Simply sets `` = "${}"`` and leaves in ``';'`` # without creating new array elements. # -FUNCTION(APPEND_STRING_VAR_EXT STRING_VAR_OUT STRING_TO_APPEND) - SET(STRING_VAR "${${STRING_VAR_OUT}}${STRING_TO_APPEND}") - SET(${STRING_VAR_OUT} "${STRING_VAR}" PARENT_SCOPE) -ENDFUNCTION() +function(append_string_var_ext STRING_VAR_OUT STRING_TO_APPEND) + set(STRING_VAR "${${STRING_VAR_OUT}}${STRING_TO_APPEND}") + set(${STRING_VAR_OUT} "${STRING_VAR}" PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/utils/AppendStringVarWithSep.cmake b/cmake/tribits/core/utils/AppendStringVarWithSep.cmake index 8a922aa01300..b08a042e791e 100644 --- a/cmake/tribits/core/utils/AppendStringVarWithSep.cmake +++ b/cmake/tribits/core/utils/AppendStringVarWithSep.cmake @@ -37,32 +37,32 @@ # ************************************************************************ # @HEADER -INCLUDE(ConcatStrings) +include(ConcatStrings) # -# @FUNCTION: APPEND_STRING_VAR_WITH_SEP() +# @FUNCTION: append_string_var_with_sep() # # Append strings to a given string variable, joining them using a separator # string. # # Usage:: # -# APPEND_STRING_VAR_WITH_SEP( "" "" "" ...) +# append_string_var_with_sep( "" "" "" ...) # # Each of the strings ```` are appended to ```` using the # separation string ````. # -FUNCTION(APPEND_STRING_VAR_WITH_SEP STRING_VAR SEP_STR) - #MESSAGE("APPEND_STRING_VAR: '${STRING_VAR}' '${SEP_STR}' ${ARGN}") - #PRINT_VAR(STRING_VAR) - #PRINT_VAR(${STRING_VAR}) - IF (${STRING_VAR}) - CONCAT_STRINGS( TMP_STRING "${${STRING_VAR}}${SEP_STR}" ${ARGN} ) - ELSE() - CONCAT_STRINGS( TMP_STRING ${ARGN} ) - ENDIF() - #PRINT_VAR( TMP_STRING ) - SET(${STRING_VAR} "${TMP_STRING}" PARENT_SCOPE) - #SET(${STRING_VAR} "${${STRING_VAR}}${LINE}" PARENT_SCOPE) - #PRINT_VAR(STRING_VAR) -ENDFUNCTION() +function(append_string_var_with_sep STRING_VAR SEP_STR) + #message("APPEND_STRING_VAR: '${STRING_VAR}' '${SEP_STR}' ${ARGN}") + #print_var(STRING_VAR) + #print_var(${STRING_VAR}) + if (${STRING_VAR}) + concat_strings( TMP_STRING "${${STRING_VAR}}${SEP_STR}" ${ARGN} ) + else() + concat_strings( TMP_STRING ${ARGN} ) + endif() + #print_var( TMP_STRING ) + set(${STRING_VAR} "${TMP_STRING}" PARENT_SCOPE) + #set(${STRING_VAR} "${${STRING_VAR}}${LINE}" PARENT_SCOPE) + #print_var(STRING_VAR) +endfunction() diff --git a/cmake/tribits/core/utils/AssertAndTouchDefined.cmake b/cmake/tribits/core/utils/AssertAndTouchDefined.cmake index 31c2bfe6e807..d1912636da7a 100644 --- a/cmake/tribits/core/utils/AssertAndTouchDefined.cmake +++ b/cmake/tribits/core/utils/AssertAndTouchDefined.cmake @@ -37,13 +37,13 @@ # ************************************************************************ # @HEADER -FUNCTION(ASSERT_AND_TOUCH_DEFINED VARS) - FOREACH(VAR ${VARS}) - IF(NOT DEFINED ${VAR}) - MESSAGE(SEND_ERROR "Error, the variable ${VAR} is not defined!") - ELSE() - # Read the varaible so that it will register as being read! - SET(DUMMY_VAR ${${VAR}}) - ENDIF() - ENDFOREACH() -ENDFUNCTION() +function(assert_and_touch_defined VARS) + foreach(VAR ${VARS}) + if(NOT DEFINED ${VAR}) + message(SEND_ERROR "Error, the variable ${VAR} is not defined!") + else() + # Read the variable so that it will register as being read! + set(DUMMY_VAR ${${VAR}}) + endif() + endforeach() +endfunction() diff --git a/cmake/tribits/core/utils/AssertDefined.cmake b/cmake/tribits/core/utils/AssertDefined.cmake index 544036f8033a..6b60ed267ae9 100644 --- a/cmake/tribits/core/utils/AssertDefined.cmake +++ b/cmake/tribits/core/utils/AssertDefined.cmake @@ -38,22 +38,22 @@ # @HEADER # -# @FUNCTION: ASSERT_DEFINED() +# @FUNCTION: assert_defined() # -# Assert that a variable is defined and if not call ``MESSAGE(SEND_ERROR +# Assert that a variable is defined and if not call ``message(SEND_ERROR # ...)``. # # Usage:: # -# ASSERT_DEFINED() +# assert_defined() # # This is used to get around the problem of CMake not asserting the # dereferencing of undefined variables. For example, how does one know if one # did not misspell the name of a variable in an if statement like:: # -# IF (SOME_VARBLE) +# if (SOME_VARBLE) # ... -# ENDIF() +# endif() # # ? # @@ -61,10 +61,10 @@ # case), then the if statement will always be false! To avoid this problem # when one always expects that a variable is explicitly set, instead do:: # -# ASSERT_DEFINED(SOME_VARBLE) -# IF (SOME_VARBLE) +# assert_defined(SOME_VARBLE) +# if (SOME_VARBLE) # ... -# ENDIF() +# endif() # # Now if one misspells this variable, then CMake will asset and stop # processing. This is not a perfect solution since one can misspell the @@ -73,13 +73,13 @@ # same. This is the best that can be done in CMake unfortunately to catch # usage of misspelled undefined variables. # -FUNCTION(ASSERT_DEFINED VARS) - FOREACH(VAR ${VARS}) - IF(NOT DEFINED ${VAR}) - MESSAGE(SEND_ERROR "Error, the variable ${VAR} is not defined!") - ENDIF() - ENDFOREACH() -ENDFUNCTION() +function(assert_defined VARS) + foreach(VAR ${VARS}) + if(NOT DEFINED ${VAR}) + message(SEND_ERROR "Error, the variable ${VAR} is not defined!") + endif() + endforeach() +endfunction() # ToDo: The VARS arg This really needs to be repalced with ${ARGV}. I fear # that only the first arg passed in is asserted. However, to change this now diff --git a/cmake/tribits/core/utils/CMakeBuildTypesList.cmake b/cmake/tribits/core/utils/CMakeBuildTypesList.cmake index bcf594e4185f..f10c485ddc1e 100644 --- a/cmake/tribits/core/utils/CMakeBuildTypesList.cmake +++ b/cmake/tribits/core/utils/CMakeBuildTypesList.cmake @@ -37,5 +37,5 @@ # ************************************************************************ # @HEADER -SET(CMAKE_BUILD_TYPES_LIST +set(CMAKE_BUILD_TYPES_LIST DEBUG MINSIZEREL RELEASE RELWITHDEBINFO NONE) diff --git a/cmake/tribits/core/utils/CMakeOverrides.cmake b/cmake/tribits/core/utils/CMakeOverrides.cmake index da3284cb6347..1c95ecfdb703 100644 --- a/cmake/tribits/core/utils/CMakeOverrides.cmake +++ b/cmake/tribits/core/utils/CMakeOverrides.cmake @@ -37,10 +37,10 @@ # ************************************************************************ # @HEADER -INCLUDE(CMakeParseArguments) +include(CMakeParseArguments) # -# FUNCTION: TRIBITS_INCLUDE_DIRECTORIES() +# FUNCTION: tribits_include_directories() # # This function is to override the standard behavior of include_directories @@ -48,7 +48,7 @@ INCLUDE(CMakeParseArguments) # Usage:: # -# TRIBITS_INCLUDE_DIRECTORIES( +# tribits_include_directories( # [REQUIRED_DURING_INSTALLATION_TESTING] ... # ) # @@ -66,8 +66,8 @@ INCLUDE(CMakeParseArguments) # ``REQUIRED_DURING_INSTALLATION_TESTING`` to tell us that this include # directory does need to be set for instaltion testing. # -FUNCTION(TRIBITS_INCLUDE_DIRECTORIES) - CMAKE_PARSE_ARGUMENTS( +function(tribits_include_directories) + cmake_parse_arguments( #prefix PARSE #Options @@ -79,12 +79,12 @@ FUNCTION(TRIBITS_INCLUDE_DIRECTORIES) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - IF(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) - _INCLUDE_DIRECTORIES(${PARSE_DEFAULT_ARGS}) - ENDIF() -ENDFUNCTION() + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) + _include_directories(${PARSE_DEFAULT_ARGS}) + endif() +endfunction() #This function is to override the standard behavior of include_directories. # We are overriding the default behavior for installation testing, this allows @@ -96,8 +96,8 @@ ENDFUNCTION() #an exception to this and that is when there are test only headers that are needed. #For that case we allow people to set "REQUIRED_DURING_INSTALLATION_TESTING" to #tell us that this include directory does need to be set for instaltion testing. -FUNCTION(INCLUDE_DIRECTORIES) - CMAKE_PARSE_ARGUMENTS( +function(include_directories) + cmake_parse_arguments( #prefix PARSE #Options @@ -109,9 +109,9 @@ FUNCTION(INCLUDE_DIRECTORIES) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - IF(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) - _INCLUDE_DIRECTORIES(${PARSE_DEFAULT_ARGS}) - ENDIF() -ENDFUNCTION() + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) + _include_directories(${PARSE_DEFAULT_ARGS}) + endif() +endfunction() diff --git a/cmake/tribits/core/utils/CombinedOption.cmake b/cmake/tribits/core/utils/CombinedOption.cmake index 0eefcf90f1b0..6d5480931509 100644 --- a/cmake/tribits/core/utils/CombinedOption.cmake +++ b/cmake/tribits/core/utils/CombinedOption.cmake @@ -37,20 +37,20 @@ # ************************************************************************ # @HEADER -INCLUDE(CMakeParseArguments) -INCLUDE(MultilineSet) -INCLUDE(ConcatStrings) +include(CMakeParseArguments) +include(MultilineSet) +include(ConcatStrings) # -# @FUNCTION: COMBINED_OPTION() +# @FUNCTION: combined_option() # # Set up a ``BOOL`` cache variable (i.e. an option) based on a set of # dependent options. # # Usage:: # -# COMBINED_OPTION( +# combined_option( # DEP_OPTIONS_NAMES ... # DOCSTR "" "" ... # ) @@ -66,9 +66,9 @@ INCLUDE(ConcatStrings) # requires a set of other features (when they are all enabled) but allows a # user to disable the feature if desired. # -FUNCTION(COMBINED_OPTION COMBINED_OPTION_NAME) +function(combined_option COMBINED_OPTION_NAME) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -80,58 +80,58 @@ FUNCTION(COMBINED_OPTION COMBINED_OPTION_NAME) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() # ToDo: Assert that the right input was passed in! - SET(DEFAULT_VAL ON) - FOREACH( DEP_OPTION_NAME ${PARSE_DEP_OPTIONS_NAMES} ) - IF (NOT ${DEP_OPTION_NAME}) - SET(DEFAULT_VAL OFF) - ENDIF() - ENDFOREACH() + set(DEFAULT_VAL ON) + foreach( DEP_OPTION_NAME ${PARSE_DEP_OPTIONS_NAMES} ) + if (NOT ${DEP_OPTION_NAME}) + set(DEFAULT_VAL OFF) + endif() + endforeach() - CONCAT_STRINGS(DOCSTR ${PARSE_DOCSTR}) + concat_strings(DOCSTR ${PARSE_DOCSTR}) - OPTION(${COMBINED_OPTION_NAME} "${DOCSTR}" + option(${COMBINED_OPTION_NAME} "${DOCSTR}" ${DEFAULT_VAL} ) - #PRINT_VAR(${COMBINED_OPTION_NAME}) + #print_var(${COMBINED_OPTION_NAME}) # Determine if the combined option was turned on by the individual options # are not turned on as well. - SET(ALL_ENABLED TRUE) - IF (${COMBINED_OPTION_NAME}) - FOREACH( DEP_OPTION_NAME ${PARSE_DEP_OPTIONS_NAMES}) - #PRINT_VAR(${DEP_OPTION_NAME}) - IF (NOT ${DEP_OPTION_NAME}) - SET(ALL_ENABLED FALSE) - BREAK() - ENDIF() - ENDFOREACH() - ENDIF() + set(ALL_ENABLED TRUE) + if (${COMBINED_OPTION_NAME}) + foreach( DEP_OPTION_NAME ${PARSE_DEP_OPTIONS_NAMES}) + #print_var(${DEP_OPTION_NAME}) + if (NOT ${DEP_OPTION_NAME}) + set(ALL_ENABLED FALSE) + break() + endif() + endforeach() + endif() # Print out detailed error message if the combined option was enabled but # the dependent options were not. - IF (NOT ALL_ENABLED) - - SET(OPTION_NAMES "") - SET(OPTION_NAMES_AND_VALUES "") - FOREACH( DEP_OPTION_NAME ${PARSE_DEP_OPTIONS_NAMES}) - IF (NOT OPTION_NAMES) - SET(OPTION_NAMES "${DEP_OPTION_NAME}") - ELSE() - SET(OPTION_NAMES "${OPTION_NAMES}, ${DEP_OPTION_NAME}") - ENDIF() - SET(OPTION_NAMES_AND_VALUES + if (NOT ALL_ENABLED) + + set(OPTION_NAMES "") + set(OPTION_NAMES_AND_VALUES "") + foreach( DEP_OPTION_NAME ${PARSE_DEP_OPTIONS_NAMES}) + if (NOT OPTION_NAMES) + set(OPTION_NAMES "${DEP_OPTION_NAME}") + else() + set(OPTION_NAMES "${OPTION_NAMES}, ${DEP_OPTION_NAME}") + endif() + set(OPTION_NAMES_AND_VALUES "${OPTION_NAMES_AND_VALUES} ${DEP_OPTION_NAME}='${${DEP_OPTION_NAME}}'\n") - ENDFOREACH() + endforeach() - MESSAGE(FATAL_ERROR + message(FATAL_ERROR "Error: you can not enable the option ${COMBINED_OPTION_NAME} unless" " you also enable the options ${OPTION_NAMES}. The current option" " values are:\n${OPTION_NAMES_AND_VALUES}" ) - ENDIF() + endif() -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/utils/ConcatStrings.cmake b/cmake/tribits/core/utils/ConcatStrings.cmake index f7ff1b5da04a..0f49ac1a15ca 100644 --- a/cmake/tribits/core/utils/ConcatStrings.cmake +++ b/cmake/tribits/core/utils/ConcatStrings.cmake @@ -37,30 +37,30 @@ # ************************************************************************ # @HEADER -INCLUDE(PrintVar) +include(PrintVar) # -# @FUNCTION: CONCAT_STRINGS() +# @FUNCTION: concat_strings() # # Concatenate a set of string arguments. # # Usage:: # -# CONCAT_STRINGS( "" "" ...) +# concat_strings( "" "" ...) # # On output, ```` is set to ``"..."``. This makes it # easier to format a long string over multiple CMake source code lines. # -FUNCTION(CONCAT_STRINGS OUTPUT_STRING_VAR) - #MESSAGE("CONCAT_STRINGS OUTPUT_STRING_VAR: ${OUTPUT_STRING_VAR} {${ARGN}}") - #PRINT_VAR(${OUTPUT_STRING_VAR}) - SET(OUTPUT_STRING "") - #PRINT_VAR(OUTPUT_STRING) - FOREACH(STRING_VAL ${ARGN}) - #PRINT_VAR(STRING_VAL) - SET(OUTPUT_STRING "${OUTPUT_STRING}${STRING_VAL}") - #PRINT_VAR(OUTPUT_STRING) - ENDFOREACH() - SET(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE) -ENDFUNCTION() +function(concat_strings OUTPUT_STRING_VAR) + #message("CONCAT_STRINGS OUTPUT_STRING_VAR: ${OUTPUT_STRING_VAR} {${ARGN}}") + #print_var(${OUTPUT_STRING_VAR}) + set(OUTPUT_STRING "") + #print_var(OUTPUT_STRING) + foreach(STRING_VAL ${ARGN}) + #print_var(STRING_VAL) + set(OUTPUT_STRING "${OUTPUT_STRING}${STRING_VAL}") + #print_var(OUTPUT_STRING) + endforeach() + set(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/utils/DriveAdvancedTest.cmake b/cmake/tribits/core/utils/DriveAdvancedTest.cmake index f6356e6c347e..1950cac801b1 100644 --- a/cmake/tribits/core/utils/DriveAdvancedTest.cmake +++ b/cmake/tribits/core/utils/DriveAdvancedTest.cmake @@ -37,463 +37,463 @@ # ************************************************************************ # @HEADER -INCLUDE(PrintVar) -INCLUDE(AppendStringVar) -INCLUDE(Join) -INCLUDE(TimingUtils) -INCLUDE(TribitsGetCategoriesString) +include(PrintVar) +include(AppendStringVar) +include(Join) +include(TimingUtils) +include(TribitsGetCategoriesString) -FUNCTION(PRINT_CURRENT_DATE_TIME PREFIX_STR) - EXECUTE_PROCESS( COMMAND date OUTPUT_STRIP_TRAILING_WHITESPACE +function(print_current_date_time PREFIX_STR) + execute_process( COMMAND date OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE DATE_TIME ) - MESSAGE("${PREFIX_STR} ${DATE_TIME}\n") -ENDFUNCTION() + message("${PREFIX_STR} ${DATE_TIME}\n") +endfunction() -FUNCTION(PRINT_UPTIME PREFIX_STR) - EXECUTE_PROCESS( COMMAND uptime OUTPUT_STRIP_TRAILING_WHITESPACE +function(print_uptime PREFIX_STR) + execute_process( COMMAND uptime OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE MACHINE_LOAD ) - MESSAGE("${PREFIX_STR} ${MACHINE_LOAD}") -ENDFUNCTION() + message("${PREFIX_STR} ${MACHINE_LOAD}") +endfunction() -FUNCTION(PRINT_SINGLE_CHECK_RESULT MSG_BEGIN TEST_CASE_PASSED_IN) - IF (TEST_CASE_PASSED_IN) - MESSAGE("${MSG_BEGIN} [PASSED]") - ELSE() - MESSAGE("${MSG_BEGIN} [FAILED]") - ENDIF() -ENDFUNCTION() +function(print_single_check_result MSG_BEGIN TEST_CASE_PASSED_IN) + if (TEST_CASE_PASSED_IN) + message("${MSG_BEGIN} [PASSED]") + else() + message("${MSG_BEGIN} [FAILED]") + endif() +endfunction() -FUNCTION(DELETE_CREATE_WORKING_DIRECTORY WORKING_DIR_IN SKIP_CLEAN) - IF (EXISTS "${WORKING_DIR_IN}" AND NOT SKIP_CLEAN) - MESSAGE("Removing existing working directory" +function(delete_create_working_directory WORKING_DIR_IN SKIP_CLEAN) + if (EXISTS "${WORKING_DIR_IN}" AND NOT SKIP_CLEAN) + message("Removing existing working directory" " '${WORKING_DIR_IN}'\n") - IF (NOT SHOW_COMMANDS_ONLY) - FILE(REMOVE_RECURSE "${WORKING_DIR_IN}") - ENDIF() - ENDIF() - IF (NOT EXISTS "${WORKING_DIR_IN}") - MESSAGE("Creating new working directory" + if (NOT SHOW_COMMANDS_ONLY) + file(REMOVE_RECURSE "${WORKING_DIR_IN}") + endif() + endif() + if (NOT EXISTS "${WORKING_DIR_IN}") + message("Creating new working directory" " '${WORKING_DIR_IN}'\n") - IF (NOT SHOW_COMMANDS_ONLY) - FILE(MAKE_DIRECTORY "${WORKING_DIR_IN}") - ENDIF() - ENDIF() -ENDFUNCTION() + if (NOT SHOW_COMMANDS_ONLY) + file(MAKE_DIRECTORY "${WORKING_DIR_IN}") + endif() + endif() +endfunction() -MACRO(SETUP_AND_RUN_TEST_IDX_COPY_FILES_BLOCK) +macro(setup_and_run_test_idx_copy_files_block) - MESSAGE( + message( "Copy files from:\n" " ${TEST_${CMND_IDX}_SOURCE_DIR}/\n" " to:\n" " ${TEST_${CMND_IDX}_DEST_DIR}/\n") - SPLIT("${TEST_${CMND_IDX}_COPY_FILES_TO_TEST_DIR}" + split("${TEST_${CMND_IDX}_COPY_FILES_TO_TEST_DIR}" "," COPY_FILES_TO_TEST_DIR_ARRAY) - SET(TEST_CASE_PASSED TRUE) + set(TEST_CASE_PASSED TRUE) - MESSAGE("${OUTPUT_SEP}\n") + message("${OUTPUT_SEP}\n") # Make the dest directory if not exists (cmake -E copy will not create it) - IF (NOT EXISTS "${TEST_${CMND_IDX}_DEST_DIR}") - MESSAGE("Creating dest directory ${TEST_${CMND_IDX}_DEST_DIR}/ ...") - EXECUTE_PROCESS( + if (NOT EXISTS "${TEST_${CMND_IDX}_DEST_DIR}") + message("Creating dest directory ${TEST_${CMND_IDX}_DEST_DIR}/ ...") + execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory "${TEST_${CMND_IDX}_DEST_DIR}" RESULT_VARIABLE MKDIR_COMMAND_RTN ) - IF (NOT MKDIR_COMMAND_RTN EQUAL 0) - SET(TEST_CASE_PASSED FALSE) - ENDIF() - # NOTE: Above, it would have been great to be able use FILE(MAKE_DIRECTORY + if (NOT MKDIR_COMMAND_RTN EQUAL 0) + set(TEST_CASE_PASSED FALSE) + endif() + # NOTE: Above, it would have been great to be able use file(MAKE_DIRECTORY # ...) but if that fails it will just abortS the cmake -P script. There # is no way to handle that gracefully. Therefore, we have to use - # EXECUTE_PROCESS(cmake -E make_directory ...). - ENDIF() + # execute_process(cmake -E make_directory ...). + endif() # Copy the full list of files to the dest dir - FOREACH(FILENAME ${COPY_FILES_TO_TEST_DIR_ARRAY}) - MESSAGE("Copy file ${FILENAME} ...") - EXECUTE_PROCESS( + foreach(FILENAME ${COPY_FILES_TO_TEST_DIR_ARRAY}) + message("Copy file ${FILENAME} ...") + execute_process( COMMAND ${CMAKE_COMMAND} -E copy "${TEST_${CMND_IDX}_SOURCE_DIR}/${FILENAME}" "${TEST_${CMND_IDX}_DEST_DIR}/" RESULT_VARIABLE COPY_COMMAND_RTN ) - IF (NOT COPY_COMMAND_RTN EQUAL 0) - SET(TEST_CASE_PASSED FALSE) - ENDIF() - ENDFOREACH() + if (NOT COPY_COMMAND_RTN EQUAL 0) + set(TEST_CASE_PASSED FALSE) + endif() + endforeach() # NOTE: Above, it would have been great to be able use - # CONFIGURE_FILE(... COPYONLY) but if that fails it will just abortS the + # configure_file(... COPYONLY) but if that fails it will just abortS the # cmake -P script. There is no way to handle that gracefully. Therefore, - # we have to use EXECUTE_PROCESS(cmake -E copy ...). Also, it would have + # we have to use execute_process(cmake -E copy ...). Also, it would have # been great to just copy the files all at once with `cmake -E copy # / / ... /` but older versions of # CMake don't support that mode. They only support copying the files one at # a time :-( - MESSAGE("\n${OUTPUT_SEP}\n") + message("\n${OUTPUT_SEP}\n") - MESSAGE("") # Need a vertical space for readability of the output + message("") # Need a vertical space for readability of the output -ENDMACRO() +endmacro() -MACRO(SETUP_AND_RUN_TEST_IDX_CMND_BLOCK) +macro(setup_and_run_test_idx_cmnd_block) # Address working directory for this TEST_ block if set - IF (TEST_${CMND_IDX}_WORKING_DIRECTORY) - IF (NOT IS_ABSOLUTE "${TEST_${CMND_IDX}_WORKING_DIRECTORY}") - SET(TEST_${CMND_IDX}_WORKING_DIRECTORY + if (TEST_${CMND_IDX}_WORKING_DIRECTORY) + if (NOT IS_ABSOLUTE "${TEST_${CMND_IDX}_WORKING_DIRECTORY}") + set(TEST_${CMND_IDX}_WORKING_DIRECTORY ${BASE_WORKING_DIRECTORY}/${TEST_${CMND_IDX}_WORKING_DIRECTORY}) - ENDIF() - DELETE_CREATE_WORKING_DIRECTORY("${TEST_${CMND_IDX}_WORKING_DIRECTORY}" + endif() + delete_create_working_directory("${TEST_${CMND_IDX}_WORKING_DIRECTORY}" ${TEST_${CMND_IDX}_SKIP_CLEAN_WORKING_DIRECTORY}) - ENDIF() + endif() # Set up the TEST_ command block - JOIN( TEST_CMND_STR " " TRUE ${TEST_${CMND_IDX}_CMND} ) - MESSAGE("Running: ${TEST_CMND_STR}\n") - SET(EXEC_CMND COMMAND ${TEST_${CMND_IDX}_CMND}) + join( TEST_CMND_STR " " TRUE ${TEST_${CMND_IDX}_CMND} ) + message("Running: ${TEST_CMND_STR}\n") + set(EXEC_CMND COMMAND ${TEST_${CMND_IDX}_CMND}) # Set up the workig directory that this TEST_ CMND block will run in - SET(WORKING_DIR_SET) - IF (TEST_${CMND_IDX}_WORKING_DIRECTORY) - SET(WORKING_DIR_SET "${TEST_${CMND_IDX}_WORKING_DIRECTORY}") - ELSEIF(OVERALL_WORKING_DIRECTORY) - SET(WORKING_DIR_SET "${OVERALL_WORKING_DIRECTORY}") - ENDIF() + set(WORKING_DIR_SET) + if (TEST_${CMND_IDX}_WORKING_DIRECTORY) + set(WORKING_DIR_SET "${TEST_${CMND_IDX}_WORKING_DIRECTORY}") + elseif(OVERALL_WORKING_DIRECTORY) + set(WORKING_DIR_SET "${OVERALL_WORKING_DIRECTORY}") + endif() - IF (WORKING_DIR_SET) - MESSAGE(" Running in working directory \"${WORKING_DIR_SET}\"\n") - SET(WORKING_DIR "${WORKING_DIR_SET}") - ELSE() - SET(WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}") - ENDIF() + if (WORKING_DIR_SET) + message(" Running in working directory \"${WORKING_DIR_SET}\"\n") + set(WORKING_DIR "${WORKING_DIR_SET}") + else() + set(WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}") + endif() - # Set the actual command that will be run with EXECUTE_PROCES() + # Set the actual command that will be run with execute_proces() - SET(EXEC_CMND ${EXEC_CMND} + set(EXEC_CMND ${EXEC_CMND} WORKING_DIRECTORY "${WORKING_DIR}" ) - # Set up the optional output file that the EXECUTE_PROCESS() command will write to + # Set up the optional output file that the execute_process() command will write to - IF (TEST_${CMND_IDX}_OUTPUT_FILE) - IF (NOT IS_ABSOLUTE "${TEST_${CMND_IDX}_OUTPUT_FILE}") - SET(OUTPUT_FILE_USED "${WORKING_DIR}/${TEST_${CMND_IDX}_OUTPUT_FILE}") - ELSE() - SET(OUTPUT_FILE_USED "${TEST_${CMND_IDX}_OUTPUT_FILE}") - ENDIF() - MESSAGE(" Writing output to file \"${OUTPUT_FILE_USED}\"\n") - ENDIF() + if (TEST_${CMND_IDX}_OUTPUT_FILE) + if (NOT IS_ABSOLUTE "${TEST_${CMND_IDX}_OUTPUT_FILE}") + set(OUTPUT_FILE_USED "${WORKING_DIR}/${TEST_${CMND_IDX}_OUTPUT_FILE}") + else() + set(OUTPUT_FILE_USED "${TEST_${CMND_IDX}_OUTPUT_FILE}") + endif() + message(" Writing output to file \"${OUTPUT_FILE_USED}\"\n") + endif() - # Run the actual command with EXECUTTE_PROCESS() (or just print what would run) ... + # Run the actual command with executte_process() (or just print what would run) ... - IF (NOT SHOW_COMMANDS_ONLY) + if (NOT SHOW_COMMANDS_ONLY) # Provide the test configuration in an environment variable. - IF(TEST_CONFIG) - SET(ENV{TEST_CONFIG} "${TEST_CONFIG}") - ENDIF(TEST_CONFIG) + if(TEST_CONFIG) + set(ENV{TEST_CONFIG} "${TEST_CONFIG}") + endif(TEST_CONFIG) - EXECUTE_PROCESS( + execute_process( ${EXEC_CMND} OUTPUT_VARIABLE TEST_CMND_OUT ERROR_VARIABLE TEST_CMND_OUT RESULT_VARIABLE EXEC_RESULT ) - IF (TEST_${CMND_IDX}_OUTPUT_FILE) - FILE(WRITE "${OUTPUT_FILE_USED}" "${TEST_CMND_OUT}") - ENDIF() + if (TEST_${CMND_IDX}_OUTPUT_FILE) + file(WRITE "${OUTPUT_FILE_USED}" "${TEST_CMND_OUT}") + endif() - MESSAGE("${OUTPUT_SEP}\n") + message("${OUTPUT_SEP}\n") - IF (NOT TEST_${CMND_IDX}_NO_ECHO_OUTPUT) - MESSAGE("${TEST_CMND_OUT}") - ELSE() - MESSAGE("NO_ECHO_OUTPUT\n") - ENDIF() + if (NOT TEST_${CMND_IDX}_NO_ECHO_OUTPUT) + message("${TEST_CMND_OUT}") + else() + message("NO_ECHO_OUTPUT\n") + endif() - ELSE() + else() - MESSAGE("\n*** Not running command on request ***") + message("\n*** Not running command on request ***") - ENDIF() + endif() - MESSAGE("${OUTPUT_SEP}\n") + message("${OUTPUT_SEP}\n") -ENDMACRO() +endmacro() -MACRO(DETERMINE_TEST_IDX_CMND_BLOCK_PASS_FAIL) +macro(determine_test_idx_cmnd_block_pass_fail) - MESSAGE("TEST_${CMND_IDX}: Return code = ${EXEC_RESULT}") + message("TEST_${CMND_IDX}: Return code = ${EXEC_RESULT}") # A) Apply first set of pass/fail logic - SET(TEST_CASE_PASSED FALSE) - IF (TEST_${CMND_IDX}_PASS_ANY) - SET(TEST_CASE_PASSED TRUE) - PRINT_SINGLE_CHECK_RESULT( + set(TEST_CASE_PASSED FALSE) + if (TEST_${CMND_IDX}_PASS_ANY) + set(TEST_CASE_PASSED TRUE) + print_single_check_result( "TEST_${CMND_IDX}: Pass criteria = Pass Any" ${TEST_CASE_PASSED} ) - ELSEIF (TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION) - STRING(REGEX MATCH "${TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION}" + elseif (TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION) + string(REGEX MATCH "${TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION}" MATCH_STR "${TEST_CMND_OUT}" ) - IF (MATCH_STR) - SET(TEST_CASE_PASSED TRUE) - ELSE() - SET(TEST_CASE_PASSED FALSE) - ENDIF() - PRINT_SINGLE_CHECK_RESULT( + if (MATCH_STR) + set(TEST_CASE_PASSED TRUE) + else() + set(TEST_CASE_PASSED FALSE) + endif() + print_single_check_result( "TEST_${CMND_IDX}: Pass criteria = Match REGEX {${TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION}}" ${TEST_CASE_PASSED}) - ELSEIF (TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION_ALL) - SET(TEST_CASE_PASSED TRUE) - FOREACH(REGEX_STR ${TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION_ALL}) - STRING(REGEX MATCH "${REGEX_STR}" MATCH_STR "${TEST_CMND_OUT}" ) - IF (NOT "${MATCH_STR}" STREQUAL "") - SET(THIS_REGEX_MATCHED TRUE) - ELSE() - SET(THIS_REGEX_MATCHED FALSE) - ENDIF() - IF (NOT THIS_REGEX_MATCHED) - SET(TEST_CASE_PASSED FALSE) - ENDIF() - PRINT_SINGLE_CHECK_RESULT( + elseif (TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION_ALL) + set(TEST_CASE_PASSED TRUE) + foreach(REGEX_STR ${TEST_${CMND_IDX}_PASS_REGULAR_EXPRESSION_ALL}) + string(REGEX MATCH "${REGEX_STR}" MATCH_STR "${TEST_CMND_OUT}" ) + if (NOT "${MATCH_STR}" STREQUAL "") + set(THIS_REGEX_MATCHED TRUE) + else() + set(THIS_REGEX_MATCHED FALSE) + endif() + if (NOT THIS_REGEX_MATCHED) + set(TEST_CASE_PASSED FALSE) + endif() + print_single_check_result( "TEST_${CMND_IDX}: Pass criteria = Match REGEX {${REGEX_STR}}" ${THIS_REGEX_MATCHED} ) - ENDFOREACH() - ELSE() - IF (EXEC_RESULT EQUAL 0) - SET(TEST_CASE_PASSED TRUE) - ELSE() - SET(TEST_CASE_PASSED FALSE) - ENDIF() - PRINT_SINGLE_CHECK_RESULT( + endforeach() + else() + if (EXEC_RESULT EQUAL 0) + set(TEST_CASE_PASSED TRUE) + else() + set(TEST_CASE_PASSED FALSE) + endif() + print_single_check_result( "TEST_${CMND_IDX}: Pass criteria = Zero return code" ${TEST_CASE_PASSED} ) - ENDIF() + endif() # B) Check for failing regex matching? - IF (TEST_${CMND_IDX}_FAIL_REGULAR_EXPRESSION) - STRING(REGEX MATCH "${TEST_${CMND_IDX}_FAIL_REGULAR_EXPRESSION}" + if (TEST_${CMND_IDX}_FAIL_REGULAR_EXPRESSION) + string(REGEX MATCH "${TEST_${CMND_IDX}_FAIL_REGULAR_EXPRESSION}" MATCH_STR "${TEST_CMND_OUT}" ) - IF (MATCH_STR) - SET(TEST_CASE_PASSED FALSE) - ENDIF() - PRINT_SINGLE_CHECK_RESULT( + if (MATCH_STR) + set(TEST_CASE_PASSED FALSE) + endif() + print_single_check_result( "TEST_${CMND_IDX}: Pass criteria = Not match REGEX {${TEST_${CMND_IDX}_FAIL_REGULAR_EXPRESSION}}" ${TEST_CASE_PASSED} ) - ENDIF() + endif() # C) Check for return code always 0? - IF (TEST_${CMND_IDX}_ALWAYS_FAIL_ON_NONZERO_RETURN) - IF (NOT EXEC_RESULT EQUAL 0) - SET(ALWAYS_FAIL_ON_NONZERO_RETURN_PASSED FALSE) - SET(TEST_CASE_PASSED FALSE) - ELSE() - SET(ALWAYS_FAIL_ON_NONZERO_RETURN_PASSED TRUE) - ENDIF() - PRINT_SINGLE_CHECK_RESULT( + if (TEST_${CMND_IDX}_ALWAYS_FAIL_ON_NONZERO_RETURN) + if (NOT EXEC_RESULT EQUAL 0) + set(ALWAYS_FAIL_ON_NONZERO_RETURN_PASSED FALSE) + set(TEST_CASE_PASSED FALSE) + else() + set(ALWAYS_FAIL_ON_NONZERO_RETURN_PASSED TRUE) + endif() + print_single_check_result( "TEST_${CMND_IDX}: Pass criteria = ALWAYS_FAIL_ON_NONZERO_RETURN" ${ALWAYS_FAIL_ON_NONZERO_RETURN_PASSED} ) - ELSEIF (TEST_${CMND_IDX}_ALWAYS_FAIL_ON_ZERO_RETURN) - IF (EXEC_RESULT EQUAL 0) - SET(ALWAYS_FAIL_ON_ZERO_RETURN_PASSED FALSE) - SET(TEST_CASE_PASSED FALSE) - ELSE() - SET(ALWAYS_FAIL_ON_ZERO_RETURN_PASSED TRUE) - ENDIF() - PRINT_SINGLE_CHECK_RESULT( + elseif (TEST_${CMND_IDX}_ALWAYS_FAIL_ON_ZERO_RETURN) + if (EXEC_RESULT EQUAL 0) + set(ALWAYS_FAIL_ON_ZERO_RETURN_PASSED FALSE) + set(TEST_CASE_PASSED FALSE) + else() + set(ALWAYS_FAIL_ON_ZERO_RETURN_PASSED TRUE) + endif() + print_single_check_result( "TEST_${CMND_IDX}: Pass criteria = ALWAYS_FAIL_ON_ZERO_RETURN" ${ALWAYS_FAIL_ON_ZERO_RETURN_PASSED} ) - ENDIF() + endif() # D) Invert pass/fail result? - IF (TEST_${CMND_IDX}_WILL_FAIL) - IF (TEST_CASE_PASSED) - SET(TEST_CASE_PASSED FALSE) - ELSE() - SET(TEST_CASE_PASSED TRUE) - ENDIF() - PRINT_SINGLE_CHECK_RESULT( + if (TEST_${CMND_IDX}_WILL_FAIL) + if (TEST_CASE_PASSED) + set(TEST_CASE_PASSED FALSE) + else() + set(TEST_CASE_PASSED TRUE) + endif() + print_single_check_result( "TEST_${CMND_IDX}: Pass criteria = WILL_FAIL (invert the above 'Pass critera')" ${TEST_CASE_PASSED} ) - ENDIF() + endif() -ENDMACRO() +endmacro() -FUNCTION(DRIVE_ADVANCED_TEST) +function(drive_advanced_test) # # A) Print the header for the advanced test # - SET(ADVANDED_TEST_SEP + set(ADVANDED_TEST_SEP "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") - SET(TEST_SEP + set(TEST_SEP "================================================================================") - SET(OUTPUT_SEP + set(OUTPUT_SEP "--------------------------------------------------------------------------------") - MATH(EXPR LAST_CMND_IDX ${NUM_CMNDS}-1) - - MESSAGE("\n${ADVANDED_TEST_SEP}\n") - MESSAGE("Advanced Test: ${TEST_NAME}\n") - - MESSAGE("Selected Test/CTest Propeties:") - TRIBITS_GET_CATEGORIES_STRING("${CATEGORIES}" CATEGORIES_IN_COMMAS) - MESSAGE(" CATEGORIES = ${CATEGORIES_IN_COMMAS}") - MESSAGE(" PROCESSORS = ${PROCESSORS}") - IF (TIMEOUT) - MESSAGE(" TIMEOUT = ${TIMEOUT}\n") - ELSE() - MESSAGE(" TIMEOUT = DEFAULT\n") - ENDIF() - - IF (SHOW_MACHINE_LOAD AND NOT SHOW_COMMANDS_ONLY) - PRINT_UPTIME("Starting Uptime:") - ENDIF() - - IF (SHOW_START_END_DATE_TIME AND NOT SHOW_COMMANDS_ONLY) - PRINT_CURRENT_DATE_TIME("Starting at:") - ENDIF() - - IF (OVERALL_WORKING_DIRECTORY) - IF (NOT IS_ABSOLUTE "${OVERALL_WORKING_DIRECTORY}") - SET(OVERALL_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${OVERALL_WORKING_DIRECTORY}) - ENDIF() - DELETE_CREATE_WORKING_DIRECTORY("${OVERALL_WORKING_DIRECTORY}" + math(EXPR LAST_CMND_IDX ${NUM_CMNDS}-1) + + message("\n${ADVANDED_TEST_SEP}\n") + message("Advanced Test: ${TEST_NAME}\n") + + message("Selected Test/CTest Properties:") + tribits_get_categories_string("${CATEGORIES}" CATEGORIES_IN_COMMAS) + message(" CATEGORIES = ${CATEGORIES_IN_COMMAS}") + message(" PROCESSORS = ${PROCESSORS}") + if (TIMEOUT) + message(" TIMEOUT = ${TIMEOUT}\n") + else() + message(" TIMEOUT = DEFAULT\n") + endif() + + if (SHOW_MACHINE_LOAD AND NOT SHOW_COMMANDS_ONLY) + print_uptime("Starting Uptime:") + endif() + + if (SHOW_START_END_DATE_TIME AND NOT SHOW_COMMANDS_ONLY) + print_current_date_time("Starting at:") + endif() + + if (OVERALL_WORKING_DIRECTORY) + if (NOT IS_ABSOLUTE "${OVERALL_WORKING_DIRECTORY}") + set(OVERALL_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${OVERALL_WORKING_DIRECTORY}) + endif() + delete_create_working_directory("${OVERALL_WORKING_DIRECTORY}" ${SKIP_CLEAN_OVERALL_WORKING_DIRECTORY}) - SET(BASE_WORKING_DIRECTORY "${OVERALL_WORKING_DIRECTORY}") - ELSE() - SET(BASE_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - ENDIF() - - FOREACH ( CMND_IDX RANGE ${LAST_CMND_IDX} ) - IF (CMND_IDX EQUAL 0) - SET(TEST_NAMES_STR "TEST_0") - ELSE() - APPEND_STRING_VAR( TEST_NAMES_STR ", TEST_${CMND_IDX}" ) - ENDIF() - ENDFOREACH() - MESSAGE("Running test commands: ${TEST_NAMES_STR}") - - IF (SHOW_START_END_DATE_TIME AND NOT SHOW_COMMANDS_ONLY) - TIMER_GET_RAW_SECONDS(TEST_CMND_START) - SET(TEST_OVERALL_START ${TEST_CMND_START}) - ENDIF() + set(BASE_WORKING_DIRECTORY "${OVERALL_WORKING_DIRECTORY}") + else() + set(BASE_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + endif() + + foreach ( CMND_IDX RANGE ${LAST_CMND_IDX} ) + if (CMND_IDX EQUAL 0) + set(TEST_NAMES_STR "TEST_0") + else() + append_string_var( TEST_NAMES_STR ", TEST_${CMND_IDX}" ) + endif() + endforeach() + message("Running test commands: ${TEST_NAMES_STR}") + + if (SHOW_START_END_DATE_TIME AND NOT SHOW_COMMANDS_ONLY) + timer_get_raw_seconds(TEST_CMND_START) + set(TEST_OVERALL_START ${TEST_CMND_START}) + endif() # # B) Loop over and run the TEST_ blocks one at a time # - SET(OVERALL_TEST_PASSED TRUE) + set(OVERALL_TEST_PASSED TRUE) - FOREACH ( CMND_IDX RANGE ${LAST_CMND_IDX} ) - MESSAGE("\n${TEST_SEP}\n") - MESSAGE("TEST_${CMND_IDX}\n") + foreach ( CMND_IDX RANGE ${LAST_CMND_IDX} ) + message("\n${TEST_SEP}\n") + message("TEST_${CMND_IDX}\n") # Print the message for this TEST_ block if set - IF (TEST_${CMND_IDX}_MESSAGE) - MESSAGE("${TEST_${CMND_IDX}_MESSAGE}\n") - ENDIF() + if (TEST_${CMND_IDX}_MESSAGE) + message("${TEST_${CMND_IDX}_MESSAGE}\n") + endif() # Run the TEST_ block (Copy files or CMND) - IF (TEST_${CMND_IDX}_COPY_FILES_TO_TEST_DIR) - SETUP_AND_RUN_TEST_IDX_COPY_FILES_BLOCK() - ELSE() - SETUP_AND_RUN_TEST_IDX_CMND_BLOCK() - ENDIF() + if (TEST_${CMND_IDX}_COPY_FILES_TO_TEST_DIR) + setup_and_run_test_idx_copy_files_block() + else() + setup_and_run_test_idx_cmnd_block() + endif() # Print the load and/or timing info for TEST_ block - IF (SHOW_MACHINE_LOAD AND NOT SHOW_COMMANDS_ONLY) - PRINT_UPTIME("TEST_${CMND_IDX}: Uptime:") - ENDIF() + if (SHOW_MACHINE_LOAD AND NOT SHOW_COMMANDS_ONLY) + print_uptime("TEST_${CMND_IDX}: Uptime:") + endif() - IF (SHOW_START_END_DATE_TIME AND NOT SHOW_COMMANDS_ONLY) - TIMER_GET_RAW_SECONDS(TEST_CMND_END) - IF (TEST_CMND_START AND TEST_CMND_END) - TIMER_PRINT_REL_TIME(${TEST_CMND_START} ${TEST_CMND_END} + if (SHOW_START_END_DATE_TIME AND NOT SHOW_COMMANDS_ONLY) + timer_get_raw_seconds(TEST_CMND_END) + if (TEST_CMND_START AND TEST_CMND_END) + timer_print_rel_time(${TEST_CMND_START} ${TEST_CMND_END} "TEST_${CMND_IDX}: Time") - ELSE() - MESSAGE("ERROR: Not able to return test times! Is 'date' in your path?") - ENDIF() - SET(TEST_CMND_START ${TEST_CMND_END}) - ENDIF() + else() + message("ERROR: Not able to return test times! Is 'date' in your path?") + endif() + set(TEST_CMND_START ${TEST_CMND_END}) + endif() # Determine pass/fail for the TEST_ CMND block - IF (NOT SHOW_COMMANDS_ONLY) + if (NOT SHOW_COMMANDS_ONLY) # Determine pass/fail for TEST_ copy files or CMND - IF (TEST_${CMND_IDX}_COPY_FILES_TO_TEST_DIR) + if (TEST_${CMND_IDX}_COPY_FILES_TO_TEST_DIR) # Pass/fail already determined by setting TEST_CASE_PASSED in # SETUP_AND_RUN_TEST_IDX_COPY_FILES_BLOCK above. - ELSE() - DETERMINE_TEST_IDX_CMND_BLOCK_PASS_FAIL() - ENDIF() + else() + determine_test_idx_cmnd_block_pass_fail() + endif() # Print final pass/fail for the TEST_ block - IF (TEST_CASE_PASSED) - MESSAGE("TEST_${CMND_IDX}: Result = PASSED") - ELSE() - MESSAGE("TEST_${CMND_IDX}: Result = FAILED") - SET(OVERALL_TEST_PASSED FALSE) - IF (FAIL_FAST) - MESSAGE("TEST_${CMND_IDX}: FAIL FAST, SKIPPING REST OF TEST CASES!") - BREAK() - ENDIF() - ENDIF() + if (TEST_CASE_PASSED) + message("TEST_${CMND_IDX}: Result = PASSED") + else() + message("TEST_${CMND_IDX}: Result = FAILED") + set(OVERALL_TEST_PASSED FALSE) + if (FAIL_FAST) + message("TEST_${CMND_IDX}: FAIL FAST, SKIPPING REST OF TEST CASES!") + break() + endif() + endif() - ENDIF(NOT SHOW_COMMANDS_ONLY) + endif(NOT SHOW_COMMANDS_ONLY) - ENDFOREACH() + endforeach() - MESSAGE("\n${TEST_SEP}\n") + message("\n${TEST_SEP}\n") # # C) Print the final test data and pass/fail # - IF (NOT SHOW_COMMANDS_ONLY) + if (NOT SHOW_COMMANDS_ONLY) - IF (SHOW_START_END_DATE_TIME) - PRINT_CURRENT_DATE_TIME("Ending at:") - IF (TEST_OVERALL_START AND TEST_CMND_END) - TIMER_PRINT_REL_TIME(${TEST_OVERALL_START} ${TEST_CMND_END} + if (SHOW_START_END_DATE_TIME) + print_current_date_time("Ending at:") + if (TEST_OVERALL_START AND TEST_CMND_END) + timer_print_rel_time(${TEST_OVERALL_START} ${TEST_CMND_END} "OVERALL TEST TIME") - ELSE() - MESSAGE("ERROR: Not able to return test times! Is 'date' in your path?") - ENDIF() - MESSAGE("") - ENDIF() - - IF (OVERALL_TEST_PASSED) - MESSAGE("OVERALL FINAL RESULT: TEST PASSED (${TEST_NAME})") - ELSE() - MESSAGE("OVERALL FINAL RESULT: TEST FAILED (${TEST_NAME})") - ENDIF() - ELSE() - MESSAGE("OVERALL FINAL RESULT: DID NOT RUN COMMANDS (${TEST_NAME})") - ENDIF() - - MESSAGE("\n${ADVANDED_TEST_SEP}\n") - -ENDFUNCTION() + else() + message("ERROR: Not able to return test times! Is 'date' in your path?") + endif() + message("") + endif() + + if (OVERALL_TEST_PASSED) + message("OVERALL FINAL RESULT: TEST PASSED (${TEST_NAME})") + else() + message("OVERALL FINAL RESULT: TEST FAILED (${TEST_NAME})") + endif() + else() + message("OVERALL FINAL RESULT: DID NOT RUN COMMANDS (${TEST_NAME})") + endif() + + message("\n${ADVANDED_TEST_SEP}\n") + +endfunction() diff --git a/cmake/tribits/core/utils/DualScopeAppendCmndlineArgs.cmake b/cmake/tribits/core/utils/DualScopeAppendCmndlineArgs.cmake index 8fa85516bf32..65c6738d8b65 100644 --- a/cmake/tribits/core/utils/DualScopeAppendCmndlineArgs.cmake +++ b/cmake/tribits/core/utils/DualScopeAppendCmndlineArgs.cmake @@ -37,22 +37,22 @@ # ************************************************************************ # @HEADER -INCLUDE(AppendCmndlineArgs) -INCLUDE(DualScopeSet) +include(AppendCmndlineArgs) +include(DualScopeSet) # -# @MACRO: DUAL_SCOPE_APPEND_CMNDLINE_ARGS() +# @MACRO: dual_scope_append_cmndline_args() # # Utility function that appends command-line arguments to a variable of # command-line options and sets the result in current scope and parent scope. # # Usage:: # -# DUAL_SCOPE_APPEND_CMNDLINE_ARGS( "") +# dual_scope_append_cmndline_args( "") # -# Just calls `APPEND_CMNDLINE_ARGS()`_ and then ``SET( ${} PARENT_SCOPE)``. +# Just calls `append_cmndline_args()`_ and then ``set( ${} PARENT_SCOPE)``. # -MACRO(DUAL_SCOPE_APPEND_CMNDLINE_ARGS CMNDLINE_VAR_NAME EXTRAARGS) - APPEND_CMNDLINE_ARGS(${CMNDLINE_VAR_NAME} "${EXTRAARGS}") - SET(${CMNDLINE_VAR_NAME} "${${CMNDLINE_VAR_NAME}}" PARENT_SCOPE) -ENDMACRO() +macro(dual_scope_append_cmndline_args CMNDLINE_VAR_NAME EXTRAARGS) + append_cmndline_args(${CMNDLINE_VAR_NAME} "${EXTRAARGS}") + set(${CMNDLINE_VAR_NAME} "${${CMNDLINE_VAR_NAME}}" PARENT_SCOPE) +endmacro() diff --git a/cmake/tribits/core/utils/DualScopePrependCmndlineArgs.cmake b/cmake/tribits/core/utils/DualScopePrependCmndlineArgs.cmake index d409f4cab30c..a4a8a627cd47 100644 --- a/cmake/tribits/core/utils/DualScopePrependCmndlineArgs.cmake +++ b/cmake/tribits/core/utils/DualScopePrependCmndlineArgs.cmake @@ -37,11 +37,11 @@ # ************************************************************************ # @HEADER -INCLUDE(PrependCmndlineArgs) -INCLUDE(DualScopeSet) +include(PrependCmndlineArgs) +include(DualScopeSet) # -# @MACRO: DUAL_SCOPE_PREPEND_CMNDLINE_ARGS() +# @MACRO: dual_scope_prepend_cmndline_args() # # Utility function that prepends command-line arguments to a variable of # command-line arguments and sets the result in current scope and parent @@ -49,11 +49,11 @@ INCLUDE(DualScopeSet) # # Usage:: # -# DUAL_SCOPE_PREPEND_CMNDLINE_ARGS( "") +# dual_scope_prepend_cmndline_args( "") # -# Just calls `PREPEND_CMNDLINE_ARGS()`_ and then ``SET( ${} PARENT_SCOPE)``. +# Just calls `prepend_cmndline_args()`_ and then ``set( ${} PARENT_SCOPE)``. # -MACRO(DUAL_SCOPE_PREPEND_CMNDLINE_ARGS CMNDLINE_VAR_NAME EXTRAARGS) - PREPEND_CMNDLINE_ARGS(${CMNDLINE_VAR_NAME} "${EXTRAARGS}") - SET(${CMNDLINE_VAR_NAME} "${${CMNDLINE_VAR_NAME}}" PARENT_SCOPE) -ENDMACRO() +macro(dual_scope_prepend_cmndline_args CMNDLINE_VAR_NAME EXTRAARGS) + prepend_cmndline_args(${CMNDLINE_VAR_NAME} "${EXTRAARGS}") + set(${CMNDLINE_VAR_NAME} "${${CMNDLINE_VAR_NAME}}" PARENT_SCOPE) +endmacro() diff --git a/cmake/tribits/core/utils/DualScopeSet.cmake b/cmake/tribits/core/utils/DualScopeSet.cmake index 7c57d332a461..8ea8ecb5fa06 100644 --- a/cmake/tribits/core/utils/DualScopeSet.cmake +++ b/cmake/tribits/core/utils/DualScopeSet.cmake @@ -39,20 +39,20 @@ # -# @MACRO: DUAL_SCOPE_SET() +# @MACRO: dual_scope_set() # # Macro that sets a variable name both in the current scope and the # parent scope. # # Usage:: # -# DUAL_SCOPE_SET( [other args]) +# dual_scope_set( [other args]) # -# It turns out that when one calls ``ADD_SUBDIRECTORY()`` or enters a +# It turns out that when one calls ``add_subdirectory()`` or enters a # ``FUNCTION`` that CMake actually creates a copy of all of the regular # non-cache variables in the current scope in order to create a new set of # variables for the ``CMakeLists.txt`` file in ````. This means that -# if you call ``SET(SOMEVAR Blah PARENT_SCOPE)`` that it will not affect the +# if you call ``set(SOMEVAR Blah PARENT_SCOPE)`` that it will not affect the # value of ``SOMEVAR`` in the current scope! This macro therefore is designed # to set the value of the variable in the current scope and the parent scope # in one shot to avoid confusion. @@ -61,11 +61,11 @@ # ``CMakeLists.txt`` file or enters a ``FUNCTION``, then a local copy of the # variable is *not* created. If one sets the variable locally, it will shadow # the global variable. However, if one sets the global cache value with -# ``SET(SOMEVAR someValue CACHE INTERNAL "")``, then the value will get +# ``set(SOMEVAR someValue CACHE INTERNAL "")``, then the value will get # changed in the current subordinate scope and in all parent scopes all in one # shot! # -MACRO(DUAL_SCOPE_SET VARNAME) - SET(${VARNAME} ${ARGN} PARENT_SCOPE) - SET(${VARNAME} ${ARGN}) -ENDMACRO() +macro(dual_scope_set VARNAME) + set(${VARNAME} ${ARGN} PARENT_SCOPE) + set(${VARNAME} ${ARGN}) +endmacro() diff --git a/cmake/tribits/core/utils/FindListElement.cmake b/cmake/tribits/core/utils/FindListElement.cmake index 5c551855db60..2c7000f7bdaf 100644 --- a/cmake/tribits/core/utils/FindListElement.cmake +++ b/cmake/tribits/core/utils/FindListElement.cmake @@ -43,15 +43,15 @@ # true. Otherwise returns false. # -FUNCTION(FIND_LIST_ELEMENT LIST_NAME ELEMENT_VAL ELEMENT_FOUND_OUT) - #MESSAGE("FIND_LIST_ELEMENT: ${LIST_NAME} ${ELEMENT_VAL}") - #PRINT_VAR(${LIST_NAME}) - LIST(FIND ${LIST_NAME} ${ELEMENT_VAL} ELEMENT_IDX) - IF (ELEMENT_IDX EQUAL -1) - SET(ELEMENT_FOUND FALSE) - ELSE() - SET(ELEMENT_FOUND TRUE) - ENDIF() - #PRINT_VAR(ELEMENT_FOUND) - SET(${ELEMENT_FOUND_OUT} ${ELEMENT_FOUND} PARENT_SCOPE) -ENDFUNCTION() +function(find_list_element LIST_NAME ELEMENT_VAL ELEMENT_FOUND_OUT) + #message("FIND_LIST_ELEMENT: ${LIST_NAME} ${ELEMENT_VAL}") + #print_var(${LIST_NAME}) + list(FIND ${LIST_NAME} ${ELEMENT_VAL} ELEMENT_IDX) + if (ELEMENT_IDX EQUAL -1) + set(ELEMENT_FOUND FALSE) + else() + set(ELEMENT_FOUND TRUE) + endif() + #print_var(ELEMENT_FOUND) + set(${ELEMENT_FOUND_OUT} ${ELEMENT_FOUND} PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/utils/FindProgramPlus.cmake b/cmake/tribits/core/utils/FindProgramPlus.cmake index ae782afbb835..341245edcd6b 100644 --- a/cmake/tribits/core/utils/FindProgramPlus.cmake +++ b/cmake/tribits/core/utils/FindProgramPlus.cmake @@ -37,8 +37,8 @@ # ************************************************************************ # @HEADER -INCLUDE(CMakeParseArguments) -INCLUDE(PrintNonemptyVar) +include(CMakeParseArguments) +include(PrintNonemptyVar) # # Finds the absolute path for a program given optionally just the program name @@ -55,9 +55,9 @@ INCLUDE(PrintNonemptyVar) # Documentation string # -FUNCTION(FIND_PROGRAM_PLUS PROG_VAR) +function(find_program_plus PROG_VAR) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -69,35 +69,35 @@ FUNCTION(FIND_PROGRAM_PLUS PROG_VAR) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - PRINT_NONEMPTY_VAR(${PROG_VAR}) + print_nonempty_var(${PROG_VAR}) - IF (IS_ABSOLUTE ${PROG_VAR}) - #MESSAGE(STATUS "Is Absoute") - SET(NAMES_ARGS ${PARSE_NAMES}) - ELSE() - #MESSAGE(STATUS "Is Not Absolute") - SET(NAMES_ARGS ${${PROG_VAR}} ${PARSE_NAMES}) - SET(${PROG_VAR} "${PROG_VAR}-NOTFOUND" CACHE FILEPATH "" FORCE) - ENDIF() - #PRINT_VAR(NAMES_ARGS) + if (IS_ABSOLUTE ${PROG_VAR}) + #message(STATUS "Is Absolute") + set(NAMES_ARGS ${PARSE_NAMES}) + else() + #message(STATUS "Is Not Absolute") + set(NAMES_ARGS ${${PROG_VAR}} ${PARSE_NAMES}) + set(${PROG_VAR} "${PROG_VAR}-NOTFOUND" CACHE FILEPATH "" FORCE) + endif() + #print_var(NAMES_ARGS) - SET(DOC "${PARSE_DOC} Can be full path or just exec name.") + set(DOC "${PARSE_DOC} Can be full path or just exec name.") # Look for program in given paths first! - FIND_PROGRAM( ${PROG_VAR} + find_program( ${PROG_VAR} NAMES ${NAMES_ARGS} PATHS ${PARSE_PATHS} DOC ${DOC} NO_DEFAULT_PATH ) - FIND_PROGRAM( ${PROG_VAR} + find_program( ${PROG_VAR} NAMES ${NAMES_ARGS} DOC ${DOC} ) - MARK_AS_ADVANCED(${PROG_VAR}) + mark_as_advanced(${PROG_VAR}) - PRINT_NONEMPTY_VAR(${PROG_VAR}) + print_nonempty_var(${PROG_VAR}) -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/utils/GetCurrentListDir.cmake b/cmake/tribits/core/utils/GetCurrentListDir.cmake index 7c17c94aa270..648e58329259 100644 --- a/cmake/tribits/core/utils/GetCurrentListDir.cmake +++ b/cmake/tribits/core/utils/GetCurrentListDir.cmake @@ -45,9 +45,9 @@ # will return the directory of the calling file. If called within a # function or macro, this will return the directory containing the # caller. -FUNCTION(GET_CURRENT_LIST_DIR output_variable) - IF(NOT DEFINED CMAKE_CURRENT_LIST_DIR) - GET_FILENAME_COMPONENT(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) - ENDIF() - SET(${output_variable} "${CMAKE_CURRENT_LIST_DIR}" PARENT_SCOPE) -ENDFUNCTION() \ No newline at end of file +function(get_current_list_dir output_variable) + if(NOT DEFINED CMAKE_CURRENT_LIST_DIR) + get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + endif() + set(${output_variable} "${CMAKE_CURRENT_LIST_DIR}" PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/cmake/tribits/core/utils/GetLastDirName.cmake b/cmake/tribits/core/utils/GetLastDirName.cmake index a3dc5647caa6..e7241305fb1e 100644 --- a/cmake/tribits/core/utils/GetLastDirName.cmake +++ b/cmake/tribits/core/utils/GetLastDirName.cmake @@ -38,8 +38,8 @@ # @HEADER -FUNCTION( GET_LAST_DIR_NAME INPUT_DIR OUTPUT_DIR_VAR ) - FILE(TO_CMAKE_PATH "${INPUT_DIR}" STANDARD_INPUT_DIR) - STRING(REGEX REPLACE "/.+/(.+)" "\\1" LOCAL_OUTPUT_DIR "${STANDARD_INPUT_DIR}") - SET(${OUTPUT_DIR_VAR} "${LOCAL_OUTPUT_DIR}" PARENT_SCOPE) -ENDFUNCTION() +function( get_last_dir_name INPUT_DIR OUTPUT_DIR_VAR ) + file(TO_CMAKE_PATH "${INPUT_DIR}" STANDARD_INPUT_DIR) + string(REGEX REPLACE "/.+/(.+)" "\\1" LOCAL_OUTPUT_DIR "${STANDARD_INPUT_DIR}") + set(${OUTPUT_DIR_VAR} "${LOCAL_OUTPUT_DIR}" PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/utils/GlobalNullSet.cmake b/cmake/tribits/core/utils/GlobalNullSet.cmake index 7e0670ee6a58..728d06f06c4e 100644 --- a/cmake/tribits/core/utils/GlobalNullSet.cmake +++ b/cmake/tribits/core/utils/GlobalNullSet.cmake @@ -38,21 +38,21 @@ # @HEADER # -# @MACRO: GLOBAL_NULL_SET() +# @MACRO: global_null_set() # # Set a variable as a null internal global (cache) variable (removes # boiler-plate code). # # Usage:: # -# GLOBAL_NULL_SET() +# global_null_set() # # This just calls:: # -# SET( "" CACHE INTERNAL "") +# set( "" CACHE INTERNAL "") # # This avoid problems with misspelling ``CACHE``. # -MACRO(GLOBAL_NULL_SET VARNAME) - SET(${VARNAME} "" CACHE INTERNAL "") -ENDMACRO() +macro(global_null_set VARNAME) + set(${VARNAME} "" CACHE INTERNAL "") +endmacro() diff --git a/cmake/tribits/core/utils/GlobalSet.cmake b/cmake/tribits/core/utils/GlobalSet.cmake index e65a569f867b..7eb1ba20a421 100644 --- a/cmake/tribits/core/utils/GlobalSet.cmake +++ b/cmake/tribits/core/utils/GlobalSet.cmake @@ -39,21 +39,21 @@ # -# @MACRO: GLOBAL_SET() +# @MACRO: global_set() # # Set a variable as an internal global (cache) variable (removes boiler-plate # code). # # Usage:: # -# GLOBAL_SET( [other args]) +# global_set( [other args]) # # This just calls:: # -# SET( [other args] CACHE INTERNAL "") +# set( [other args] CACHE INTERNAL "") # # This avoid misspelling ``CACHE``. # -MACRO(GLOBAL_SET VARNAME) - SET(${VARNAME} ${ARGN} CACHE INTERNAL "") -ENDMACRO() +macro(global_set VARNAME) + set(${VARNAME} ${ARGN} CACHE INTERNAL "") +endmacro() diff --git a/cmake/tribits/core/utils/Join.cmake b/cmake/tribits/core/utils/Join.cmake index f560da5af1ca..0f9fe323bce1 100644 --- a/cmake/tribits/core/utils/Join.cmake +++ b/cmake/tribits/core/utils/Join.cmake @@ -39,13 +39,13 @@ # -# @FUNCTION: JOIN() +# @FUNCTION: join() # # Join a set of strings into a single string using a join string. # # Usage:: # -# JOIN( "" +# join( "" # "" "" ...) # # Arguments: @@ -78,23 +78,23 @@ # For example, the latter can be used to set up a set of command-line # arguments given a CMake array like:: # -# JOIN(CMND_LINE_ARGS " " TRUE ${CMND_LINE_ARRAY}) +# join(CMND_LINE_ARGS " " TRUE ${CMND_LINE_ARRAY}) # # WARNING: Be careful to quote string arguments that have spaces because CMake # interprets those as array boundaries. # -FUNCTION(JOIN OUTPUT_STRING_VAR SEP_STR QUOTE_ELEMENTS) - SET(QUOTE_CHAR) - IF (QUOTE_ELEMENTS) - SET(QUOTE_CHAR "\"") - ENDIF() - SET(OUTPUT_STRING "") - FOREACH(STRING_VAL ${ARGN}) - IF (OUTPUT_STRING STREQUAL "") - SET(OUTPUT_STRING "${QUOTE_CHAR}${STRING_VAL}${QUOTE_CHAR}") - ELSE() - SET(OUTPUT_STRING "${OUTPUT_STRING}${SEP_STR}${QUOTE_CHAR}${STRING_VAL}${QUOTE_CHAR}") - ENDIF() - ENDFOREACH() - SET(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE) -ENDFUNCTION() +function(join OUTPUT_STRING_VAR SEP_STR QUOTE_ELEMENTS) + set(QUOTE_CHAR) + if (QUOTE_ELEMENTS) + set(QUOTE_CHAR "\"") + endif() + set(OUTPUT_STRING "") + foreach(STRING_VAL ${ARGN}) + if (OUTPUT_STRING STREQUAL "") + set(OUTPUT_STRING "${QUOTE_CHAR}${STRING_VAL}${QUOTE_CHAR}") + else() + set(OUTPUT_STRING "${OUTPUT_STRING}${SEP_STR}${QUOTE_CHAR}${STRING_VAL}${QUOTE_CHAR}") + endif() + endforeach() + set(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/utils/MessageWrapper.cmake b/cmake/tribits/core/utils/MessageWrapper.cmake index 589f0b24da2c..59b17d13a15c 100644 --- a/cmake/tribits/core/utils/MessageWrapper.cmake +++ b/cmake/tribits/core/utils/MessageWrapper.cmake @@ -37,31 +37,31 @@ # ************************************************************************ # @HEADER -IF (MESSAGE_WRAPPER_INCLUDED) - RETURN() -ENDIF() -SET(MESSAGE_WRAPPER_INCLUDED TRUE) +if (MESSAGE_WRAPPER_INCLUDED) + return() +endif() +set(MESSAGE_WRAPPER_INCLUDED TRUE) -INCLUDE(GlobalSet) +include(GlobalSet) # -# @FUNCTION: MESSAGE_WRAPPER() +# @FUNCTION: message_wrapper() # -# Function that wraps the standard CMake/CTest ``MESSAGE()`` function call in +# Function that wraps the standard CMake/CTest ``message()`` function call in # order to allow unit testing to intercept the output. # # Usage:: # -# MESSAGE_WRAPPER(...) +# message_wrapper(...) # -# This function takes exactly the same arguments as built-in ``MESSAGE()`` +# This function takes exactly the same arguments as built-in ``message()`` # function. However, when the variable ``MESSAGE_WRAPPER_UNIT_TEST_MODE`` is -# set to ``TRUE``, then this function will not call ``MESSAGE(...)`` but +# set to ``TRUE``, then this function will not call ``message(...)`` but # instead will prepend set to the global variable ``MESSAGE_WRAPPER_INPUT`` -# the input argument that would have gone to ``MESSAGE()``. To capture just +# the input argument that would have gone to ``message()``. To capture just # this call's input, first call:: # -# GLOBAL_NULL_SET(MESSAGE_WRAPPER_INPUT) +# global_null_set(MESSAGE_WRAPPER_INPUT) # # before calling this function (or the functions/macros that call this # function). @@ -71,12 +71,12 @@ INCLUDE(GlobalSet) # the CMake program. Otherwise, this is used to capture print messages to # verify that they say the right thing. # -FUNCTION(MESSAGE_WRAPPER) - #MESSAGE("MESSAGE_WRAPPER: ${ARGN}") - IF (MESSAGE_WRAPPER_UNIT_TEST_MODE) - GLOBAL_SET(MESSAGE_WRAPPER_INPUT "${MESSAGE_WRAPPER_INPUT}" ${ARGN}) - ELSE() - MESSAGE(${ARGN}) - ENDIF() -ENDFUNCTION() +function(message_wrapper) + #message("MESSAGE_WRAPPER: ${ARGN}") + if (MESSAGE_WRAPPER_UNIT_TEST_MODE) + global_set(MESSAGE_WRAPPER_INPUT "${MESSAGE_WRAPPER_INPUT}" ${ARGN}) + else() + message(${ARGN}) + endif() +endfunction() diff --git a/cmake/tribits/core/utils/MultilineSet.cmake b/cmake/tribits/core/utils/MultilineSet.cmake index 2e4976885dca..923d65c5d217 100644 --- a/cmake/tribits/core/utils/MultilineSet.cmake +++ b/cmake/tribits/core/utils/MultilineSet.cmake @@ -39,13 +39,13 @@ # -# @FUNCTION: MULTILINE_SET() +# @FUNCTION: multiline_set() # # Function to set a single string by concatenating a list of separate strings # # Usage:: # -# MULTILINE_SET( +# multiline_set( # "" # "" # ... @@ -58,17 +58,17 @@ # The purpose of this is function to make it easier to set longer strings over # multiple lines. # -# This function is exactly the same as `CONCAT_STRINGS()`_ and should not even +# This function is exactly the same as `concat_strings()`_ and should not even # exist :-( # -FUNCTION(MULTILINE_SET VARAIBLE_NAME) +function(multiline_set VARAIBLE_NAME) - SET(MULTILINE_SET_LOCAL_STR "") + set(MULTILINE_SET_LOCAL_STR "") - FOREACH(LINE_STR ${ARGN}) - SET(MULTILINE_SET_LOCAL_STR "${MULTILINE_SET_LOCAL_STR}${LINE_STR}") - ENDFOREACH() + foreach(LINE_STR ${ARGN}) + set(MULTILINE_SET_LOCAL_STR "${MULTILINE_SET_LOCAL_STR}${LINE_STR}") + endforeach() - SET(${VARAIBLE_NAME} "${MULTILINE_SET_LOCAL_STR}" PARENT_SCOPE) + set(${VARAIBLE_NAME} "${MULTILINE_SET_LOCAL_STR}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/utils/ParseVariableArguments.cmake b/cmake/tribits/core/utils/ParseVariableArguments.cmake index 07bc84f61071..a3c278a7b8c0 100644 --- a/cmake/tribits/core/utils/ParseVariableArguments.cmake +++ b/cmake/tribits/core/utils/ParseVariableArguments.cmake @@ -37,28 +37,28 @@ # ************************************************************************ # @HEADER -# Set up to use CMAKE_PARSE_ARGUMENTS() function! -INCLUDE(CMakeParseArguments) +# Set up to use cmake_parse_arguments() function! +include(CMakeParseArguments) # NOTE: For CMake versions 3.5.0 and above, this module is empty so the -# natively implemented function CMAKE_PARSE_ARGUMENTS() will get used! +# natively implemented function cmake_parse_arguments() will get used! -MACRO(PARSE_ARGUMENTS_DEPRECATED_WARNING) - MESSAGE(WARNING "PARSE_ARGUMENTS() is deprecated and should not be used." - " Instead use CMAKE_PARSE_ARGUMENTS()") -ENDMACRO() +macro(parse_arguments_deprecated_warning) + message(WARNING "parse_arguments() is deprecated and should not be used." + " Instead use cmake_parse_arguments()") +endmacro() -PARSE_ARGUMENTS_DEPRECATED_WARNING() +parse_arguments_deprecated_warning() # Set PARSE_ARGUMENTS_DUMP_OUTPUT_ENABLED to TRUE to see output from parsing. -FUNCTION(PARSE_ARGUMENTS_DUMP_OUTPUT OUTPUT_STR) - IF (PARSE_ARGUMENTS_DUMP_OUTPUT_ENABLED) - MESSAGE("${OUTPUT_STR}") - ENDIF() -ENDFUNCTION() +function(parse_arguments_dump_output OUTPUT_STR) + if (PARSE_ARGUMENTS_DUMP_OUTPUT_ENABLED) + message("${OUTPUT_STR}") + endif() +endfunction() # -# @MACRO: PARSE_ARGUMENTS() +# @MACRO: parse_arguments() # # Parse a set of macro/function input arguments into different lists. This # allows the easy implementation of keyword-based user-defined macros and @@ -66,7 +66,7 @@ ENDFUNCTION() # # Usage:: # -# PARSE_ARGUMENTS( +# parse_arguments( # # # ) @@ -105,11 +105,11 @@ ENDFUNCTION() # functions like is used by some built-in CMake commands. # # For example, consider the following user-defined macro that uses both -# positional and keyword-based arguments using ``PARSE_ARGUMENTS()``:: +# positional and keyword-based arguments using ``parse_arguments()``:: # -# MACRO(PARSE_SPECIAL_VARS BASE_NAME) +# macro(parse_special_vars BASE_NAME) # -# PARSE_ARGUMENTS( +# parse_arguments( # #prefix # ${BASE_NAME} # #lists @@ -119,11 +119,11 @@ ENDFUNCTION() # ${ARGN} # ) # -# ENDMACRO() +# endmacro() # # Calling this macro as:: # -# PARSE_SPECIAL_VARS(MyVar ARG0 a b ARG2 c OPT1) +# parse_special_vars(MyVar ARG0 a b ARG2 c OPT1) # # sets the following variables in the current scope:: # @@ -145,7 +145,7 @@ ENDFUNCTION() # arguments are put into ``_DEFAULT_ARGS``. For example, if one # passes in:: # -# PARSE_SPECIAL_VARS(MyVar ARG5 a b c) +# parse_special_vars(MyVar ARG5 a b c) # # you will get:: # @@ -159,7 +159,7 @@ ENDFUNCTION() # Multiple occurrences of keyword arguments in ```` is allowed # but only the last one listed will be recorded. For example, if one calls:: # -# PARSE_SPECIAL_VARS(MyVar ARG1 a b ARG1 c) +# parse_special_vars(MyVar ARG1 a b ARG1 c) # # then this will set:: # @@ -176,7 +176,7 @@ ENDFUNCTION() # If one puts an option keyword in the middle of a keyword argument list, the # option keyword will get pulled out of the list. For example, if one calls:: # -# PARSE_SPECIAL_VARS(MyVar ARG0 a OPT0 c) +# parse_special_vars(MyVar ARG0 a OPT0 c) # # then this will set:: # @@ -195,65 +195,65 @@ ENDFUNCTION() # # **PERFORMANCE:** This function will scale as:: # -# O( (len() * len()) * len() ) +# o( (len() * len()) * len() ) # # Therefore, this could scale very badly for large sets of argument and option # names and input argument list names. # -MACRO(PARSE_ARGUMENTS prefix arg_names option_names) +macro(parse_arguments prefix arg_names option_names) - PARSE_ARGUMENTS_DEPRECATED_WARNING() + parse_arguments_deprecated_warning() - PARSE_ARGUMENTS_DUMP_OUTPUT("PARSE_ARGUMENTS: prefix='${prefix}'") - PARSE_ARGUMENTS_DUMP_OUTPUT("PARSE_ARGUMENTS: arg_names='${arg_names}'") - PARSE_ARGUMENTS_DUMP_OUTPUT("PARSE_ARGUMENTS: option_names='${option_names}'") - PARSE_ARGUMENTS_DUMP_OUTPUT("PARSE_ARGUMENTS: ARGN='${ARGN}'") + parse_arguments_dump_output("PARSE_ARGUMENTS: prefix='${prefix}'") + parse_arguments_dump_output("PARSE_ARGUMENTS: arg_names='${arg_names}'") + parse_arguments_dump_output("PARSE_ARGUMENTS: option_names='${option_names}'") + parse_arguments_dump_output("PARSE_ARGUMENTS: ARGN='${ARGN}'") - FOREACH(arg_name ${arg_names}) - SET(${prefix}_${arg_name}) - ENDFOREACH() + foreach(arg_name ${arg_names}) + set(${prefix}_${arg_name}) + endforeach() - FOREACH(option ${option_names}) - SET(${prefix}_${option} FALSE) - ENDFOREACH() + foreach(option ${option_names}) + set(${prefix}_${option} FALSE) + endforeach() - SET(DEFAULT_ARGS) - SET(current_arg_name DEFAULT_ARGS) - SET(current_arg_list) + set(DEFAULT_ARGS) + set(current_arg_name DEFAULT_ARGS) + set(current_arg_list) - FOREACH(arg ${ARGN}) - SET(larg_names ${arg_names}) - LIST(FIND larg_names "${arg}" is_arg_name) - IF (is_arg_name GREATER -1) - SET(${prefix}_${current_arg_name} "${current_arg_list}") - PARSE_ARGUMENTS_DUMP_OUTPUT("PARSE_ARGUMENTS: ${prefix}_${current_arg_name} = '${${prefix}_${current_arg_name}}'" ) - SET(current_arg_name "${arg}") - SET(current_arg_list) - ELSE() - SET(loption_names "${option_names}") - LIST(FIND loption_names "${arg}" is_option) - IF (is_option GREATER -1) - SET(${prefix}_${arg} TRUE) - PARSE_ARGUMENTS_DUMP_OUTPUT( "PARSE_ARGUMENTS: ${prefix}_${arg} = '${${prefix}_${arg}}'" ) - ELSE() - LIST(APPEND current_arg_list "${arg}") - ENDIF() - ENDIF() - ENDFOREACH() + foreach(arg ${ARGN}) + set(larg_names ${arg_names}) + list(FIND larg_names "${arg}" is_arg_name) + if (is_arg_name GREATER -1) + set(${prefix}_${current_arg_name} "${current_arg_list}") + parse_arguments_dump_output("PARSE_ARGUMENTS: ${prefix}_${current_arg_name} = '${${prefix}_${current_arg_name}}'" ) + set(current_arg_name "${arg}") + set(current_arg_list) + else() + set(loption_names "${option_names}") + list(FIND loption_names "${arg}" is_option) + if (is_option GREATER -1) + set(${prefix}_${arg} TRUE) + parse_arguments_dump_output( "PARSE_ARGUMENTS: ${prefix}_${arg} = '${${prefix}_${arg}}'" ) + else() + list(APPEND current_arg_list "${arg}") + endif() + endif() + endforeach() - SET(${prefix}_${current_arg_name} "${current_arg_list}") - PARSE_ARGUMENTS_DUMP_OUTPUT( "PARSE_ARGUMENTS: ${prefix}_${current_arg_name} = '${${prefix}_${current_arg_name}}'" ) + set(${prefix}_${current_arg_name} "${current_arg_list}") + parse_arguments_dump_output( "PARSE_ARGUMENTS: ${prefix}_${current_arg_name} = '${${prefix}_${current_arg_name}}'" ) -ENDMACRO() +endmacro() # NOTE: If the above function turns out to be a performance bottle neck, there # are a few things that could be done to improve performance. One thing you -# could do is repalce the O(len(arg_names)) and O(len(option_names)) lookups -# with O(1) lookups by creating CMake variables of the name -# ${OUTER_FUNC_NAME}_arg_ and then just look of that varible exists +# could do is repalce the o(len(arg_names)) and o(len(option_names)) lookups +# with o(1) lookups by creating CMake variables of the name +# ${OUTER_FUNC_NAME}_arg_ and then just look of that variable exists # or not. That should use a hash function. That might actually slow things # down for short lists however so we would have to measure, measure, # measure. I would have to pass in the function/macro name to disabiguate -# the varible names. It would really be better if cmake would provide a +# the variable names. It would really be better if cmake would provide a # sorted list find operation. That would make this much faster for large # numbers of argument and option names. diff --git a/cmake/tribits/core/utils/PrependCmndlineArgs.cmake b/cmake/tribits/core/utils/PrependCmndlineArgs.cmake index aa48b3932474..29ee4c4b9110 100644 --- a/cmake/tribits/core/utils/PrependCmndlineArgs.cmake +++ b/cmake/tribits/core/utils/PrependCmndlineArgs.cmake @@ -38,24 +38,24 @@ # @HEADER # -# @FUNCTION: PREPEND_CMNDLINE_ARGS() +# @FUNCTION: prepend_cmndline_args() # # Utility function that prepends command-line arguments to a variable of # command-line arguments. # # Usage:: # -# PREPEND_CMNDLINE_ARGS( "") +# prepend_cmndline_args( "") # # This function just prepends the command-line arguments in the string # ``""`` but does not add an extra space if ```` is empty on # input. # -FUNCTION(PREPEND_CMNDLINE_ARGS CMNDLINE_VAR_NAME EXTRAARGS) - IF (${CMNDLINE_VAR_NAME}) - SET(${CMNDLINE_VAR_NAME} "${EXTRAARGS} ${${CMNDLINE_VAR_NAME}}" PARENT_SCOPE) - ELSE() - SET(${CMNDLINE_VAR_NAME} "${EXTRAARGS}" PARENT_SCOPE) - ENDIF() - #PRINT_VAR(${CMNDLINE_VAR_NAME}) -ENDFUNCTION() +function(prepend_cmndline_args CMNDLINE_VAR_NAME EXTRAARGS) + if (${CMNDLINE_VAR_NAME}) + set(${CMNDLINE_VAR_NAME} "${EXTRAARGS} ${${CMNDLINE_VAR_NAME}}" PARENT_SCOPE) + else() + set(${CMNDLINE_VAR_NAME} "${EXTRAARGS}" PARENT_SCOPE) + endif() + #print_var(${CMNDLINE_VAR_NAME}) +endfunction() diff --git a/cmake/tribits/core/utils/PrependGlobalSet.cmake b/cmake/tribits/core/utils/PrependGlobalSet.cmake index 3aa16848421d..edd27338675c 100644 --- a/cmake/tribits/core/utils/PrependGlobalSet.cmake +++ b/cmake/tribits/core/utils/PrependGlobalSet.cmake @@ -37,23 +37,23 @@ # ************************************************************************ # @HEADER -INCLUDE(GlobalSet) -INCLUDE(AssertDefined) +include(GlobalSet) +include(AssertDefined) # -# @MACRO: PREPEND_GLOBAL_SET() +# @MACRO: prepend_global_set() # # Utility macro that prepends arguments to a global variable (reduces # boiler-plate code and mistakes). # # Usage:: # -# PREPEND_GLOBAL_SET( ...) +# prepend_global_set( ...) # # The variable ```` must exist before calling this function. To set -# it empty initially use `GLOBAL_NULL_SET()`_. +# it empty initially use `global_null_set()`_. # -MACRO(PREPEND_GLOBAL_SET VARNAME) - ASSERT_DEFINED(${VARNAME}) - GLOBAL_SET(${VARNAME} ${ARGN} ${${VARNAME}}) -ENDMACRO() +macro(prepend_global_set VARNAME) + assert_defined(${VARNAME}) + global_set(${VARNAME} ${ARGN} ${${VARNAME}}) +endmacro() diff --git a/cmake/tribits/core/utils/PrependSet.cmake b/cmake/tribits/core/utils/PrependSet.cmake index ebfe9ecd90ee..3b20d40d1411 100644 --- a/cmake/tribits/core/utils/PrependSet.cmake +++ b/cmake/tribits/core/utils/PrependSet.cmake @@ -38,21 +38,21 @@ # @HEADER # -# @MACRO: PREPEND_SET() +# @MACRO: prepend_set() # # Utility macro to prepend elements to a variable (reduces boiler-plate code). # # Usage:: # -# PREPEND_SET( ...) +# prepend_set( ...) # # Just calls:: # -# SET( ... ${}) +# set( ... ${}) # -# NOTE: Prepending is not as efficient as appending so prefer `APPEND_SET()`_ -# or just ``LIST(APPEND ...)``. +# NOTE: Prepending is not as efficient as appending so prefer `append_set()`_ +# or just ``list(APPEND ...)``. # -MACRO(PREPEND_SET VARNAME) - SET(${VARNAME} ${ARGN} ${${VARNAME}}) -ENDMACRO() +macro(prepend_set VARNAME) + set(${VARNAME} ${ARGN} ${${VARNAME}}) +endmacro() diff --git a/cmake/tribits/core/utils/PrintNonemptyVar.cmake b/cmake/tribits/core/utils/PrintNonemptyVar.cmake index 226a4d0dd902..7c2b17ee4f15 100644 --- a/cmake/tribits/core/utils/PrintNonemptyVar.cmake +++ b/cmake/tribits/core/utils/PrintNonemptyVar.cmake @@ -37,24 +37,24 @@ # ************************************************************************ # @HEADER -INCLUDE(AssertDefined) -INCLUDE(PrintVar) +include(AssertDefined) +include(PrintVar) # -# @FUNCTION: PRINT_NONEMPTY_VAR() +# @FUNCTION: print_nonempty_var() # # Print a defined variable giving its name then value only if it is not empty. # # Usage:: # -# PRINT_NONEMPTY_VAR() +# print_nonempty_var() # -# Calls ``PRINT_VAR()`` if ``${}`` is not empty. +# Calls ``print_var()`` if ``${}`` is not empty. # -FUNCTION(PRINT_NONEMPTY_VAR VARIABLE_NAME) - ASSERT_DEFINED(VARIABLE_NAME) - IF (NOT "${${VARIABLE_NAME}}" STREQUAL "") - PRINT_VAR(${VARIABLE_NAME}) - ENDIF() -ENDFUNCTION() +function(print_nonempty_var VARIABLE_NAME) + assert_defined(VARIABLE_NAME) + if (NOT "${${VARIABLE_NAME}}" STREQUAL "") + print_var(${VARIABLE_NAME}) + endif() +endfunction() diff --git a/cmake/tribits/core/utils/PrintNonemptyVarWithSpaces.cmake b/cmake/tribits/core/utils/PrintNonemptyVarWithSpaces.cmake index c22bb1dad2f2..cfb1c7148e06 100644 --- a/cmake/tribits/core/utils/PrintNonemptyVarWithSpaces.cmake +++ b/cmake/tribits/core/utils/PrintNonemptyVarWithSpaces.cmake @@ -37,32 +37,32 @@ # ************************************************************************ # @HEADER -INCLUDE(AssertDefined) -INCLUDE(AppendStringVarWithSep) +include(AssertDefined) +include(AppendStringVarWithSep) # -# @FUNCTION: PRINT_NONEMPTY_VAR_WITH_SPACES() +# @FUNCTION: print_nonempty_var_with_spaces() # # Print a defined variable giving its name then value printed with spaces # instead of ``';'`` but only if it is not empty. # # Usage:: # -# PRINT_NONEMPTY_VAR_WITH_SPACES( ) +# print_nonempty_var_with_spaces( ) # # Prints the variable as:: # # : ... # -# If ``$`` is ``TRUE`` on input, then the varible is not -# touched. If however, the varible ``$`` is not ``TRUE`` on +# If ``$`` is ``TRUE`` on input, then the variable is not +# touched. If however, the variable ``$`` is not ``TRUE`` on # input, then it is set to ``TRUE`` on output. # -FUNCTION(PRINT_NONEMPTY_VAR_WITH_SPACES VARIBLE_NAME PRINTED_VAR_OUT) - ASSERT_DEFINED(VARIBLE_NAME) - IF (NOT "${${VARIBLE_NAME}}" STREQUAL "") - STRING(REPLACE ";" " " OUTSTR "${${VARIBLE_NAME}}") - MESSAGE("-- ${VARIBLE_NAME}: ${OUTSTR}") - SET(${PRINTED_VAR_OUT} TRUE PARENT_SCOPE) - ENDIF() -ENDFUNCTION() +function(print_nonempty_var_with_spaces VARIBLE_NAME PRINTED_VAR_OUT) + assert_defined(VARIBLE_NAME) + if (NOT "${${VARIBLE_NAME}}" STREQUAL "") + string(REPLACE ";" " " OUTSTR "${${VARIBLE_NAME}}") + message("-- ${VARIBLE_NAME}: ${OUTSTR}") + set(${PRINTED_VAR_OUT} TRUE PARENT_SCOPE) + endif() +endfunction() diff --git a/cmake/tribits/core/utils/PrintVar.cmake b/cmake/tribits/core/utils/PrintVar.cmake index 5dd47c943937..7b60a9b0c9dc 100644 --- a/cmake/tribits/core/utils/PrintVar.cmake +++ b/cmake/tribits/core/utils/PrintVar.cmake @@ -37,38 +37,38 @@ # ************************************************************************ # @HEADER -IF (PRINT_VAR_INCLUDED) - RETURN() -ENDIF() -SET(PRINT_VAR_INCLUDED TRUE) +if (PRINT_VAR_INCLUDED) + return() +endif() +set(PRINT_VAR_INCLUDED TRUE) # -# @FUNCTION: PRINT_VAR() +# @FUNCTION: print_var() # # Unconditionally print a variable giving its name then value. # # Usage:: # -# PRINT_VAR() +# print_var() # # This prints:: # -# MESSAGE("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") +# message("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") # # The variable ```` can be defined or undefined or empty. This uses # an explicit "-- " line prefix so that it prints nice even on Windows CMake. # -FUNCTION(PRINT_VAR VARIBLE_NAME) - IF (MESSAGE_WRAPPER_UNIT_TEST_MODE) - GLOBAL_SET(MESSAGE_WRAPPER_INPUT "${MESSAGE_WRAPPER_INPUT}" +function(print_var VARIBLE_NAME) + if (MESSAGE_WRAPPER_UNIT_TEST_MODE) + global_set(MESSAGE_WRAPPER_INPUT "${MESSAGE_WRAPPER_INPUT}" "-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'" "${PRINT_MSG}") - ELSE() - MESSAGE("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") - ENDIF() -ENDFUNCTION() + else() + message("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") + endif() +endfunction() -# NOTE: Above, I was not able to call MESSAGE_WRAPPER() directly because it +# NOTE: Above, I was not able to call message_wrapper() directly because it # was removing the ';' in array arguments. This broke a bunch of unit tests. # Therefore, I have to duplicate code and call it in two separate places. I # have to admit that CMake behavior surprises me many times. This is not a -# great programming langauge. +# great programming language. diff --git a/cmake/tribits/core/utils/RemoveGlobalDuplicates.cmake b/cmake/tribits/core/utils/RemoveGlobalDuplicates.cmake index e9c0902cb183..69ee668c46e7 100644 --- a/cmake/tribits/core/utils/RemoveGlobalDuplicates.cmake +++ b/cmake/tribits/core/utils/RemoveGlobalDuplicates.cmake @@ -37,32 +37,32 @@ # ************************************************************************ # @HEADER -INCLUDE(AssertDefined) -INCLUDE(GlobalSet) +include(AssertDefined) +include(GlobalSet) # -# @FUNCTION: REMOVE_GLOBAL_DUPLICATES() +# @FUNCTION: remove_global_duplicates() # # Remove duplicate elements from a global list variable (removes boiler-plate # code and errors). # # Usage:: # -# REMOVE_GLOBAL_DUPLICATES() +# remove_global_duplicates() # # This function is necessary in order to preserve the "global" nature of the -# variable. If one just calls ``LIST(REMOVE_DUPLICATES ...)`` it will +# variable. If one just calls ``list(REMOVE_DUPLICATES ...)`` it will # actually create a local variable of the same name and shadow the global # variable! That is a fun bug to track down! The variable # ```` must be defined before this function is called. If # ```` is actually not a global cache variable before this # function is called it will be after it completes. # -FUNCTION(REMOVE_GLOBAL_DUPLICATES VARNAME) - ASSERT_DEFINED(${VARNAME}) - IF (${VARNAME}) - SET(TMP ${${VARNAME}}) - LIST(REMOVE_DUPLICATES TMP) - GLOBAL_SET(${VARNAME} ${TMP}) - ENDIF() -ENDFUNCTION() +function(remove_global_duplicates VARNAME) + assert_defined(${VARNAME}) + if (${VARNAME}) + set(TMP ${${VARNAME}}) + list(REMOVE_DUPLICATES TMP) + global_set(${VARNAME} ${TMP}) + endif() +endfunction() diff --git a/cmake/tribits/core/utils/SetAndIncDirs.cmake b/cmake/tribits/core/utils/SetAndIncDirs.cmake index 147e8814eaee..a305b424debe 100644 --- a/cmake/tribits/core/utils/SetAndIncDirs.cmake +++ b/cmake/tribits/core/utils/SetAndIncDirs.cmake @@ -38,19 +38,19 @@ # @HEADER # -# @MACRO: SET_AND_INC_DIRS() +# @MACRO: set_and_inc_dirs() # -# Set a variable to an include directory and call ``INCLUDE_DIRECTORIES()`` +# Set a variable to an include directory and call ``include_directories()`` # (removes boiler-plate code). # # Usage: # -# SET_AND_INC_DIRS( ) +# set_and_inc_dirs( ) # # On output, this sets ```` to ```` in the local scope -# and calls ``INCLUDE_DIRECTORIES()``. +# and calls ``include_directories()``. # -MACRO(SET_AND_INC_DIRS DIR_VAR_NAME INCLUDE_DIR) - SET(${DIR_VAR_NAME} ${INCLUDE_DIR}) - INCLUDE_DIRECTORIES(${${DIR_VAR_NAME}}) -ENDMACRO() +macro(set_and_inc_dirs DIR_VAR_NAME INCLUDE_DIR) + set(${DIR_VAR_NAME} ${INCLUDE_DIR}) + include_directories(${${DIR_VAR_NAME}}) +endmacro() diff --git a/cmake/tribits/core/utils/SetCacheOnOffEmpty.cmake b/cmake/tribits/core/utils/SetCacheOnOffEmpty.cmake index d250a0056028..caa3b1d3b493 100644 --- a/cmake/tribits/core/utils/SetCacheOnOffEmpty.cmake +++ b/cmake/tribits/core/utils/SetCacheOnOffEmpty.cmake @@ -39,26 +39,26 @@ # -# @FUNCTION: SET_CACHE_ON_OFF_EMPTY() +# @FUNCTION: set_cache_on_off_empty() # # Usage:: # -# SET_CACHE_ON_OFF_EMPTY( "" [FORCE]) +# set_cache_on_off_empty( "" [FORCE]) # # Sets a special string cache variable with possible values "", "ON", or # "OFF". This results in a nice drop-down box in the CMake cache manipulation # GUIs. # -FUNCTION(SET_CACHE_ON_OFF_EMPTY VAR INITIAL_VALUE DOCSTR) - SET(FORCE_ARG) - FOREACH(ARG ${ARGN}) - IF (ARG STREQUAL FORCE) - SET(FORCE_ARG FORCE) - ELSE() - MESSAGE(FATAL_ERROR "SET_CACHE_ON_OFF_EMPTY(...): Error, last arg '${ARG}' is" +function(set_cache_on_off_empty VAR INITIAL_VALUE DOCSTR) + set(FORCE_ARG) + foreach(ARG ${ARGN}) + if (ARG STREQUAL FORCE) + set(FORCE_ARG FORCE) + else() + message(FATAL_ERROR "set_cache_on_off_empty(...): Error, last arg '${ARG}' is" "invalid! Must be 'FORCE' or nothing." ) - ENDIF() - ENDFOREACH() - SET( ${VAR} "${INITIAL_VALUE}" CACHE STRING "${DOCSTR}" ${FORCE_ARG}) - SET_PROPERTY(CACHE ${VAR} PROPERTY STRINGS "" "ON" "OFF") -ENDFUNCTION() + endif() + endforeach() + set( ${VAR} "${INITIAL_VALUE}" CACHE STRING "${DOCSTR}" ${FORCE_ARG}) + set_property(CACHE ${VAR} PROPERTY STRINGS "" "ON" "OFF") +endfunction() diff --git a/cmake/tribits/core/utils/SetDefault.cmake b/cmake/tribits/core/utils/SetDefault.cmake index 525ed910f066..3e2cdae73d28 100644 --- a/cmake/tribits/core/utils/SetDefault.cmake +++ b/cmake/tribits/core/utils/SetDefault.cmake @@ -38,21 +38,21 @@ # @HEADER # -# @MACRO: SET_DEFAULT() +# @MACRO: set_default() # # Give a local variable a default value if a non-empty value is not already # set. # # Usage:: # -# SET_DEFAULT( ...) +# set_default( ...) # # If on input ``"${}"==""``, then ```` is set to the given # default `` ...``. Otherwise, the existing non-empty value is # preserved. # -MACRO(SET_DEFAULT VAR) - IF ("${${VAR}}" STREQUAL "") - SET(${VAR} ${ARGN}) - ENDIF() -ENDMACRO() +macro(set_default VAR) + if ("${${VAR}}" STREQUAL "") + set(${VAR} ${ARGN}) + endif() +endmacro() diff --git a/cmake/tribits/core/utils/SetDefaultAndFromEnv.cmake b/cmake/tribits/core/utils/SetDefaultAndFromEnv.cmake index f48f12f6dd70..7f604c378f04 100644 --- a/cmake/tribits/core/utils/SetDefaultAndFromEnv.cmake +++ b/cmake/tribits/core/utils/SetDefaultAndFromEnv.cmake @@ -39,20 +39,20 @@ -INCLUDE(SetDefault) -INCLUDE(PrintVar) +include(SetDefault) +include(PrintVar) # -# @MACRO: SET_DEFAULT_AND_FROM_ENV() +# @MACRO: set_default_and_from_env() # # Set a default value for a local variable and override from an environment # variable of the same name if it is set. # # Usage:: # -# SET_DEFAULT_AND_FROM_ENV( ) +# set_default_and_from_env( ) # -# First calls ``SET_DEFAULT( )`` and then looks for an +# First calls ``set_default( )`` and then looks for an # environment variable named ````, and if non-empty then overrides # the value of the local variable ````. # @@ -61,16 +61,16 @@ INCLUDE(PrintVar) # option ``-D :=`` to allow variables to be set through the # command-line like ``cmake`` always allowed. # -MACRO(SET_DEFAULT_AND_FROM_ENV VAR DEFAULT_VAL) +macro(set_default_and_from_env VAR DEFAULT_VAL) - SET_DEFAULT(${VAR} "${DEFAULT_VAL}") + set_default(${VAR} "${DEFAULT_VAL}") - SET(ENV_${VAR} $ENV{${VAR}}) - IF (NOT "${ENV_${VAR}}" STREQUAL "") - PRINT_VAR(ENV_${VAR}) - SET(${VAR} ${ENV_${VAR}}) - ENDIF() + set(ENV_${VAR} $ENV{${VAR}}) + if (NOT "${ENV_${VAR}}" STREQUAL "") + print_var(ENV_${VAR}) + set(${VAR} ${ENV_${VAR}}) + endif() - PRINT_VAR(${VAR}) + print_var(${VAR}) -ENDMACRO() +endmacro() diff --git a/cmake/tribits/core/utils/SetNotFound.cmake b/cmake/tribits/core/utils/SetNotFound.cmake index c3d746edcf6c..26aba8b66867 100644 --- a/cmake/tribits/core/utils/SetNotFound.cmake +++ b/cmake/tribits/core/utils/SetNotFound.cmake @@ -37,6 +37,6 @@ # ************************************************************************ # @HEADER -MACRO(SET_NOTFOUND VARNAME) - SET(${VARNAME} ${VARNAME}-NOTFOUND) -ENDMACRO() \ No newline at end of file +macro(set_notfound VARNAME) + set(${VARNAME} ${VARNAME}-NOTFOUND) +endmacro() \ No newline at end of file diff --git a/cmake/tribits/core/utils/Split.cmake b/cmake/tribits/core/utils/Split.cmake index ec699981ec8e..0a5f1ceb2b82 100644 --- a/cmake/tribits/core/utils/Split.cmake +++ b/cmake/tribits/core/utils/Split.cmake @@ -38,15 +38,15 @@ # @HEADER # -# @FUNCTION: SPLIT() +# @FUNCTION: split() # # Split a string variable into a string array/list variable. # # Usage:: # -# SPLIT("" "" ) +# split("" "" ) # -# The ```` string is used with ``STRING(REGEX ...)`` to replace all +# The ```` string is used with ``string(REGEX ...)`` to replace all # occurrences of ```` in ```` with ``";"`` and writing into # ````. # @@ -54,7 +54,7 @@ # that in mind when considering special regex chars like ``'*'``, ``'.'``, # etc! # -FUNCTION(SPLIT INPUT_STRING SEP_STR OUTPUT_STRING_VAR) - STRING(REGEX REPLACE "${SEP_STR}" ";" OUTPUT_STRING "${INPUT_STRING}") - SET(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE) -ENDFUNCTION() +function(split INPUT_STRING SEP_STR OUTPUT_STRING_VAR) + string(REGEX REPLACE "${SEP_STR}" ";" OUTPUT_STRING "${INPUT_STRING}") + set(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/utils/TimingUtils.cmake b/cmake/tribits/core/utils/TimingUtils.cmake index 71f27119f4d3..19d39b53ea85 100644 --- a/cmake/tribits/core/utils/TimingUtils.cmake +++ b/cmake/tribits/core/utils/TimingUtils.cmake @@ -44,121 +44,121 @@ # platforms so call with care. # -INCLUDE(Split) +include(Split) # -# @FUNCTION: TIMER_GET_RAW_SECONDS() +# @FUNCTION: timer_get_raw_seconds() # # Return the raw time in seconds (nano-second accuracy) since epoch, i.e., # since 1970-01-01 00:00:00 UTC. # # Usage:: # -# TIMER_GET_RAW_SECONDS() +# timer_get_raw_seconds() # -# This function is used along with `TIMER_GET_REL_SECONDS()`_, and -# `TIMER_PRINT_REL_TIME()`_ to time big chunks of CMake code for timing and -# profiling purposes. See `TIMER_PRINT_REL_TIME()`_ for more details and an +# This function is used along with `timer_get_rel_seconds()`_, and +# `timer_print_rel_time()`_ to time big chunks of CMake code for timing and +# profiling purposes. See `timer_print_rel_time()`_ for more details and an # example. # -# NOTE: This function runs an external process with ``EXECUTE_PROCESS()`` to +# NOTE: This function runs an external process with ``execute_process()`` to # run the ``date`` command. Therefore, it only works on Unix/Linux and other # systems that have a standard ``date`` command. Since this uses -# ``EXECUTE_PROCESS()``, this function should only be used to time very +# ``execute_process()``, this function should only be used to time very # course-grained operations (i.e. that take longer than a second). If the # `date` command does not exist, then ${} will be empty on # output! # -FUNCTION(TIMER_GET_RAW_SECONDS SECONDS_DEC_OUT) - EXECUTE_PROCESS(COMMAND date "+%s.%N" OUTPUT_STRIP_TRAILING_WHITESPACE +function(timer_get_raw_seconds SECONDS_DEC_OUT) + execute_process(COMMAND date "+%s.%N" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE SECONDS_DEC) - SET(${SECONDS_DEC_OUT} ${SECONDS_DEC} PARENT_SCOPE) -ENDFUNCTION() + set(${SECONDS_DEC_OUT} ${SECONDS_DEC} PARENT_SCOPE) +endfunction() # -# @FUNCTION: TIMER_GET_REL_SECONDS() +# @FUNCTION: timer_get_rel_seconds() # # Return the relative time between start and stop seconds. # # Usage:: # -# TIMER_GET_REL_SECONDS( ) +# timer_get_rel_seconds( ) # # This simple function computes the relative number of seconds between # ```` and ```` (returned from -# `TIMER_GET_RAW_SECONDS()`_) and sets the result in the local variable +# `timer_get_raw_seconds()`_) and sets the result in the local variable # ````. # -FUNCTION(TIMER_GET_REL_SECONDS ABS_SECONDS_DEC_START +function(timer_get_rel_seconds ABS_SECONDS_DEC_START ABS_SECONDS_DEC_END SECONDS_REL_OUT ) - SET(DECIMAL_PLACES 3) - TIMER_GET_TRUNCATED_COMBINED_INT_FROM_DECIMAL_NUM( + set(DECIMAL_PLACES 3) + timer_get_truncated_combined_int_from_decimal_num( ${ABS_SECONDS_DEC_START} ${DECIMAL_PLACES} SECONDS_START_INT) - #PRINT_VAR(SECONDS_START_INT) - TIMER_GET_TRUNCATED_COMBINED_INT_FROM_DECIMAL_NUM( + #print_var(SECONDS_START_INT) + timer_get_truncated_combined_int_from_decimal_num( ${ABS_SECONDS_DEC_END} ${DECIMAL_PLACES} SECONDS_END_INT) - #PRINT_VAR(SECONDS_END_INT) + #print_var(SECONDS_END_INT) - MATH(EXPR SECONDS_REL_INT "${SECONDS_END_INT} - ${SECONDS_START_INT}") + math(EXPR SECONDS_REL_INT "${SECONDS_END_INT} - ${SECONDS_START_INT}") # ToDo: Check that SECONDS_REL_INT is positive and if not, then raise an # error and exit! - TIMER_GET_DECIMAL_NUM_FRUM_TRUNCATED_COMBINED_INT( + timer_get_decimal_num_frum_truncated_combined_int( ${SECONDS_REL_INT} ${DECIMAL_PLACES} SECONDS_REL ) - SET(${SECONDS_REL_OUT} "${SECONDS_REL}" PARENT_SCOPE) + set(${SECONDS_REL_OUT} "${SECONDS_REL}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() # -# @FUNCTION: TIMER_PRINT_REL_TIME() +# @FUNCTION: timer_print_rel_time() # # Print the relative time between start and stop timers in ``ms`` # format. # # Usage:: # -# TIMER_PRINT_REL_TIME( "") +# timer_print_rel_time( "") # # Differences the raw times ```` and ```` -# (i.e. gotten from `TIMER_GET_RAW_SECONDS()`_) and prints the time in +# (i.e. gotten from `timer_get_raw_seconds()`_) and prints the time in # ``ms`` format. # -# This is meant to be used with `TIMER_GET_RAW_SECONDS()`_ to time expensive +# This is meant to be used with `timer_get_raw_seconds()`_ to time expensive # blocks of CMake code like:: # -# TIMER_GET_RAW_SECONDS(REAL_EXPENSIVE_START) +# timer_get_raw_seconds(REAL_EXPENSIVE_START) # -# REAL_EXPENSIVE(...) +# real_expensive(...) # -# TIMER_GET_RAW_SECONDS(REAL_EXPENSIVE_END) +# timer_get_raw_seconds(REAL_EXPENSIVE_END) # -# TIMER_PRINT_REL_TIME(${REAL_EXPENSIVE_START} ${REAL_EXPENSIVE_END} -# "REAL_EXPENSIVE() time") +# timer_print_rel_time(${REAL_EXPENSIVE_START} ${REAL_EXPENSIVE_END} +# "real_expensive() time") # # This will print something like:: # -# REAL_EXPENSIVE() time: 0m5.235s +# real_expensive() time: 0m5.235s # -FUNCTION(TIMER_PRINT_REL_TIME ABS_SECONDS_DEC_START ABS_SECONDS_DEC_END MESSAGE_STR ) +function(timer_print_rel_time ABS_SECONDS_DEC_START ABS_SECONDS_DEC_END MESSAGE_STR ) - TIMER_GET_REL_SECONDS(${ABS_SECONDS_DEC_START} ${ABS_SECONDS_DEC_END} SECONDS_REL) - #PRINT_VAR(SECONDS_REL) + timer_get_rel_seconds(${ABS_SECONDS_DEC_START} ${ABS_SECONDS_DEC_END} SECONDS_REL) + #print_var(SECONDS_REL) - SPLIT(${SECONDS_REL} "[.]" SECONDS_REL_ARRAY) - LIST(GET SECONDS_REL_ARRAY 0 SECONDS_REL_S) - LIST(GET SECONDS_REL_ARRAY 1 SECONDS_REL_NS) + split(${SECONDS_REL} "[.]" SECONDS_REL_ARRAY) + list(GET SECONDS_REL_ARRAY 0 SECONDS_REL_S) + list(GET SECONDS_REL_ARRAY 1 SECONDS_REL_NS) # CMake does not support floating point so I need to do this manually - MATH(EXPR MINUTES_REL "${SECONDS_REL_S}/60") - MATH(EXPR SECONDS_REL_REMAINING "${SECONDS_REL_S} - 60*${MINUTES_REL}") - MESSAGE("${MESSAGE_STR}: ${MINUTES_REL}m${SECONDS_REL_REMAINING}.${SECONDS_REL_NS}s") -ENDFUNCTION() -# ToDo: Unit test the above function by calling MESSAGE_WRAPPER(). + math(EXPR MINUTES_REL "${SECONDS_REL_S}/60") + math(EXPR SECONDS_REL_REMAINING "${SECONDS_REL_S} - 60*${MINUTES_REL}") + message("${MESSAGE_STR}: ${MINUTES_REL}m${SECONDS_REL_REMAINING}.${SECONDS_REL_NS}s") +endfunction() +# ToDo: Unit test the above function by calling message_wrapper(). # @@ -171,69 +171,69 @@ ENDFUNCTION() # decimal form .. This single int form can be subtracted by # CMake (the decimal form can't). # -FUNCTION(TIMER_GET_TRUNCATED_COMBINED_INT_FROM_DECIMAL_NUM +function(timer_get_truncated_combined_int_from_decimal_num ABS_SECONDS_DEC_IN DECIMAL_PLACES SECONDS_NS_INT_OUT ) - #PRINT_VAR(ABS_SECONDS_DEC_IN) + #print_var(ABS_SECONDS_DEC_IN) - SPLIT(${ABS_SECONDS_DEC_IN} "[.]" ABS_SECONDS_DEC_IN_ARRAY) - LIST(GET ABS_SECONDS_DEC_IN_ARRAY 0 ABS_SECONDS_DEC_IN_S) - LIST(GET ABS_SECONDS_DEC_IN_ARRAY 1 ABS_SECONDS_DEC_IN_NS) - #PRINT_VAR(ABS_SECONDS_DEC_IN_S) - #PRINT_VAR(ABS_SECONDS_DEC_IN_NS) + split(${ABS_SECONDS_DEC_IN} "[.]" ABS_SECONDS_DEC_IN_ARRAY) + list(GET ABS_SECONDS_DEC_IN_ARRAY 0 ABS_SECONDS_DEC_IN_S) + list(GET ABS_SECONDS_DEC_IN_ARRAY 1 ABS_SECONDS_DEC_IN_NS) + #print_var(ABS_SECONDS_DEC_IN_S) + #print_var(ABS_SECONDS_DEC_IN_NS) - STRING(SUBSTRING ${ABS_SECONDS_DEC_IN_S} ${DECIMAL_PLACES} -1 SECONDS_S_TRUNCATED) - STRING(SUBSTRING ${ABS_SECONDS_DEC_IN_NS} 0 ${DECIMAL_PLACES} SECONDS_NS_TRUNCATED) - #PRINT_VAR(SECONDS_S_TRUNCATED) - #PRINT_VAR(SECONDS_NS_TRUNCATED) + string(SUBSTRING ${ABS_SECONDS_DEC_IN_S} ${DECIMAL_PLACES} -1 SECONDS_S_TRUNCATED) + string(SUBSTRING ${ABS_SECONDS_DEC_IN_NS} 0 ${DECIMAL_PLACES} SECONDS_NS_TRUNCATED) + #print_var(SECONDS_S_TRUNCATED) + #print_var(SECONDS_NS_TRUNCATED) - SET(${SECONDS_NS_INT_OUT} "${SECONDS_S_TRUNCATED}${SECONDS_NS_TRUNCATED}" + set(${SECONDS_NS_INT_OUT} "${SECONDS_S_TRUNCATED}${SECONDS_NS_TRUNCATED}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() # -# Reform the formated seconds in the form . from the combined +# Reform the formatted seconds in the form . from the combined # int form. # -FUNCTION(TIMER_GET_DECIMAL_NUM_FRUM_TRUNCATED_COMBINED_INT +function(timer_get_decimal_num_frum_truncated_combined_int SECONDS_NS_INT_IN DECIMAL_PLACES SECONDS_DEC_IN_OUT ) - #PRINT_VAR(SECONDS_NS_INT_IN) + #print_var(SECONDS_NS_INT_IN) - STRING(LENGTH ${SECONDS_NS_INT_IN} COMBINED_INT_LEN) - MATH(EXPR SEC_DIGITS "${COMBINED_INT_LEN}-${DECIMAL_PLACES}") - #PRINT_VAR(COMBINED_INT_LEN) - #PRINT_VAR(SEC_DIGITS) + string(LENGTH ${SECONDS_NS_INT_IN} COMBINED_INT_LEN) + math(EXPR SEC_DIGITS "${COMBINED_INT_LEN}-${DECIMAL_PLACES}") + #print_var(COMBINED_INT_LEN) + #print_var(SEC_DIGITS) - IF (SEC_DIGITS GREATER 0) + if (SEC_DIGITS GREATER 0) # There is at least one digit to the right of the decimal place - STRING(SUBSTRING ${SECONDS_NS_INT_IN} 0 ${SEC_DIGITS} SECONDS_S_TRUNCATED) - STRING(SUBSTRING ${SECONDS_NS_INT_IN} ${SEC_DIGITS} -1 SECONDS_NS_TRUNCATED) - ELSE() + string(SUBSTRING ${SECONDS_NS_INT_IN} 0 ${SEC_DIGITS} SECONDS_S_TRUNCATED) + string(SUBSTRING ${SECONDS_NS_INT_IN} ${SEC_DIGITS} -1 SECONDS_NS_TRUNCATED) + else() # There are no digits to the right of th decimal place. Therefore, there # is 0 sec and we need to pad the decimal places with zeros. - SET(SECONDS_S_TRUNCATED 0) - - MATH(EXPR NUM_ZEROS "${DECIMAL_PLACES}-${COMBINED_INT_LEN}") - #PRINT_VAR(NUM_ZEROS) - SET(SECONDS_NS_TRUNCATED ${SECONDS_NS_INT_IN}) - SET(LOOP_IDX 0) - WHILE (LOOP_IDX LESS ${NUM_ZEROS}) - SET(SECONDS_NS_TRUNCATED "0${SECONDS_NS_TRUNCATED}") - MATH(EXPR LOOP_IDX "${LOOP_IDX}+1") - ENDWHILE() - ENDIF() - - #PRINT_VAR(SECONDS_S_TRUNCATED) - #PRINT_VAR(SECONDS_NS_TRUNCATED) - - SET(${SECONDS_DEC_IN_OUT} "${SECONDS_S_TRUNCATED}.${SECONDS_NS_TRUNCATED}" + set(SECONDS_S_TRUNCATED 0) + + math(EXPR NUM_ZEROS "${DECIMAL_PLACES}-${COMBINED_INT_LEN}") + #print_var(NUM_ZEROS) + set(SECONDS_NS_TRUNCATED ${SECONDS_NS_INT_IN}) + set(LOOP_IDX 0) + while (LOOP_IDX LESS ${NUM_ZEROS}) + set(SECONDS_NS_TRUNCATED "0${SECONDS_NS_TRUNCATED}") + math(EXPR LOOP_IDX "${LOOP_IDX}+1") + endwhile() + endif() + + #print_var(SECONDS_S_TRUNCATED) + #print_var(SECONDS_NS_TRUNCATED) + + set(${SECONDS_DEC_IN_OUT} "${SECONDS_S_TRUNCATED}.${SECONDS_NS_TRUNCATED}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() # ToDo: Combine this basic code with code for scaling TIMEOUT into a simple # DecimalMath.cmake module. We need to be able to add, subtract, and multiply diff --git a/cmake/tribits/core/utils/TribitsFilepathHelpers.cmake b/cmake/tribits/core/utils/TribitsFilepathHelpers.cmake index e4040c08029e..a367ff966d9c 100644 --- a/cmake/tribits/core/utils/TribitsFilepathHelpers.cmake +++ b/cmake/tribits/core/utils/TribitsFilepathHelpers.cmake @@ -1,14 +1,14 @@ -INCLUDE(MessageWrapper) -INCLUDE(Split) +include(MessageWrapper) +include(Split) # -# @FUNCTION: TRIBITS_DIR_IS_BASEDIR() +# @FUNCTION: tribits_dir_is_basedir() # # Function to determine if a given path is a base dir of another path. # # Usage:: # -# TRIBITS_DIR_IS_BASEDIR( ) +# tribits_dir_is_basedir( ) # # If the absolute path ```` is a subdir of the absolute path # ````, then the variable ```` is set to @@ -17,80 +17,80 @@ INCLUDE(Split) # For example, the output var ``isBaseDir`` would be set to ``TRUE`` in the # following examples:: # -# TRIBITS_DIR_IS_BASEDIR(/some/base/path /some/base/path/more isBaseDir) +# tribits_dir_is_basedir(/some/base/path /some/base/path/more isBaseDir) # -# TRIBITS_DIR_IS_BASEDIR(/some/base/path /some/base/path isBaseDir) +# tribits_dir_is_basedir(/some/base/path /some/base/path isBaseDir) # # However, in the following examples, ``isBaseDir`` would be set to ``FALSE``:: # -# TRIBITS_DIR_IS_BASEDIR(/some/base/path/more /some/base/path isBaseDir) +# tribits_dir_is_basedir(/some/base/path/more /some/base/path isBaseDir) # -# TRIBITS_DIR_IS_BASEDIR(/some/base/path /some/other/path isBaseDir) +# tribits_dir_is_basedir(/some/base/path /some/other/path isBaseDir) # -FUNCTION(TRIBITS_DIR_IS_BASEDIR absBaseDir absFullDir isBaseDirVarOut) +function(tribits_dir_is_basedir absBaseDir absFullDir isBaseDirVarOut) # Assume not base dir by default unless we find it is - SET(isBaseDir FALSE) + set(isBaseDir FALSE) - STRING(LENGTH "${absBaseDir}" absBaseDirLen) - STRING(LENGTH "${absFullDir}" absFullDirLen) + string(LENGTH "${absBaseDir}" absBaseDirLen) + string(LENGTH "${absFullDir}" absFullDirLen) - IF (absBaseDir STREQUAL absFullDir) - SET(isBaseDir TRUE) - ELSEIF (NOT absBaseDirLen GREATER absFullDirLen) - STRING(FIND "${absFullDir}" "${absBaseDir}/" baseDirIdx) - IF (baseDirIdx EQUAL 0) - SET(isBaseDir TRUE) - ENDIF() - ENDIF() + if (absBaseDir STREQUAL absFullDir) + set(isBaseDir TRUE) + elseif (NOT absBaseDirLen GREATER absFullDirLen) + string(FIND "${absFullDir}" "${absBaseDir}/" baseDirIdx) + if (baseDirIdx EQUAL 0) + set(isBaseDir TRUE) + endif() + endif() - SET(${isBaseDirVarOut} ${isBaseDir} PARENT_SCOPE) + set(${isBaseDirVarOut} ${isBaseDir} PARENT_SCOPE) -ENDFUNCTION() +endfunction() # -# @FUNCTION: TRIBITS_GET_DIR_ARRAY_BELOW_BASE_DIR() +# @FUNCTION: tribits_get_dir_array_below_base_dir() # # Returns the array of directories below a base directory. # # Usage:: # -# TRIBITS_GET_DIR_ARRAY_BELOW_BASE_DIR( +# tribits_get_dir_array_below_base_dir( # ) # # The following show examples of what this returns: # -# TRIBITS_GET_DIR_ARRAY_BELOW_BASE_DIR("/a/b/c" "/a/b/c", dirArray) +# tribits_get_dir_array_below_base_dir("/a/b/c" "/a/b/c", dirArray) # => dirArray = "" # -# TRIBITS_GET_DIR_ARRAY_BELOW_BASE_DIR("/a/b/c" "/a/b/c/d", dirArray) +# tribits_get_dir_array_below_base_dir("/a/b/c" "/a/b/c/d", dirArray) # => dirArray = "d" # -# TRIBITS_GET_DIR_ARRAY_BELOW_BASE_DIR("/a/b/c" "/a/b/c/d/e", dirArray) +# tribits_get_dir_array_below_base_dir("/a/b/c" "/a/b/c/d/e", dirArray) # => dirArray = "d;e" # -FUNCTION(TRIBITS_GET_DIR_ARRAY_BELOW_BASE_DIR absBaseDir absFullDir +function(tribits_get_dir_array_below_base_dir absBaseDir absFullDir trailingDirArrayVarOut ) - TRIBITS_DIR_IS_BASEDIR("${absBaseDir}" "${absFullDir}" isBaseDir) - IF (NOT isBaseDir) - MESSAGE_WRAPPER(FATAL_ERROR + tribits_dir_is_basedir("${absBaseDir}" "${absFullDir}" isBaseDir) + if (NOT isBaseDir) + message_wrapper(FATAL_ERROR "ERROR: '${absBaseDir}' is not a base dir of '${absFullDir}'") - ENDIF() + endif() - STRING(LENGTH "${absBaseDir}" absBaseDirLen) - STRING(LENGTH "${absFullDir}" absFullDirLen) + string(LENGTH "${absBaseDir}" absBaseDirLen) + string(LENGTH "${absFullDir}" absFullDirLen) - IF (absBaseDirLen EQUAL absFullDirLen) - SET(trailingDirArray "") - ELSE() - MATH(EXPR trailingDirsStrStartIdx "${absBaseDirLen}+1") - STRING(SUBSTRING "${absFullDir}" ${trailingDirsStrStartIdx} -1 trailingDirsStr) - SPLIT("${trailingDirsStr}" "/" trailingDirArray) - ENDIF() + if (absBaseDirLen EQUAL absFullDirLen) + set(trailingDirArray "") + else() + math(EXPR trailingDirsStrStartIdx "${absBaseDirLen}+1") + string(SUBSTRING "${absFullDir}" ${trailingDirsStrStartIdx} -1 trailingDirsStr) + split("${trailingDirsStr}" "/" trailingDirArray) + endif() - SET(${trailingDirArrayVarOut} "${trailingDirArray}" PARENT_SCOPE) + set(${trailingDirArrayVarOut} "${trailingDirArray}" PARENT_SCOPE) -ENDFUNCTION() +endfunction() diff --git a/cmake/tribits/core/utils/TribitsGetCategoriesString.cmake b/cmake/tribits/core/utils/TribitsGetCategoriesString.cmake index 8273dbcea67f..dcbaeb95fa40 100644 --- a/cmake/tribits/core/utils/TribitsGetCategoriesString.cmake +++ b/cmake/tribits/core/utils/TribitsGetCategoriesString.cmake @@ -38,11 +38,11 @@ # @HEADER -FUNCTION(TRIBITS_GET_CATEGORIES_STRING CATEGORIES_IN CATEGORIES_STR_OUT) - IF (CATEGORIES_IN) - STRING(REPLACE ";" ", " CATEGORIES_STR "${CATEGORIES_IN}") - ELSE() - SET(CATEGORIES_STR "BASIC") - ENDIF() - SET(${CATEGORIES_STR_OUT} "${CATEGORIES_STR}" PARENT_SCOPE) -ENDFUNCTION() \ No newline at end of file +function(tribits_get_categories_string CATEGORIES_IN CATEGORIES_STR_OUT) + if (CATEGORIES_IN) + string(REPLACE ";" ", " CATEGORIES_STR "${CATEGORIES_IN}") + else() + set(CATEGORIES_STR "BASIC") + endif() + set(${CATEGORIES_STR_OUT} "${CATEGORIES_STR}" PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/cmake/tribits/core/utils/TribitsStandardizePaths.cmake b/cmake/tribits/core/utils/TribitsStandardizePaths.cmake index 11d04bc5222d..0a4f78e56d39 100644 --- a/cmake/tribits/core/utils/TribitsStandardizePaths.cmake +++ b/cmake/tribits/core/utils/TribitsStandardizePaths.cmake @@ -38,25 +38,25 @@ # @HEADER # -# @FUNCTION: TRIBITS_STANDARDIZE_ABS_PATHS() +# @FUNCTION: tribits_standardize_abs_paths() # -# Function uses GET_FILENAME_COMPONENT() to standardize a list of paths to be +# Function uses get_filename_component() to standardize a list of paths to be # absolute paths. # # Usage:: # -# TRIBITS_STANDARDIZE_ABS_PATHS( ...) +# tribits_standardize_abs_paths( ...) # # On output, ```` will be set to the list of paths # -FUNCTION(TRIBITS_STANDARDIZE_ABS_PATHS PATHS_LIST_VAR_OUT) - SET(PATHS_LIST) - FOREACH(PATH_I ${ARGN}) - #PRINT_VAR(PATH_I) - GET_FILENAME_COMPONENT(STD_ABS_PATH_I "${PATH_I}" ABSOLUTE) - #PRINT_VAR(STD_ABS_PATH_I) - LIST(APPEND PATHS_LIST "${STD_ABS_PATH_I}") - ENDFOREACH() - SET(${PATHS_LIST_VAR_OUT} ${PATHS_LIST} PARENT_SCOPE) -ENDFUNCTION() +function(tribits_standardize_abs_paths PATHS_LIST_VAR_OUT) + set(PATHS_LIST) + foreach(PATH_I ${ARGN}) + #print_var(PATH_I) + get_filename_component(STD_ABS_PATH_I "${PATH_I}" ABSOLUTE) + #print_var(STD_ABS_PATH_I) + list(APPEND PATHS_LIST "${STD_ABS_PATH_I}") + endforeach() + set(${PATHS_LIST_VAR_OUT} ${PATHS_LIST} PARENT_SCOPE) +endfunction() diff --git a/cmake/tribits/core/utils/TribitsStripQuotesFromStr.cmake b/cmake/tribits/core/utils/TribitsStripQuotesFromStr.cmake index 4db1afb99188..86abcfc51dfd 100644 --- a/cmake/tribits/core/utils/TribitsStripQuotesFromStr.cmake +++ b/cmake/tribits/core/utils/TribitsStripQuotesFromStr.cmake @@ -1,16 +1,16 @@ # -# @FUNCTION: TRIBITS_STRIP_QUOTES_FROM_STR() +# @FUNCTION: tribits_strip_quotes_from_str() # # Remove one set of quotes from the outside of a string if they exist. # # Usage:: # -# TRIBITS_STRIP_QUOTES_FROM_STR( ) +# tribits_strip_quotes_from_str( ) # # If ```` does not contain a quote char ``'"'`` as the first and last # char, then the original ```` is returned in ````. # -FUNCTION(TRIBITS_STRIP_QUOTES_FROM_STR str_in str_var_out) +function(tribits_strip_quotes_from_str str_in str_var_out) #print_var(str_in) string(LENGTH "${str_in}" str_len) #print_var(str_len) diff --git a/cmake/tribits/core/utils/UnitTestHelpers.cmake b/cmake/tribits/core/utils/UnitTestHelpers.cmake index e2f88f978755..183d3d949f5b 100644 --- a/cmake/tribits/core/utils/UnitTestHelpers.cmake +++ b/cmake/tribits/core/utils/UnitTestHelpers.cmake @@ -37,18 +37,18 @@ # ************************************************************************ # @HEADER -INCLUDE(CMakeParseArguments) -INCLUDE(GlobalSet) +include(CMakeParseArguments) +include(GlobalSet) # -# @FUNCTION: UNITTEST_COMPARE_CONST() +# @FUNCTION: unittest_compare_const() # # Perform a single unit test equality check and update overall test statistics # # Usage:: # -# UNITTEST_COMPARE_CONST( ) +# unittest_compare_const( ) # # If ``${} == ``, then the check passes, otherwise it # fails. This prints the variable name and values and shows the test result. @@ -57,12 +57,12 @@ INCLUDE(GlobalSet) # ``UNITTEST_OVERALL_NUMPASSED``, and ``UNITTEST_OVERALL_PASS`` which are used # by the unit test harness system to assess overall pass/fail. # -FUNCTION(UNITTEST_COMPARE_CONST VAR_NAME CONST_VAL) +function(unittest_compare_const VAR_NAME CONST_VAL) - MATH( EXPR NUMRUN ${UNITTEST_OVERALL_NUMRUN}+1 ) - GLOBAL_SET(UNITTEST_OVERALL_NUMRUN ${NUMRUN}) + math( EXPR NUMRUN ${UNITTEST_OVERALL_NUMRUN}+1 ) + global_set(UNITTEST_OVERALL_NUMRUN ${NUMRUN}) - MESSAGE( + message( "\nCheck:\n" " ${VAR_NAME} =\n" " [${${VAR_NAME}}]\n" @@ -70,27 +70,27 @@ FUNCTION(UNITTEST_COMPARE_CONST VAR_NAME CONST_VAL) " [${CONST_VAL}]" ) - IF ("${${VAR_NAME}}" STREQUAL "${CONST_VAL}") - MESSAGE(" [PASSED]\n") - MATH( EXPR NUMPASSED ${UNITTEST_OVERALL_NUMPASSED}+1 ) - GLOBAL_SET(UNITTEST_OVERALL_NUMPASSED ${NUMPASSED}) - ELSE() - MESSAGE(" [FAILED]\n") - GLOBAL_SET(UNITTEST_OVERALL_PASS FALSE) - MESSAGE(WARNING "Stack trace for failed unit test") - ENDIF() + if ("${${VAR_NAME}}" STREQUAL "${CONST_VAL}") + message(" [PASSED]\n") + math( EXPR NUMPASSED ${UNITTEST_OVERALL_NUMPASSED}+1 ) + global_set(UNITTEST_OVERALL_NUMPASSED ${NUMPASSED}) + else() + message(" [FAILED]\n") + global_set(UNITTEST_OVERALL_PASS FALSE) + message(WARNING "Stack trace for failed unit test") + endif() -ENDFUNCTION() +endfunction() # -# @FUNCTION: UNITTEST_STRING_REGEX() +# @FUNCTION: unittest_string_regex() # # Perform a series regexes of given strings and update overall test statistics. # # Usage:: # -# UNITTEST_STRING_REGEX( +# unittest_string_regex( # # REGEX_STRINGS "" "" ... # ) @@ -102,9 +102,9 @@ ENDFUNCTION() # ``UNITTEST_OVERALL_NUMPASSED``, and ``UNITTEST_OVERALL_PASS`` which are used # by the unit test harness system to assess overall pass/fail. # -FUNCTION(UNITTEST_STRING_REGEX INPUT_STRING) +function(unittest_string_regex INPUT_STRING) - CMAKE_PARSE_ARGUMENTS( + cmake_parse_arguments( #prefix PARSE #options @@ -116,39 +116,39 @@ FUNCTION(UNITTEST_STRING_REGEX INPUT_STRING) ${ARGN} ) - TRIBITS_CHECK_FOR_UNPARSED_ARGUMENTS() + tribits_check_for_unparsed_arguments() - FOREACH(REGEX ${PARSE_REGEX_STRINGS}) + foreach(REGEX ${PARSE_REGEX_STRINGS}) - MATH( EXPR NUMRUN ${UNITTEST_OVERALL_NUMRUN}+1 ) - GLOBAL_SET(UNITTEST_OVERALL_NUMRUN ${NUMRUN}) + math( EXPR NUMRUN ${UNITTEST_OVERALL_NUMRUN}+1 ) + global_set(UNITTEST_OVERALL_NUMRUN ${NUMRUN}) - STRING(REGEX MATCH "${REGEX}" REGEX_MATCH_RESULT "${INPUT_STRING}") + string(REGEX MATCH "${REGEX}" REGEX_MATCH_RESULT "${INPUT_STRING}") - IF (REGEX_MATCH_RESULT) - MESSAGE(" Searching for REGEX {${REGEX}}: [PASSED]\n") - MATH( EXPR NUMPASSED ${UNITTEST_OVERALL_NUMPASSED}+1 ) - GLOBAL_SET(UNITTEST_OVERALL_NUMPASSED ${NUMPASSED}) - ELSE() - MESSAGE(" Searching for REGEX {${REGEX}}: [FAILED]\n") - GLOBAL_SET(UNITTEST_OVERALL_PASS FALSE) - MESSAGE(WARNING "Stack trace for failed unit test") - ENDIF() + if (REGEX_MATCH_RESULT) + message(" Searching for REGEX {${REGEX}}: [PASSED]\n") + math( EXPR NUMPASSED ${UNITTEST_OVERALL_NUMPASSED}+1 ) + global_set(UNITTEST_OVERALL_NUMPASSED ${NUMPASSED}) + else() + message(" Searching for REGEX {${REGEX}}: [FAILED]\n") + global_set(UNITTEST_OVERALL_PASS FALSE) + message(WARNING "Stack trace for failed unit test") + endif() - ENDFOREACH() + endforeach() -ENDFUNCTION() +endfunction() # -# @FUNCTION: UNITTEST_HAS_SUBSTR_CONST() +# @FUNCTION: unittest_has_substr_const() # # Check that a given string var contains the given substring and update # overall test statistics # # Usage:: # -# UNITTEST_HAS_SUBSTR_CONST( ) +# unittest_has_substr_const( ) # # If ``${}`` contains the substring ````, then the check # passes, otherwise it fails. This prints the variable name and values and @@ -158,12 +158,12 @@ ENDFUNCTION() # ``UNITTEST_OVERALL_NUMPASSED``, and ``UNITTEST_OVERALL_PASS`` which are used # by the unit test harness system to assess overall pass/fail. # -FUNCTION(UNITTEST_HAS_SUBSTR_CONST VAR_NAME SUBSTR_VAL) +function(unittest_has_substr_const VAR_NAME SUBSTR_VAL) - MATH( EXPR NUMRUN ${UNITTEST_OVERALL_NUMRUN}+1 ) - GLOBAL_SET(UNITTEST_OVERALL_NUMRUN ${NUMRUN}) + math( EXPR NUMRUN ${UNITTEST_OVERALL_NUMRUN}+1 ) + global_set(UNITTEST_OVERALL_NUMRUN ${NUMRUN}) - MESSAGE( + message( "\nCheck:\n" " ${VAR_NAME} =\n" " [${${VAR_NAME}}]\n" @@ -171,31 +171,31 @@ FUNCTION(UNITTEST_HAS_SUBSTR_CONST VAR_NAME SUBSTR_VAL) " [${SUBSTR_VAL}]" ) - STRING(FIND "${${VAR_NAME}}" "${SUBSTR_VAL}" SUBSTR_START_IDX) - #PRINT_VAR(SUBSTR_START_IDX) + string(FIND "${${VAR_NAME}}" "${SUBSTR_VAL}" SUBSTR_START_IDX) + #print_var(SUBSTR_START_IDX) - IF (${SUBSTR_START_IDX} GREATER -1) - MESSAGE(" [PASSED]\n") - MATH( EXPR NUMPASSED ${UNITTEST_OVERALL_NUMPASSED}+1 ) - GLOBAL_SET(UNITTEST_OVERALL_NUMPASSED ${NUMPASSED}) - ELSE() - MESSAGE(" [FAILED]\n") - GLOBAL_SET(UNITTEST_OVERALL_PASS FALSE) - MESSAGE(WARNING "Stack trace for failed unit test") - ENDIF() + if (${SUBSTR_START_IDX} GREATER -1) + message(" [PASSED]\n") + math( EXPR NUMPASSED ${UNITTEST_OVERALL_NUMPASSED}+1 ) + global_set(UNITTEST_OVERALL_NUMPASSED ${NUMPASSED}) + else() + message(" [FAILED]\n") + global_set(UNITTEST_OVERALL_PASS FALSE) + message(WARNING "Stack trace for failed unit test") + endif() -ENDFUNCTION() +endfunction() # -# @FUNCTION: UNITTEST_NOT_HAS_SUBSTR_CONST() +# @FUNCTION: unittest_not_has_substr_const() # # Check that a given string var does **NOT** contains the given substring and # update overall test statistics # # Usage:: # -# UNITTEST_NOT_HAS_SUBSTR_CONST( ) +# unittest_not_has_substr_const( ) # # If ``${}`` contains the substring ````, then the check # failed, otherwise it passes. This prints the variable name and values and @@ -205,12 +205,12 @@ ENDFUNCTION() # ``UNITTEST_OVERALL_NUMPASSED``, and ``UNITTEST_OVERALL_PASS`` which are used # by the unit test harness system to assess overall pass/fail. # -FUNCTION(UNITTEST_NOT_HAS_SUBSTR_CONST VAR_NAME SUBSTR_VAL) +function(unittest_not_has_substr_const VAR_NAME SUBSTR_VAL) - MATH( EXPR NUMRUN ${UNITTEST_OVERALL_NUMRUN}+1 ) - GLOBAL_SET(UNITTEST_OVERALL_NUMRUN ${NUMRUN}) + math( EXPR NUMRUN ${UNITTEST_OVERALL_NUMRUN}+1 ) + global_set(UNITTEST_OVERALL_NUMRUN ${NUMRUN}) - MESSAGE( + message( "\nCheck:\n" " ${VAR_NAME} =\n" " [${${VAR_NAME}}]\n" @@ -218,52 +218,52 @@ FUNCTION(UNITTEST_NOT_HAS_SUBSTR_CONST VAR_NAME SUBSTR_VAL) " [${SUBSTR_VAL}]" ) - STRING(FIND "${${VAR_NAME}}" "${SUBSTR_VAL}" SUBSTR_START_IDX) - #PRINT_VAR(SUBSTR_START_IDX) + string(FIND "${${VAR_NAME}}" "${SUBSTR_VAL}" SUBSTR_START_IDX) + #print_var(SUBSTR_START_IDX) - IF (${SUBSTR_START_IDX} GREATER -1) - MESSAGE(" [FAILED]\n") - GLOBAL_SET(UNITTEST_OVERALL_PASS FALSE) - MESSAGE(WARNING "Stack trace for failed unit test") - ELSE() - MESSAGE(" [PASSED]\n") - MATH( EXPR NUMPASSED ${UNITTEST_OVERALL_NUMPASSED}+1 ) - GLOBAL_SET(UNITTEST_OVERALL_NUMPASSED ${NUMPASSED}) - ENDIF() + if (${SUBSTR_START_IDX} GREATER -1) + message(" [FAILED]\n") + global_set(UNITTEST_OVERALL_PASS FALSE) + message(WARNING "Stack trace for failed unit test") + else() + message(" [PASSED]\n") + math( EXPR NUMPASSED ${UNITTEST_OVERALL_NUMPASSED}+1 ) + global_set(UNITTEST_OVERALL_NUMPASSED ${NUMPASSED}) + endif() -ENDFUNCTION() +endfunction() # -# @FUNCTION: UNITTEST_FILE_REGEX() +# @FUNCTION: unittest_file_regex() # # Perform a series regexes of given strings and update overall test statistics. # # Usage:: # -# UNITTEST_FILE_REGEX( +# unittest_file_regex( # # REGEX_STRINGS "" "" ... # ) # # The contents of ```` are read into a string and then passed -# to `UNITTEST_STRING_REGEX()`_ to assess pass/fail. +# to `unittest_string_regex()`_ to assess pass/fail. # -FUNCTION(UNITTEST_FILE_REGEX INPUT_FILE) - MESSAGE("\nRegexing for strings in the file '${INPUT_FILE}':\n") - FILE(READ "${INPUT_FILE}" INPUT_FILE_STRING) - UNITTEST_STRING_REGEX("${INPUT_FILE_STRING}" ${ARGN}) -ENDFUNCTION() +function(unittest_file_regex INPUT_FILE) + message("\nRegexing for strings in the file '${INPUT_FILE}':\n") + file(READ "${INPUT_FILE}" INPUT_FILE_STRING) + unittest_string_regex("${INPUT_FILE_STRING}" ${ARGN}) +endfunction() # -# @FUNCTION: UNITTEST_FINAL_RESULT() +# @FUNCTION: unittest_final_result() # # Print final statistics from all tests and assert final pass/fail # # Usage:: # -# UNITTEST_FINAL_RESULT() +# unittest_final_result() # # If ``${UNITTEST_OVERALL_PASS}==TRUE`` and ``${UNITTEST_OVERALL_NUMPASSED} == # ``, then the overall test program is determined to have @@ -276,27 +276,27 @@ ENDFUNCTION() # # "Final UnitTests Result: FAILED" # -# is printed, and ``MESSAGE(SEND_ERROR "FAIL")`` is called. +# is printed, and ``message(SEND_ERROR "FAIL")`` is called. # # The reason that we require passing in the expected number of passed tests is # as an extra precaution to make sure that important unit tests are not left # out. CMake is a very loosely typed language and it pays to be a little # paranoid. # -FUNCTION(UNITTEST_FINAL_RESULT EXPECTED_NUMPASSED) - MESSAGE("\nFinal UnitTests Result: num_run = ${UNITTEST_OVERALL_NUMRUN}\n") - IF (UNITTEST_OVERALL_PASS) - IF (UNITTEST_OVERALL_NUMPASSED EQUAL ${EXPECTED_NUMPASSED}) - MESSAGE("Final UnitTests Result: PASSED" +function(unittest_final_result EXPECTED_NUMPASSED) + message("\nFinal UnitTests Result: num_run = ${UNITTEST_OVERALL_NUMRUN}\n") + if (UNITTEST_OVERALL_PASS) + if (UNITTEST_OVERALL_NUMPASSED EQUAL ${EXPECTED_NUMPASSED}) + message("Final UnitTests Result: PASSED" " (num_passed = ${UNITTEST_OVERALL_NUMPASSED})") - ELSE() - MESSAGE("\nError: num_passed = ${UNITTEST_OVERALL_NUMPASSED}" + else() + message("\nError: num_passed = ${UNITTEST_OVERALL_NUMPASSED}" " != num_expected = ${EXPECTED_NUMPASSED}") - MESSAGE("\nFinal UnitTests Result: FAILED\n") - MESSAGE(SEND_ERROR "FAIL") - ENDIF() - ELSE() - MESSAGE("\nFinal UnitTests Result: FAILED\n") - ENDIF() -ENDFUNCTION() + message("\nFinal UnitTests Result: FAILED\n") + message(SEND_ERROR "FAIL") + endif() + else() + message("\nFinal UnitTests Result: FAILED\n") + endif() +endfunction() diff --git a/cmake/tribits/core/utils/UseCcacheIfExists.cmake b/cmake/tribits/core/utils/UseCcacheIfExists.cmake index b3021d2bc0c6..4849b43a9260 100644 --- a/cmake/tribits/core/utils/UseCcacheIfExists.cmake +++ b/cmake/tribits/core/utils/UseCcacheIfExists.cmake @@ -2,8 +2,8 @@ # UseCcacheIfExists.cmake or with the TriBITS option -D # _CONFIGURE_OPTIONS_FILE=UseCcacheIfExists.cmake. -FIND_PROGRAM(CCACHE_EXEC ccache) -IF (CCACHE_EXEC) - MESSAGE("-- NOTE: ccache program exists so using it for RULE_LAUNCH_COMPILE!") - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_EXEC}") -ENDIF() +find_program(CCACHE_EXEC ccache) +if (CCACHE_EXEC) + message("-- NOTE: ccache program exists so using it for RULE_LAUNCH_COMPILE!") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_EXEC}") +endif() diff --git a/cmake/tribits/ctest_driver/README b/cmake/tribits/ctest_driver/README index 03c6b28a68ee..46ed1792d27c 100644 --- a/cmake/tribits/ctest_driver/README +++ b/cmake/tribits/ctest_driver/README @@ -131,8 +131,8 @@ D.1) Test out individual CTest dashboard builds first: Before running your outer cron driver script, you would be wise to first test out your individual CTest driver scripts (e.g. MPI_OPT, SERIAL_DEBUG, etc.). You can test individual basic ctest driver scripts to clone the project and -create the BUILD directroy by creating your own temp base directory and then -overridding CTEST_DASHBOARD_ROOT for example as: +create the BUILD directory by creating your own temp base directory and then +overriding CTEST_DASHBOARD_ROOT for example as: $ mkdir MOCK_MPI_OPT $ cd MOCK_MPI_OPT @@ -197,7 +197,7 @@ submit works, you can run a final trial build with: CTEST_DO_SUBMIT=ON CTEST_START_WITH_EMPTY_BINARY_DIRECTORY=FALSE \ ctest -V -S /cmake/ctest/drivers/s903186/ctest_mac_nightly_mpi_opt_s903186.cmake -If this submits to the 'Experimental' CDash dashbaord, you should be +If this submits to the 'Experimental' CDash dashboard, you should be in good shape for the nightly test. If you can't find you experimental build on the CDash dashboard, then something is wrong. diff --git a/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake b/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake index 74fedb3c9d77..3e7b85dcd1fe 100644 --- a/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake +++ b/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake @@ -48,131 +48,131 @@ # Macro that drives a experimental 'dashboard' target # -MACRO(TRIBITS_ADD_DASHBOARD_TARGET) +macro(tribits_add_dashboard_target) - IF (NOT (WIN32 AND NOT CYGWIN)) + if (NOT (WIN32 AND NOT CYGWIN)) - IF ("${${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT}" STREQUAL "") - SET(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT FALSE) - ENDIF() - ADVANCED_SET(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE + if ("${${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT FALSE) + endif() + advanced_set(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE ${${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT} CACHE BOOL "If set to TRUE, use all-at-once mode for configure, build, test, and submit. Otherwise, use package-by-package mode.") - ADVANCED_SET(${PROJECT_NAME}_DASHBOARD_CTEST_ARGS "-V" CACHE STRING + advanced_set(${PROJECT_NAME}_DASHBOARD_CTEST_ARGS "-V" CACHE STRING "Extra arguments to pass to CTest when calling 'ctest -S' to run the 'dashboard' make target." ) - ADVANCED_SET(CTEST_BUILD_FLAGS "" CACHE STRING + advanced_set(CTEST_BUILD_FLAGS "" CACHE STRING "Sets CTEST_BUILD_FLAGS on the env before invoking 'ctest -S'." ) - ADVANCED_SET(CTEST_PARALLEL_LEVEL "" CACHE STRING + advanced_set(CTEST_PARALLEL_LEVEL "" CACHE STRING "Sets CTEST_PARALLEL_LEVEL on the env before invoking 'ctest -S'." ) # H.1) Enable all packages that are enabled and have tests enabled - SET(${PROJECT_NAME}_ENABLED_PACKAGES_LIST) - SET(${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST) - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) - IF (${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE} AND ${TRIBITS_PACKAGE}_ENABLE_TESTS) - IF (${PROJECT_NAME}_ENABLED_PACKAGES_LIST) - SET(${PROJECT_NAME}_ENABLED_PACKAGES_LIST + set(${PROJECT_NAME}_ENABLED_PACKAGES_LIST) + set(${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST) + foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_ENABLED_SE_PACKAGES}) + if (${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE} AND ${TRIBITS_PACKAGE}_ENABLE_TESTS) + if (${PROJECT_NAME}_ENABLED_PACKAGES_LIST) + set(${PROJECT_NAME}_ENABLED_PACKAGES_LIST "${${PROJECT_NAME}_ENABLED_PACKAGES_LIST}\;${TRIBITS_PACKAGE}") - ELSE() - SET(${PROJECT_NAME}_ENABLED_PACKAGES_LIST "${TRIBITS_PACKAGE}") - ENDIF() - SET(${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST + else() + set(${PROJECT_NAME}_ENABLED_PACKAGES_LIST "${TRIBITS_PACKAGE}") + endif() + set(${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST ${${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST} -D${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}=ON) - ENDIF() - ENDFOREACH() - #PRINT_VAR(${PROJECT_NAME}_ENABLED_PACKAGES_LIST) + endif() + endforeach() + #print_var(${PROJECT_NAME}_ENABLED_PACKAGES_LIST) - SET(EXPR_CMND_ARGS) + set(EXPR_CMND_ARGS) # Hard override options used by basic build and tests - APPEND_SET(EXPR_CMND_ARGS "TRIBITS_PROJECT_ROOT=${${PROJECT_NAME}_SOURCE_DIR}") - APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}") - APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS='${${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS}'") - APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE=${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}") + append_set(EXPR_CMND_ARGS "TRIBITS_PROJECT_ROOT=${${PROJECT_NAME}_SOURCE_DIR}") + append_set(EXPR_CMND_ARGS "${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}") + append_set(EXPR_CMND_ARGS "${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS='${${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS}'") + append_set(EXPR_CMND_ARGS "${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE=${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}") # Conditionally override options used only for the 'dashboard' target. # These options have no use in a a basic build/test so we don't want to # interfere with options users might set on the env. - IF (NOT "${${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE=${${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE}") - ENDIF() - IF (NOT "${CTEST_BUILD_NAME}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_BUILD_NAME=${CTEST_BUILD_NAME}") - ENDIF() - IF (NOT "${${PROJECT_NAME}_ENABLE_COVERAGE_TESTING}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_DO_COVERAGE_TESTING=${${PROJECT_NAME}_ENABLE_COVERAGE_TESTING}") - ENDIF() - IF (NOT "${CTEST_BUILD_FLAGS}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_BUILD_FLAGS='${CTEST_BUILD_FLAGS}'") - ENDIF() - IF (NOT "${CTEST_PARALLEL_LEVEL}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL}") - ENDIF() - IF (NOT "${CTEST_DO_SUBMIT}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_DO_SUBMIT=${CTEST_DO_SUBMIT}") - ENDIF() - IF (NOT "${CTEST_DROP_METHOD}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_DROP_METHOD=${CTEST_DROP_METHOD}") - ENDIF() - IF (NOT $"{CTEST_DROP_SITE}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_DROP_SITE=${CTEST_DROP_SITE}") - ENDIF() - IF (NOT "${CTEST_DROP_LOCATION}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_DROP_LOCATION=${CTEST_DROP_LOCATION}") - ENDIF() - IF (NOT "${CTEST_DROP_SITE_COVERAGE}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_DROP_SITE_COVERAGE=${CTEST_DROP_SITE_COVERAGE}") - ENDIF() - IF (NOT "${CTEST_DROP_LOCATION_COVERAGE}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "CTEST_DROP_LOCATION_COVERAGE=${CTEST_DROP_LOCATION_COVERAGE}") - ENDIF() - IF (NOT "${TRIBITS_2ND_CTEST_DROP_LOCATION}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "TRIBITS_2ND_CTEST_DROP_LOCATION=${TRIBITS_2ND_CTEST_DROP_LOCATION}") - ENDIF() - IF (NOT "${TRIBITS_2ND_CTEST_DROP_SITE}" STREQUAL "") - APPEND_SET(EXPR_CMND_ARGS "TRIBITS_2ND_CTEST_DROP_SITE=${TRIBITS_2ND_CTEST_DROP_SITE}") - ENDIF() - - #PRINT_VAR(${PROJECT_NAME}_EXTRA_REPOSITORIES) - APPEND_SET(EXPR_CMND_ARGS + if (NOT "${${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE}" STREQUAL "") + append_set(EXPR_CMND_ARGS "${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE=${${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE}") + endif() + if (NOT "${CTEST_BUILD_NAME}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_BUILD_NAME=${CTEST_BUILD_NAME}") + endif() + if (NOT "${${PROJECT_NAME}_ENABLE_COVERAGE_TESTING}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_DO_COVERAGE_TESTING=${${PROJECT_NAME}_ENABLE_COVERAGE_TESTING}") + endif() + if (NOT "${CTEST_BUILD_FLAGS}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_BUILD_FLAGS='${CTEST_BUILD_FLAGS}'") + endif() + if (NOT "${CTEST_PARALLEL_LEVEL}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL}") + endif() + if (NOT "${CTEST_DO_SUBMIT}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_DO_SUBMIT=${CTEST_DO_SUBMIT}") + endif() + if (NOT "${CTEST_DROP_METHOD}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_DROP_METHOD=${CTEST_DROP_METHOD}") + endif() + if (NOT $"{CTEST_DROP_SITE}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_DROP_SITE=${CTEST_DROP_SITE}") + endif() + if (NOT "${CTEST_DROP_LOCATION}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_DROP_LOCATION=${CTEST_DROP_LOCATION}") + endif() + if (NOT "${CTEST_DROP_SITE_COVERAGE}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_DROP_SITE_COVERAGE=${CTEST_DROP_SITE_COVERAGE}") + endif() + if (NOT "${CTEST_DROP_LOCATION_COVERAGE}" STREQUAL "") + append_set(EXPR_CMND_ARGS "CTEST_DROP_LOCATION_COVERAGE=${CTEST_DROP_LOCATION_COVERAGE}") + endif() + if (NOT "${TRIBITS_2ND_CTEST_DROP_LOCATION}" STREQUAL "") + append_set(EXPR_CMND_ARGS "TRIBITS_2ND_CTEST_DROP_LOCATION=${TRIBITS_2ND_CTEST_DROP_LOCATION}") + endif() + if (NOT "${TRIBITS_2ND_CTEST_DROP_SITE}" STREQUAL "") + append_set(EXPR_CMND_ARGS "TRIBITS_2ND_CTEST_DROP_SITE=${TRIBITS_2ND_CTEST_DROP_SITE}") + endif() + + #print_var(${PROJECT_NAME}_EXTRA_REPOSITORIES) + append_set(EXPR_CMND_ARGS ${PROJECT_NAME}_EXTRAREPOS_FILE=${${PROJECT_NAME}_EXTRAREPOS_FILE}) - APPEND_SET(EXPR_CMND_ARGS + append_set(EXPR_CMND_ARGS ${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=${${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}) - APPEND_SET(EXPR_CMND_ARGS + append_set(EXPR_CMND_ARGS ${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES=${${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES}) - JOIN(${PROJECT_NAME}_EXTRA_REPOSITORIES_JOINED "," FALSE + join(${PROJECT_NAME}_EXTRA_REPOSITORIES_JOINED "," FALSE ${${PROJECT_NAME}_EXTRA_REPOSITORIES}) - APPEND_SET(EXPR_CMND_ARGS + append_set(EXPR_CMND_ARGS ${PROJECT_NAME}_EXTRA_REPOSITORIES=${${PROJECT_NAME}_EXTRA_REPOSITORIES_JOINED}) - #PRINT_VAR(EXPR_CMND_ARGS) + #print_var(EXPR_CMND_ARGS) # H.2) Add the custom target to enable all the packages with tests enabled - IF (${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE) + if (${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE) - SET(RUNNING_EXP_DASHBOARD_MSG_HEADER + set(RUNNING_EXP_DASHBOARD_MSG_HEADER "Running all-at-once experimental dashboard" ) - SET(DASHBOARD_TARGET_PRE_CTEST_DRIVER_CMNDS) + set(DASHBOARD_TARGET_PRE_CTEST_DRIVER_CMNDS) - SET(DASHBOARD_TARGET_CTEST_DRIVER_CMND_NUM) + set(DASHBOARD_TARGET_CTEST_DRIVER_CMND_NUM) - SET(DASHBOARD_TARGET_POST_CTEST_DRIVER_CMNDS) + set(DASHBOARD_TARGET_POST_CTEST_DRIVER_CMNDS) - ELSE() + else() - SET(RUNNING_EXP_DASHBOARD_MSG_HEADER + set(RUNNING_EXP_DASHBOARD_MSG_HEADER "Running package-by-package experimental dashboard" ) - SET(DASHBOARD_TARGET_PRE_CTEST_DRIVER_CMNDS + set(DASHBOARD_TARGET_PRE_CTEST_DRIVER_CMNDS COMMAND echo COMMAND echo "***" COMMAND echo "*** A) Clean out the list of packages" @@ -188,9 +188,9 @@ MACRO(TRIBITS_ADD_DASHBOARD_TARGET) # 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) ") + set(DASHBOARD_TARGET_CTEST_DRIVER_CMND_NUM "B) ") - SET(DASHBOARD_TARGET_POST_CTEST_DRIVER_CMNDS + set(DASHBOARD_TARGET_POST_CTEST_DRIVER_CMNDS COMMAND echo COMMAND echo "***" COMMAND echo "*** C) Clean out the list of packages again to clean the cache file" @@ -218,9 +218,9 @@ MACRO(TRIBITS_ADD_DASHBOARD_TARGET) COMMAND echo ) - ENDIF() + endif() - ADD_CUSTOM_TARGET( dashboard + add_custom_target( dashboard USES_TERMINAL # Allow real-time STDOUT with ninja target @@ -262,6 +262,6 @@ MACRO(TRIBITS_ADD_DASHBOARD_TARGET) ) - ENDIF() + endif() -ENDMACRO() +endmacro() diff --git a/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake b/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake index 2198789ad027..7449d172386d 100644 --- a/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake +++ b/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake @@ -43,16 +43,16 @@ # ############################################# -MESSAGE("") -MESSAGE("*******************************") -MESSAGE("*** TribitsCTestDriverCore ***") -MESSAGE("*******************************") -MESSAGE("") +message("") +message("*******************************") +message("*** TribitsCTestDriverCore ***") +message("*******************************") +message("") -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.17.0 FATAL_ERROR) -SET(THIS_CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}") +set(THIS_CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}") # # Get the basic variables that define the project and the build @@ -70,51 +70,51 @@ SET(THIS_CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}") # We allow the environment variable TRIBITS_PROJECT_ROOT to locate the # root directory. If the variable doesn't exist, we fall back on the # default convention. -#MESSAGE("TRIBITS_PROJECT_ROOT (before env) = '${TRIBITS_PROJECT_ROOT}'") -IF (NOT TRIBITS_PROJECT_ROOT) - SET(TRIBITS_PROJECT_ROOT "$ENV{TRIBITS_PROJECT_ROOT}") -ENDIF() -#MESSAGE("TRIBITS_PROJECT_ROOT (after env) = '${TRIBITS_PROJECT_ROOT}'") -IF (NOT TRIBITS_PROJECT_ROOT) +#message("TRIBITS_PROJECT_ROOT (before env) = '${TRIBITS_PROJECT_ROOT}'") +if (NOT TRIBITS_PROJECT_ROOT) + set(TRIBITS_PROJECT_ROOT "$ENV{TRIBITS_PROJECT_ROOT}") +endif() +#message("TRIBITS_PROJECT_ROOT (after env) = '${TRIBITS_PROJECT_ROOT}'") +if (NOT TRIBITS_PROJECT_ROOT) # Fall back on the default convention, in which this file is located at: # /cmake/tribits/ctest. - GET_FILENAME_COMPONENT(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) - SET(TRIBITS_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../..") -ENDIF() -GET_FILENAME_COMPONENT(TRIBITS_PROJECT_ROOT "${TRIBITS_PROJECT_ROOT}" ABSOLUTE) -MESSAGE("TRIBITS_PROJECT_ROOT = '${TRIBITS_PROJECT_ROOT}'") + get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + set(TRIBITS_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../..") +endif() +get_filename_component(TRIBITS_PROJECT_ROOT "${TRIBITS_PROJECT_ROOT}" ABSOLUTE) +message("TRIBITS_PROJECT_ROOT = '${TRIBITS_PROJECT_ROOT}'") # # Read in PROJECT_NAME # # Assert that the ProjectName.cmake file exists. -SET(TRIBITS_PROJECT_NAME_INCLUDE "${TRIBITS_PROJECT_ROOT}/ProjectName.cmake") -IF(NOT EXISTS "${TRIBITS_PROJECT_NAME_INCLUDE}") - MESSAGE(FATAL_ERROR +set(TRIBITS_PROJECT_NAME_INCLUDE "${TRIBITS_PROJECT_ROOT}/ProjectName.cmake") +if(NOT EXISTS "${TRIBITS_PROJECT_NAME_INCLUDE}") + message(FATAL_ERROR "Could not locate ProjectName.cmake.\n" " TRIBITS_PROJECT_ROOT = ${TRIBITS_PROJECT_ROOT}\n" " Set the TRIBITS_PROJECT_ROOT environment variable " "to point at the source root.") -ENDIF() +endif() # Include the ProjectName.cmake file and get PROJECT_NAME -INCLUDE(${TRIBITS_PROJECT_NAME_INCLUDE}) -IF(NOT PROJECT_NAME) - MESSAGE(FATAL_ERROR +include(${TRIBITS_PROJECT_NAME_INCLUDE}) +if(NOT PROJECT_NAME) + message(FATAL_ERROR "The project name has not been set!" " It should be set in ${TRIBITS_PROJECT_ROOT}/ProjectName.cmake.") -ENDIF() -MESSAGE("PROJECT_NAME = ${PROJECT_NAME}") +endif() +message("PROJECT_NAME = ${PROJECT_NAME}") # # Set ${PROJECT_NAME}_TRIBITS_DIR # -IF (NOT "$ENV{${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") - SET(${PROJECT_NAME}_TRIBITS_DIR "$ENV{${PROJECT_NAME}_TRIBITS_DIR}") -ENDIF() -IF ("${${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") - SET(${PROJECT_NAME}_TRIBITS_DIR "${TRIBITS_PROJECT_ROOT}/cmake/tribits") -ENDIF() -MESSAGE("${PROJECT_NAME}_TRIBITS_DIR = ${${PROJECT_NAME}_TRIBITS_DIR}") +if (NOT "$ENV{${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") + set(${PROJECT_NAME}_TRIBITS_DIR "$ENV{${PROJECT_NAME}_TRIBITS_DIR}") +endif() +if ("${${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") + set(${PROJECT_NAME}_TRIBITS_DIR "${TRIBITS_PROJECT_ROOT}/cmake/tribits") +endif() +message("${PROJECT_NAME}_TRIBITS_DIR = ${${PROJECT_NAME}_TRIBITS_DIR}") # ToDo: If you are really going to allow setting a different # ${PROJECT_NAME}_TRIBITS_DIR from where this module lives, then you need to # split off the implementation of this module into a separate @@ -124,51 +124,52 @@ MESSAGE("${PROJECT_NAME}_TRIBITS_DIR = ${${PROJECT_NAME}_TRIBITS_DIR}") # # Set default for CTEST_SOURCE_DIRECTORY # -IF ("${CTEST_SOURCE_DIRECTORY}" STREQUAL "") - MESSAGE("Set default for CTEST_SOURCE_DIRECTORY to TRIBITS_PROJECT_ROOT='TRIBITS_PROJECT_ROOT='${TRIBITS_PROJECT_ROOT}'") - SET(CTEST_SOURCE_DIRECTORY ${TRIBITS_PROJECT_ROOT}) -ENDIF() +if ("${CTEST_SOURCE_DIRECTORY}" STREQUAL "") + message("Set default for CTEST_SOURCE_DIRECTORY to TRIBITS_PROJECT_ROOT='TRIBITS_PROJECT_ROOT='${TRIBITS_PROJECT_ROOT}'") + set(CTEST_SOURCE_DIRECTORY ${TRIBITS_PROJECT_ROOT}) +endif() # # Set default for CTEST_BINARY_DIRECTORY # -IF ("${CTEST_BINARY_DIRECTORY}" STREQUAL "") - MESSAGE("Set defualt for CTEST_BINARY_DIRECTORY to $PWD/BUILD='$ENV{PWD}/BUILD'") - SET(CTEST_BINARY_DIRECTORY $ENV{PWD}/BUILD) -ENDIF() +if ("${CTEST_BINARY_DIRECTORY}" STREQUAL "") + message("Set default for CTEST_BINARY_DIRECTORY to $PWD/BUILD='$ENV{PWD}/BUILD'") + set(CTEST_BINARY_DIRECTORY $ENV{PWD}/BUILD) +endif() # # Set CMAKE_MODULE_PATH # -SET( CMAKE_MODULE_PATH +set( CMAKE_MODULE_PATH "${TRIBITS_PROJECT_ROOT}" "${TRIBITS_PROJECT_ROOT}/cmake" "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" "${${PROJECT_NAME}_TRIBITS_DIR}/ci_support" + "${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver" ) -INCLUDE(TribitsConstants) -TRIBITS_ASESRT_MINIMUM_CMAKE_VERSION() -INCLUDE(TribitsCMakePolicies) +include(TribitsConstants) +tribits_asesrt_minimum_cmake_version() +include(TribitsCMakePolicies) -INCLUDE(Split) -INCLUDE(PrintVar) -INCLUDE(MultilineSet) -INCLUDE(SetDefaultAndFromEnv) -INCLUDE(AssertDefined) -INCLUDE(AppendSet) -INCLUDE(AppendStringVar) -INCLUDE(TribitsGlobalMacros) -INCLUDE(TribitsStripCommentsFromCMakeCacheFile) +include(Split) +include(PrintVar) +include(MultilineSet) +include(SetDefaultAndFromEnv) +include(AssertDefined) +include(AppendSet) +include(AppendStringVar) +include(TribitsGlobalMacros) +include(TribitsStripCommentsFromCMakeCacheFile) # Need to include the project's version file to get some Git and CDash # settings specific to the given version -TRIBITS_PROJECT_READ_VERSION_FILE(${TRIBITS_PROJECT_ROOT}) +tribits_project_read_version_file(${TRIBITS_PROJECT_ROOT}) -INCLUDE(TribitsFindPythonInterp) -TRIBITS_FIND_PYTHON() -MESSAGE("PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") +include(TribitsFindPythonInterp) +tribits_find_python() +message("PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") ############################# ### Do some initial setup ### @@ -177,63 +178,63 @@ MESSAGE("PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") # Get the host type -IF(WIN32) - SET(HOST_TYPE $ENV{OS}) -ELSE() - FIND_PROGRAM(UNAME_EXE NAMES uname) - EXECUTE_PROCESS( +if(WIN32) + set(HOST_TYPE $ENV{OS}) +else() + find_program(UNAME_EXE NAMES uname) + execute_process( COMMAND ${UNAME_EXE} OUTPUT_VARIABLE HOST_TYPE OUTPUT_STRIP_TRAILING_WHITESPACE ) -ENDIF() +endif() # Find git -FIND_PACKAGE(Git REQUIRED) +find_package(Git REQUIRED) # Find gitdist -SET(GITDIST_EXE "${${PROJECT_NAME}_TRIBITS_DIR}/python_utils/gitdist") +set(GITDIST_EXE "${${PROJECT_NAME}_TRIBITS_DIR}/python_utils/gitdist") # Get the host name -SITE_NAME(CTEST_SITE_DEFAULT) +site_name(CTEST_SITE_DEFAULT) # Get helper functions -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) +include(TribitsCTestDriverCoreHelpers) # -# @FUNCTION: TRIBITS_CTEST_DRIVER() +# @FUNCTION: tribits_ctest_driver() # # Universal platform-independent CTest/CDash driver function for CTest -S # scripts for TriBITS projects # # Usage (in ``