From 0cd49ce9f22d65968e4221225be609bf35091377 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Wed, 14 Dec 2022 16:13:10 -0700 Subject: [PATCH 01/10] Add string-replace.py (#429) Will help in future refactorings. I mostly just added this as a precursor to token-replace.py. --- refactoring/string-replace.py | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 refactoring/string-replace.py diff --git a/refactoring/string-replace.py b/refactoring/string-replace.py new file mode 100755 index 000000000..2a04a691f --- /dev/null +++ b/refactoring/string-replace.py @@ -0,0 +1,64 @@ +#!/bin/env python3 + +usageHelp = r""" + +Replace a given string with another string in a file (but only touch the file +if there were changes). + +""" + + +def getCmndLineOptions(): + from argparse import ArgumentParser, RawDescriptionHelpFormatter + + clp = ArgumentParser(description=usageHelp, + formatter_class=RawDescriptionHelpFormatter) + + clp.add_argument( + "-s", dest="stringToReplace", required=True, + help="String to repalce" ) + + clp.add_argument( + "-r", dest="replacementString", required=True, + help="Replacement string" ) + + clp.add_argument( + "-f", dest="inputFile", required=True, + help="Input file (and also output if -o not specified)" ) + + clp.add_argument( + "-o", dest="outputFile", default="", + help="Input file (and also output if -o not specified)" ) + + options = clp.parse_args(sys.argv[1:]) + + if options.outputFile == "": + options.outputFile = options.inputFile + + return options + + +# +# Main() +# + +if __name__ == '__main__': + + import sys + + inOptions = getCmndLineOptions() + + with open(inOptions.inputFile, 'r') as file: + lines = file.readlines() + + fileWasChanged = False + newLines = [] + for line in lines: + newLine = line.replace(inOptions.stringToReplace, inOptions.replacementString) + if newLine != line: + fileWasChanged = True + newLines.append(newLine) + + if (fileWasChanged or inOptions.outputFile != inOptions.inputFile): + with open(inOptions.outputFile, 'w') as file: + file.writelines(newLines) From 270e00abed7ea7430cfa79a8dc2ebabf039c2386 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Wed, 14 Dec 2022 16:42:21 -0700 Subject: [PATCH 02/10] Add token-replace.py (#429) I will use this tool to replace deprecated functions/macros. --- refactoring/token-replace.py | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 refactoring/token-replace.py diff --git a/refactoring/token-replace.py b/refactoring/token-replace.py new file mode 100755 index 000000000..11ea49aaa --- /dev/null +++ b/refactoring/token-replace.py @@ -0,0 +1,77 @@ +#!/bin/env python3 + +usageHelp = r""" + +Replace a given token string with another string in a file (but only touch the +file if there were changes). + +This will only match complete tokens that match the regex: + + ([^A-Za-z0-9_])|^) Date: Wed, 14 Dec 2022 16:55:18 -0700 Subject: [PATCH 03/10] Add replace_include_directories_r.sh (#429) --- refactoring/replace_include_directories_r.sh | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 refactoring/replace_include_directories_r.sh diff --git a/refactoring/replace_include_directories_r.sh b/refactoring/replace_include_directories_r.sh new file mode 100755 index 000000000..1e0fbb4f2 --- /dev/null +++ b/refactoring/replace_include_directories_r.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Run this in a subdir to replace all occurrences of INCLUDE_DIRECTORIES with +# TRIBITS_INCLUDE_DIRECTORIES (and lower-case versions). Take into account +# token boundaries so will not replace in the middle of a token. +# +# Run as: +# +# $ cd +# $ /replace_include_directories_r.sh +# + +_SCRIPT_DIR=`echo $0 | sed "s/\(.*\)\/.*replace_include_directories_r.sh/\1/g"` +#echo $_SCRIPT_DIR + +echo +echo "Replacing INCLUDE_DIRECTORIES with TRIBITS_INCLUDE_DIRECTORIES in all CMakeList.txt and *.cmake files ..." +echo + +find . \( -name CMakeLists.txt -or -name "*.cmake" \) -exec ${_SCRIPT_DIR}/token-replace.py -t INCLUDE_DIRECTORIES -r TRIBITS_INCLUDE_DIRECTORIES -f {} \; + +echo +echo "Replacing include_directories with tribits_include_directories in all CMakeList.txt and *.cmake files ..." +echo + +find . \( -name CMakeLists.txt -or -name "*.cmake" \) -exec ${_SCRIPT_DIR}/token-replace.py -t include_directories -r tribits_include_directories -f {} \; From 69fb01c520c454fb2fe049aadf21263a75b2358c Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Wed, 14 Dec 2022 15:00:08 -0700 Subject: [PATCH 04/10] Complete deprecated warnings support and doc (#429) * Update the deprecation message to mention the cache var TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE and how to set it to remove deprecation warnings. * Add non-cache var TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_DEFAULT so that a TriBITS project can provide its own default for cache var TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE. * Add documentation for the cache var TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE in the TriBITS build reference and developers guides. * Fix TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_ALL_VALID_VALUES to pull in ${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_CALL_MESSAGE} and ${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_DONT_CALL_MESSAGE} instead of pulling in ${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_CALL_MESSAGE} twice. (If user would have tried to set -DTRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE=IGNORE, it would have errored out of the configure.) --- .../core/TestingFunctionMacro_UnitTests.cmake | 33 ++++++++------ tribits/CHANGELOG.md | 19 ++++++++ .../package_arch/TribitsGlobalMacros.cmake | 6 ++- .../core/utils/TribitsDeprecatedHelpers.cmake | 44 +++++++++++-------- .../build_ref/TribitsBuildReferenceBody.rst | 20 +++++++++ .../guides/TribitsCoreDetailedReference.rst | 14 ++++++ 6 files changed, 102 insertions(+), 34 deletions(-) diff --git a/test/core/TestingFunctionMacro_UnitTests.cmake b/test/core/TestingFunctionMacro_UnitTests.cmake index 059276a67..56dcb63da 100644 --- a/test/core/TestingFunctionMacro_UnitTests.cmake +++ b/test/core/TestingFunctionMacro_UnitTests.cmake @@ -367,7 +367,7 @@ function(unittest_tribits_misc) tribits_filter_and_assert_categories(CATEGORIES) set(MESSAGE_WRAPPER_UNIT_TEST_MODE FALSE) unittest_compare_const(MESSAGE_WRAPPER_INPUT - "DEPRECATION;The test category 'WEEKLY' is deprecated; and is replaced with 'HEAVY'. Please change to use 'HEAVY' instead.") + "DEPRECATION;The test category 'WEEKLY' is deprecated; and is replaced with 'HEAVY'. Please change to use 'HEAVY' instead.;${TRIBITS_DEPRECATE_MSG_LAST_PART}") unittest_compare_const(CATEGORIES "BASIC;HEAVY;NIGHTLY") message("Testing tribits_filter_and_assert_categories( ... HEAVY)") @@ -1768,7 +1768,7 @@ function(unittest_tribits_add_test_categories) tribits_add_test( ${EXEN} CATEGORIES WEEKLY ) unittest_compare_const( MESSAGE_WRAPPER_INPUT - "DEPRECATION;The test category 'WEEKLY' is deprecated; and is replaced with 'HEAVY'. Please change to use 'HEAVY' instead.;-- PackageA_SomeExec: Added test (HEAVY, PROCESSORS=1)!" + "DEPRECATION;The test category 'WEEKLY' is deprecated; and is replaced with 'HEAVY'. Please change to use 'HEAVY' instead.;${TRIBITS_DEPRECATE_MSG_LAST_PART};-- PackageA_SomeExec: Added test (HEAVY, PROCESSORS=1)!" ) unittest_compare_const( TRIBITS_ADD_TEST_ADD_TEST_INPUT @@ -4615,7 +4615,7 @@ function(unittest_tribits_deprecated) tribits_deprecated("This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE unset") unittest_compare_const( MESSAGE_WRAPPER_INPUT - "DEPRECATION;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE unset" + "DEPRECATION;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE unset;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated() with multiple message arguments") @@ -4625,7 +4625,7 @@ function(unittest_tribits_deprecated) " multiple message arguments") unittest_compare_const( MESSAGE_WRAPPER_INPUT - "DEPRECATION;This is a deprecation message with; multiple message arguments" + "DEPRECATION;This is a deprecation message with; multiple message arguments;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated() with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to empty string") @@ -4634,7 +4634,7 @@ function(unittest_tribits_deprecated) tribits_deprecated("This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to empty string") unittest_compare_const( MESSAGE_WRAPPER_INPUT - "DEPRECATION;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to empty string" + "DEPRECATION;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to empty string;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated() with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to DEPRECATION") @@ -4643,7 +4643,7 @@ function(unittest_tribits_deprecated) tribits_deprecated("This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to DEPRECATION") unittest_compare_const( MESSAGE_WRAPPER_INPUT - "DEPRECATION;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to DEPRECATION" + "DEPRECATION;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to DEPRECATION;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated() with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to AUTHOR_WARNING") @@ -4652,7 +4652,7 @@ function(unittest_tribits_deprecated) tribits_deprecated("This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to AUTHOR_WARNING") unittest_compare_const( MESSAGE_WRAPPER_INPUT - "AUTHOR_WARNING;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to AUTHOR_WARNING" + "AUTHOR_WARNING;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to AUTHOR_WARNING;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated() with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to SEND_ERROR") @@ -4661,7 +4661,7 @@ function(unittest_tribits_deprecated) tribits_deprecated("This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to SEND_ERROR") unittest_compare_const( MESSAGE_WRAPPER_INPUT - "SEND_ERROR;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to SEND_ERROR" + "SEND_ERROR;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to SEND_ERROR;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated() with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to FATAL_ERROR") @@ -4670,7 +4670,7 @@ function(unittest_tribits_deprecated) tribits_deprecated("This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to FATAL_ERROR") unittest_compare_const( MESSAGE_WRAPPER_INPUT - "FATAL_ERROR;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to FATAL_ERROR" + "FATAL_ERROR;This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to FATAL_ERROR;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated() with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to INVALID") @@ -4679,7 +4679,7 @@ function(unittest_tribits_deprecated) tribits_deprecated("This is a deprecation message with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to INVALID") unittest_compare_const( MESSAGE_WRAPPER_INPUT - "FATAL_ERROR;Invalid value for TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE: 'INVALID'" + "FATAL_ERROR;Invalid value for; TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE=;'INVALID'" ) endfunction() @@ -4699,7 +4699,7 @@ function(unittest_tribits_deprecated_command) tribits_deprecated_command(tribits_some_deprecated_command) unittest_compare_const( MESSAGE_WRAPPER_INPUT - "DEPRECATION;TriBITS command 'tribits_some_deprecated_command' is deprecated." + "DEPRECATION;TriBITS command 'tribits_some_deprecated_command' is deprecated.;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated_command() with TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE set to AUTHOR_WARNING") @@ -4708,7 +4708,7 @@ function(unittest_tribits_deprecated_command) tribits_deprecated_command(tribits_some_other_deprecated_command) unittest_compare_const( MESSAGE_WRAPPER_INPUT - "AUTHOR_WARNING;TriBITS command 'tribits_some_other_deprecated_command' is deprecated." + "AUTHOR_WARNING;TriBITS command 'tribits_some_other_deprecated_command' is deprecated.;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated_command() with a message") @@ -4719,7 +4719,7 @@ function(unittest_tribits_deprecated_command) ) unittest_compare_const( MESSAGE_WRAPPER_INPUT - "DEPRECATION;TriBITS command 'tribits_another_deprecated_command' is deprecated.\n\nUse tribits_some_new_command instead." + "DEPRECATION;TriBITS command 'tribits_another_deprecated_command' is deprecated.\n\nUse tribits_some_new_command instead.;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) message("Testing tribits_deprecated_command() with multiple MESSAGE arguments") @@ -4731,7 +4731,7 @@ function(unittest_tribits_deprecated_command) ) unittest_compare_const( MESSAGE_WRAPPER_INPUT - "DEPRECATION;TriBITS command 'tribits_yet_another_deprecated_command' is deprecated.\n\nThis is a deprecation message with; multiple arguments." + "DEPRECATION;TriBITS command 'tribits_yet_another_deprecated_command' is deprecated.\n\nThis is a deprecation message with; multiple arguments.;${TRIBITS_DEPRECATE_MSG_LAST_PART}" ) endfunction() @@ -4756,6 +4756,11 @@ set( TRIBITS_ADD_TEST_ADD_TEST_UNITTEST TRUE ) # Capture the add_test() arguments for tribits_add_test(). set( TRIBITS_ADD_TEST_ADD_TEST_CAPTURE TRUE ) +# String for common part of tribits_deprecate() message +set(TRIBITS_DEPRECATE_MSG_LAST_PART + "\n\nNOTE: To Make these warnings go away, set -D" + " TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE=IGNORE (see the build reference guide).") + message("\n***") message("*** Testing misc TriBITS functions and macros") message("***\n") diff --git a/tribits/CHANGELOG.md b/tribits/CHANGELOG.md index 5b1147d33..0d122142a 100644 --- a/tribits/CHANGELOG.md +++ b/tribits/CHANGELOG.md @@ -2,6 +2,25 @@ ChangeLog for TriBITS ---------------------------------------- +## 2022-11-03: + +* **Deprecated:** The long-deprecated TriBITS function override + `include_directories()` now emits a deprecated warning. To replace all + usages of `include_directories()` that should be + `tribits_include_directories()`, use the script + `TriBITS/refactoring/replace_include_directories_r.sh` (see documentation in + that script). + +* **Deprecated:** Many previously deprecated TriBITS features now will trigger + a CMake DEPRECATION warning message by default (by calling + `message(DEPRECATION ...)`). The message printed to the CMake output will + typically describe how to remove the usage of the deprecated feature. To + remove deprecation warnings, change to use the non-deprecated features + mentioned in the deprecation warning message. To temporarily disable + deprecation warnings, configure with `-D + TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE=IGNORE` (see build reference entry + for `TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE` for more details). + ## 2022-10-20: * **Changed:** Disabling an external package/TPL will now disable any diff --git a/tribits/core/package_arch/TribitsGlobalMacros.cmake b/tribits/core/package_arch/TribitsGlobalMacros.cmake index 283d81af7..7f452f338 100644 --- a/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -959,8 +959,12 @@ macro(tribits_define_global_options_and_define_extra_repos) CACHE BOOL "Set to 'ON' to see the machine load for advanced tests." ) + if ("${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_DEFAULT}" STREQUAL "") + set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_DEFAULT "DEPRECATION") + endif() + tribits_add_enum_cache_var(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE - DEFAULT_VAL "DEPRECATION" + DEFAULT_VAL "${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_DEFAULT}" DOC_STRING "Mode for dealing with usage of TriBITS deprecated functionality" ALLOWED_STRINGS_LIST ${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_ALL_VALID_VALUES} IS_ADVANCED diff --git a/tribits/core/utils/TribitsDeprecatedHelpers.cmake b/tribits/core/utils/TribitsDeprecatedHelpers.cmake index 4dec816bf..0ae57138e 100644 --- a/tribits/core/utils/TribitsDeprecatedHelpers.cmake +++ b/tribits/core/utils/TribitsDeprecatedHelpers.cmake @@ -42,34 +42,33 @@ include(TribitsParseArgumentsHelpers) set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_CALL_MESSAGE - DEPRECATION AUTHOR_WARNING SEND_ERROR FATAL_ERROR - ) + DEPRECATION AUTHOR_WARNING SEND_ERROR FATAL_ERROR ) set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_DONT_CALL_MESSAGE - IGNORE - ) + IGNORE ) set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_ALL_VALID_VALUES ${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_CALL_MESSAGE} - ${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_CALL_MESSAGE} - ) + ${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_DONT_CALL_MESSAGE} ) # @FUNCTION: tribits_deprecated() # -# Notify the user that some TriBITS functionality is deprecated. Depending on -# the value of TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE, this can do one of -# several things: -# -# - ``DEPRECATION`` or empty string: issue a CMake ``DEPRECATION`` message and -# continue. -# - ``AUTHOR_WARNING``: issue a CMake ``AUTHOR_WARNING`` message and continue. -# - ``SEND_ERROR``: issue a CMake ``SEND_ERROR`` message and continue. -# - ``FATAL_ERROR``: issue a CMake ``FATAL_ERROR`` message and exit. -# - ``IGNORE``: issue no message and continue. +# Notify the user that some TriBITS functionality is deprecated. # # Usage:: # # tribits_deprecated() # +# Depending on the value of the cache variable +# `TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE`_, this can do one of several +# things: +# +# - ``DEPRECATION`` or empty string (or variable not defined): Issue a CMake +# ``DEPRECATION`` message and continue. +# - ``AUTHOR_WARNING``: Issue a CMake ``AUTHOR_WARNING`` message and continue. +# - ``SEND_ERROR``: Issue a CMake ``SEND_ERROR`` message and continue. +# - ``FATAL_ERROR``: Issue a CMake ``FATAL_ERROR`` message and exit. +# - ``IGNORE``: Issue no message and continue. +# function(tribits_deprecated) cmake_parse_arguments(PARSE_ARGV 0 FWD "" "" "") @@ -78,9 +77,16 @@ function(tribits_deprecated) endif() if ("${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE}" IN_LIST TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_CALL_MESSAGE) - message_wrapper("${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE}" ${FWD_UNPARSED_ARGUMENTS}) - elseif (NOT "${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE}" IN_LIST TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_ALL_VALID_VALUES) - message_wrapper(FATAL_ERROR "Invalid value for TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE: '${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE}'") + message_wrapper("${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE}" + ${FWD_UNPARSED_ARGUMENTS} + "\n\nNOTE: To Make these warnings go away, set -D" + " TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE=IGNORE (see the build reference guide).") + elseif (NOT "${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE}" IN_LIST + TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_ALL_VALID_VALUES + ) + message_wrapper(FATAL_ERROR "Invalid value for" + " TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE=" + "'${TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE}'") endif() endfunction() diff --git a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index f71863a55..07f0570a2 100644 --- a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst @@ -2089,6 +2089,26 @@ This will override the global behavior set by ````. +Adjusting CMake DEPRECATION warnings +------------------------------------ + +By default, deprecated TriBITS features being used in the project's CMake +files will result in CMake deprecation warning messages (issued by calling +``message(DEPRECATION ...)`` internally). The handling of these deprecation +warnings can be changed by setting the CMake cache variable +``TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE``. For example, to remove all +deprecation warnings, set:: + + -D TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE=IGNORE + +Other valid values include: + +* ``DEPRECATION``: Issue a CMake ``DEPRECATION`` message and continue (default). +* ``AUTHOR_WARNING``: Issue a CMake ``AUTHOR_WARNING`` message and continue. +* ``SEND_ERROR``: Issue a CMake ``SEND_ERROR`` message and continue. +* ``FATAL_ERROR``: Issue a CMake ``FATAL_ERROR`` message and exit. + + Disabling deprecated code ------------------------- diff --git a/tribits/doc/guides/TribitsCoreDetailedReference.rst b/tribits/doc/guides/TribitsCoreDetailedReference.rst index e5ef0fa66..2cc0fb95e 100644 --- a/tribits/doc/guides/TribitsCoreDetailedReference.rst +++ b/tribits/doc/guides/TribitsCoreDetailedReference.rst @@ -98,6 +98,7 @@ a given TriBITS project are: * `CMAKE_INSTALL_RPATH_USE_LINK_PATH`_ * `MPI_EXEC_MAX_NUMPROCS`_ * `PythonInterp_FIND_VERSION`_ +* `TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE`_ These options are described below. @@ -862,6 +863,19 @@ These options are described below. -D PythonInterp_FIND_VERSION="3.6.2" +.. _TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE: + +**TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE** + + Determines how the function `tribits_deprecated()`_ behaves. To change the + default behavor, such as call ``message(FATAL_ERROR ...)``, set:: + + set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_DEFAULT FATAL_ERROR) + + in the project's `/ProjectName.cmake`_ file, or + `/CMakeLists.txt`_ file, or on the individual package basis in + its `/CMakeLists.txt`_ file. + TriBITS Macros and Functions ---------------------------- From 65a239ea8c809d32fb3b04babf2dc61796a049e2 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Thu, 15 Dec 2022 09:45:15 -0700 Subject: [PATCH 05/10] Add TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE (#429) This allows hiding the override of the raw CMake command include_directories() and stop calling _include_directories() in tribits_include_directories() when TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE=TRUE. I also updated some documentation and did some reformatting to fit in 90 char width. --- .../TribitsIncludeDirectories.cmake | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/tribits/core/package_arch/TribitsIncludeDirectories.cmake b/tribits/core/package_arch/TribitsIncludeDirectories.cmake index f31da5dfb..e28809495 100644 --- a/tribits/core/package_arch/TribitsIncludeDirectories.cmake +++ b/tribits/core/package_arch/TribitsIncludeDirectories.cmake @@ -43,14 +43,14 @@ include(TribitsDeprecatedHelpers) # @MACRO: tribits_include_directories() # -# This function is to override the standard behavior of the built-in CMake -# ``include_directories()`` command. +# This function overrides the standard behavior of the built-in CMake +# ``include_directories()`` command for special behavior for installation +# testing. # # Usage:: # # tribits_include_directories( -# [REQUIRED_DURING_INSTALLATION_TESTING] ... -# ) +# [REQUIRED_DURING_INSTALLATION_TESTING] ... ) # # If specified, ``REQUIRED_DURING_INSTALLATION_TESTING`` can appear anywhere # in the argument list. @@ -62,10 +62,10 @@ include(TribitsDeprecatedHelpers) # Testing`_). Normally we want the include directories to be handled as cmake # usually does. However during TriBITS installation testing we do not want # most of the include directories to be used as the majority of the files -# should come from the installation we are building against. There is an -# exception to this and that is when there are test only headers that are -# needed. For that case ``REQUIRED_DURING_INSTALLATION_TESTING`` must be -# passed in to ensure the include paths are added for installation testing. +# should come from the installation we are building against. The exception is +# when there are test only headers that are 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) @@ -81,13 +81,25 @@ macro(tribits_include_directories) ${ARGN} ) - if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) - _include_directories(${PARSE_UNPARSED_ARGUMENTS}) + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING + OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING + ) + if (TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE) + include_directories(${PARSE_UNPARSED_ARGUMENTS}) + else() + _include_directories(${PARSE_UNPARSED_ARGUMENTS}) + endif() endif() endmacro() +if (NOT TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE) + # Deprecated. Use tribits_include_directories() instead! +# +# To hide this macro from even being defined, set +# ``TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE=TRUE``. +# macro(include_directories) tribits_deprecated_command(include_directories @@ -106,7 +118,11 @@ macro(include_directories) ${ARGN} ) - if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING) + if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING + OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING + ) _include_directories(${PARSE_UNPARSED_ARGUMENTS}) endif() endmacro() + +endif (NOT TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE) From ee0fb7216955dd484b5d5fddf3a3a96b1938e317 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Thu, 15 Dec 2022 10:16:45 -0700 Subject: [PATCH 06/10] Add usage of tribits_include_directories(REQUIRED_DURING_INSTALLATION_TESTING ...) (#429) This is needed to test tribits_include_directories(REQUIRED_DURING_INSTALLATION_TESTING ...) and why it is needed. There was no example in TriBITS that showed the usage of this feature. This is also a nice example for users (even if it makes SimpleCxx a little more complex). --- .../packages/simple_cxx/test/CMakeLists.txt | 3 +++ .../simple_cxx/test/SimpleCxx_HelloWorld_Tests.cpp | 7 +------ .../simple_cxx/test/inc/SimpleCxx_HelloWorld_Tests.hpp | 10 ++++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 tribits/examples/TribitsExampleProject/packages/simple_cxx/test/inc/SimpleCxx_HelloWorld_Tests.hpp diff --git a/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/CMakeLists.txt b/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/CMakeLists.txt index 4b39105c9..f553d4ef2 100644 --- a/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/CMakeLists.txt @@ -1,3 +1,6 @@ +tribits_include_directories( REQUIRED_DURING_INSTALLATION_TESTING + ${CMAKE_CURRENT_SOURCE_DIR}/inc ) + tribits_add_executable_and_test( HelloWorldTests SOURCES diff --git a/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/SimpleCxx_HelloWorld_Tests.cpp b/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/SimpleCxx_HelloWorld_Tests.cpp index 575555ffb..85430c8cf 100644 --- a/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/SimpleCxx_HelloWorld_Tests.cpp +++ b/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/SimpleCxx_HelloWorld_Tests.cpp @@ -1,9 +1,4 @@ - -#include -#include -#include -#include "SimpleCxx_HelloWorld.hpp" -#include "HeaderOnlyTpl_stuff.hpp" +#include "SimpleCxx_HelloWorld_Tests.hpp" #define TEST_FIND_SUBSTR_IN_STR(SUBSTR, STR) \ diff --git a/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/inc/SimpleCxx_HelloWorld_Tests.hpp b/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/inc/SimpleCxx_HelloWorld_Tests.hpp new file mode 100644 index 000000000..78b70ccc3 --- /dev/null +++ b/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/inc/SimpleCxx_HelloWorld_Tests.hpp @@ -0,0 +1,10 @@ +#ifndef SIMPLECXX_HELLOWORLD_TESTS_HPP +#define SIMPLECXX_HELLOWORLD_TESTS_HPP + +#include +#include +#include +#include "SimpleCxx_HelloWorld.hpp" +#include "HeaderOnlyTpl_stuff.hpp" + +#endif // SIMPLECXX_HELLOWORLD_TESTS_HPP From 2ca526bc92e1bb3b3bb98d13a99d4f8c2f83262a Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Thu, 15 Dec 2022 09:59:30 -0700 Subject: [PATCH 07/10] WIP: Add failing test for include_directories() for install testing (#429) This shows that the -I for the lib source tree is being added incorrectly. To get this error to show, I set TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE=TRUE for TribitsExampleProject. Other changes: * Added subdir 'BUILD' beside copied TribitsExampleProject source tree. (It is not good to intermingle the source and build trees at all.) * Removed redundant ALWAYS_FAIL_ON_NONZERO_RETURN: When not specifying some other pass/fail criteria, a non-zero return code means fail. --- .../TribitsExampleProject_Tests.cmake | 64 +++++++++---------- .../ExamplesUnitTests/append_line_to_files.sh | 12 ++++ .../TribitsExampleProject/CMakeLists.txt | 2 + 3 files changed, 46 insertions(+), 32 deletions(-) create mode 100755 test/core/ExamplesUnitTests/append_line_to_files.sh diff --git a/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake b/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake index 4ffd1da1c..5851b9f36 100644 --- a/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake +++ b/test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake @@ -989,12 +989,10 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST_NoFortran_enable_install ARGS -E copy_directory ${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProject TribitsExampleProject - ALWAYS_FAIL_ON_NONZERO_RETURN TEST_1 MESSAGE "Do the initial configure of just the libraries" - WORKING_DIRECTORY BUILD_LIBS - SKIP_CLEAN_WORKING_DIRECTORY + WORKING_DIRECTORY BUILD_LIBS/BUILD CMND ${CMAKE_COMMAND} ARGS ${TribitsExampleProject_COMMON_CONFIG_ARGS} @@ -1004,20 +1002,17 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST_NoFortran_enable_install -DTribitsExProj_ENABLE_SECONDARY_TESTED_CODE=ON -DTribitsExProj_ENABLE_INSTALL_CMAKE_CONFIG_FILES=ON -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_TribitsExampleProject_ALL_ST_NoFortran_enable_installation_testing/install - TribitsExampleProject - ALWAYS_FAIL_ON_NONZERO_RETURN + ../TribitsExampleProject TEST_2 MESSAGE "Do Make install " - WORKING_DIRECTORY BUILD_LIBS + WORKING_DIRECTORY BUILD_LIBS/BUILD SKIP_CLEAN_WORKING_DIRECTORY CMND make ARGS ${CTEST_BUILD_FLAGS} install - ALWAYS_FAIL_ON_NONZERO_RETURN TEST_3 - MESSAGE "BUILD_LIBS dir to a subdir to make sure install is independent of build and source tree" + MESSAGE "Move BUILD_LIBS dir to a subdir to make sure install is independent of build and source tree" WORKING_DIRECTORY BUILD_LIBS_MOVED_BASE - SKIP_CLEAN_WORKING_DIRECTORY CMND mv ARGS ../BUILD_LIBS . TEST_4 @@ -1027,24 +1022,25 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST_NoFortran_enable_install ARGS -E copy_directory ${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProject TribitsExampleProject - ALWAYS_FAIL_ON_NONZERO_RETURN TEST_5 - MESSAGE "Remove some lib header and source files from local TribitsExampleProject source tree!" + MESSAGE "Remove some lib source files from local TribitsExampleProject source tree" CMND rm ARGS - BUILD_TESTS/TribitsExampleProject/packages/simple_cxx/src/SimpleCxx_HelloWorld.hpp BUILD_TESTS/TribitsExampleProject/packages/simple_cxx/src/SimpleCxx_HelloWorld.cpp - BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/a/A.hpp BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/a/A.cpp - BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/b/src/B.hpp BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/b/src/B.cpp BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/c/C.cpp - BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/c/wsp_c/C.hpp TEST_6 + MESSAGE "Break a lib header file in the source tree to ensure include path does not find them" + CMND ${CMAKE_CURRENT_SOURCE_DIR}/append_line_to_files.sh ARGS "This header file is broken" + BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/a/A.hpp + BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/b/src/B.hpp + BUILD_TESTS/TribitsExampleProject/packages/with_subpackages/c/wsp_c/C.hpp + + TEST_7 MESSAGE "Do the configure of just the tests/examples pointing to existing install" - WORKING_DIRECTORY BUILD_TESTS - SKIP_CLEAN_WORKING_DIRECTORY + WORKING_DIRECTORY BUILD_TESTS/BUILD CMND ${CMAKE_COMMAND} ARGS ${TribitsExampleProject_COMMON_CONFIG_ARGS} @@ -1056,19 +1052,17 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST_NoFortran_enable_install -DTribitsExProj_ENABLE_INSTALL_CMAKE_CONFIG_FILES=ON -DTribitsExProj_ENABLE_INSTALLATION_TESTING=ON -DTribitsExProj_INSTALLATION_DIR=${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_TribitsExampleProject_ALL_ST_NoFortran_enable_installation_testing/install - TribitsExampleProject - ALWAYS_FAIL_ON_NONZERO_RETURN + ../TribitsExampleProject - TEST_7 + TEST_8 MESSAGE "Build 'all' target" - WORKING_DIRECTORY BUILD_TESTS + WORKING_DIRECTORY BUILD_TESTS/BUILD SKIP_CLEAN_WORKING_DIRECTORY CMND make ARGS ${CTEST_BUILD_FLAGS} - ALWAYS_FAIL_ON_NONZERO_RETURN - TEST_8 + TEST_9 MESSAGE "Run all the tests with ctest" - WORKING_DIRECTORY BUILD_TESTS + WORKING_DIRECTORY BUILD_TESTS/BUILD SKIP_CLEAN_WORKING_DIRECTORY CMND ${CMAKE_CTEST_COMMAND} PASS_REGULAR_EXPRESSION_ALL @@ -1082,14 +1076,20 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST_NoFortran_enable_install ) # NOTE: Above is a very strong test that ensures that the -# _ENABLE_INSTALLATION_TESTING option works as it should. This above -# test also shows the the installation of the non-Fortran packages in -# TribitsExampleProject works and is independent from the source and build -# trees. If you comment out the cmake options -# TribitsExProj_ENABLE_INSTALLATION_TESTING and TribitsExProj_INSTALLATION_DIR -# you will see that build of the project fails because we removed some source -# files that are needed. This proves that they are being used from the -# install tree! +# _ENABLE_INSTALLATION_TESTING option works as it should. It removes +# source files from the installation testing source tree which shows that +# those files are not being built. It also leaves the library header files +# but it breaks them to ensure that they do not get selected therefore include +# dirs from the soruce tree are not added. Since the include directories from +# the installed project are pulled in with -isystem, the -I for the local +# source tree would be searched first. Therefore, this test shows that those +# -I directories are not added to the compile lines. This above test also +# shows the installation of the non-Fortran packages in TribitsExampleProject +# works and is independent from the source and build trees. If you comment +# out the cmake options TribitsExProj_ENABLE_INSTALLATION_TESTING and +# TribitsExProj_INSTALLATION_DIR you will see that build of the project fails +# because we removed some source files that are needed. This proves that they +# are being used from the install tree! ######################################################################## diff --git a/test/core/ExamplesUnitTests/append_line_to_files.sh b/test/core/ExamplesUnitTests/append_line_to_files.sh new file mode 100755 index 000000000..3dea5a7a2 --- /dev/null +++ b/test/core/ExamplesUnitTests/append_line_to_files.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e +# +# Append a line to one or more files: +# +# append_line_to_files.sh ... + +LINE_TO_APPEND=$1 ; shift + +for file in $@ ; do + echo "Appending '$LINE_TO_APPEND' to file '${file}'" + echo "$LINE_TO_APPEND" >> $file +done diff --git a/tribits/examples/TribitsExampleProject/CMakeLists.txt b/tribits/examples/TribitsExampleProject/CMakeLists.txt index a44121b80..f413d381b 100644 --- a/tribits/examples/TribitsExampleProject/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/CMakeLists.txt @@ -27,6 +27,8 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/ProjectName.cmake") # not in an include file :-( project(${PROJECT_NAME} NONE) +set(TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE TRUE) + # # B) Pull in the TriBITS system and execute # From d4f9a27795f0802ce8d959cd71f8df7e28fc7f6c Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Thu, 15 Dec 2022 10:31:11 -0700 Subject: [PATCH 08/10] Remove unused module CMakeOverrides.cmake (#429) The file CMakeOverrides.cmake contained tribits_include_directories() and the (terrible) override of include_directories(). It is unclear from TriBITS git history when the mdoule TribitsIncludeDirectories.cmake and why CMakeOverrides.cmake was not deleted but there are no current includes of the module "CMakeOverrides" in TriBITS anywhere. It appears that the include of the module CMakeOverrides.cmake was removed 9 years ago and replaced with the include of TribitsIncludeDirectories.cmake way back in the commit: cd8e3e82 "Moving TriBITS-specific funtion into tribits/package_arch/" Author: Roscoe A. Bartlett Date: Mon Mar 10 16:21:51 2014 -0400 (9 years ago) So nice to get rid of dead code! --- tribits/core/utils/CMakeOverrides.cmake | 117 ------------------------ 1 file changed, 117 deletions(-) delete mode 100644 tribits/core/utils/CMakeOverrides.cmake diff --git a/tribits/core/utils/CMakeOverrides.cmake b/tribits/core/utils/CMakeOverrides.cmake deleted file mode 100644 index 1c95ecfdb..000000000 --- a/tribits/core/utils/CMakeOverrides.cmake +++ /dev/null @@ -1,117 +0,0 @@ -# @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(CMakeParseArguments) - -# -# FUNCTION: tribits_include_directories() -# - -# This function is to override the standard behavior of include_directories -# for a TriBITS package. - -# Usage:: -# -# tribits_include_directories( -# [REQUIRED_DURING_INSTALLATION_TESTING] ... -# ) -# -# If specified, ``REQUIRED_DURING_INSTALLATION_TESTING`` can appear anywhere -# in the argument list. -# -# This function allows overriding the default behavior for installation -# testing, to ensure that include directories will not be inadvertently added -# to the build lines for tests during installation testing. Normally we want -# the include directories to be handled as cmake usually does. However during -# TriBITS installation testing we do not want most of the include directories -# to be used as the majority of the files should come from the installation we -# are building against. There is 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(tribits_include_directories) - cmake_parse_arguments( - #prefix - PARSE - #Options - "REQUIRED_DURING_INSTALLATION_TESTING" - #one_value_keywords - "" - #multi_value_keywords - "" - ${ARGN} - ) - - 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() - -#This function is to override the standard behavior of include_directories. -# We are overriding the default behavior for installation testing, this allows -#us to ensure that include directories will not be inadvertently added to the -#build lines for tests during installation testing. Normally we want the include -#directories to be handled as cmake usually does.However during installation -#testing we do not want most of the include directories to be used as the majority -#of the files should come from the installation we are building against. There is -#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( - #prefix - PARSE - #Options - "REQUIRED_DURING_INSTALLATION_TESTING" - #one_value_keywords - "" - #multi_value_keywords - "" - ${ARGN} - ) - - 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() From e7d1e2f517150355fd9c3fb45ef6e078b7def9b2 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Thu, 15 Dec 2022 10:48:09 -0700 Subject: [PATCH 09/10] Replace include_directories() with tribits_include_directories() (#429) This makes the code work correctly when TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE=TRUE is set (which I also set in the project TribitsExampleProject2). This change was made by running the script replace_include_directories_r.sh in the subdirs: test/core/ tribits/examples/ This change makes the install test pass again. --- .../a/CMakeLists.txt | 2 +- .../b/src/CMakeLists.txt | 4 ++-- .../PkgWithUserErrors/CMakeLists.txt | 16 ++++++++-------- tribits/examples/InsertedPkg/CMakeLists.txt | 2 +- .../shared_only/CMakeLists.txt | 2 +- .../static_only/CMakeLists.txt | 2 +- tribits/examples/TargetDefinesPkg/CMakeLists.txt | 2 +- .../packages/mixed_lang/src/CMakeLists.txt | 4 ++-- .../packages/simple_cxx/src/CMakeLists.txt | 4 ++-- .../packages/with_subpackages/a/CMakeLists.txt | 4 ++-- .../with_subpackages/b/src/CMakeLists.txt | 6 +++--- .../b/tests/testlib/CMakeLists.txt | 2 +- .../packages/with_subpackages/c/CMakeLists.txt | 2 +- .../packages/wrap_external/CMakeLists.txt | 2 +- .../TribitsExampleProject2/CMakeLists.txt | 1 + .../packages/package1/src/CMakeLists.txt | 2 +- .../packages/package2/src/CMakeLists.txt | 4 ++-- .../packages/package3/src/CMakeLists.txt | 4 ++-- .../packages/addon1/src/CMakeLists.txt | 2 +- 19 files changed, 34 insertions(+), 33 deletions(-) diff --git a/test/core/ExamplesUnitTests/PkgWithSubpkgsWithUserErrors/a/CMakeLists.txt b/test/core/ExamplesUnitTests/PkgWithSubpkgsWithUserErrors/a/CMakeLists.txt index f4b31f89d..667023bcf 100644 --- a/test/core/ExamplesUnitTests/PkgWithSubpkgsWithUserErrors/a/CMakeLists.txt +++ b/test/core/ExamplesUnitTests/PkgWithSubpkgsWithUserErrors/a/CMakeLists.txt @@ -19,7 +19,7 @@ if(NOT subpackageA_turn_off_passing_call_order) # C) Add the libraries, tests, and examples # - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library(pwswue_a SOURCES A.cpp HEADERS A.hpp diff --git a/test/core/ExamplesUnitTests/PkgWithSubpkgsWithUserErrors/b/src/CMakeLists.txt b/test/core/ExamplesUnitTests/PkgWithSubpkgsWithUserErrors/b/src/CMakeLists.txt index ff32a2c44..371815171 100644 --- a/test/core/ExamplesUnitTests/PkgWithSubpkgsWithUserErrors/b/src/CMakeLists.txt +++ b/test/core/ExamplesUnitTests/PkgWithSubpkgsWithUserErrors/b/src/CMakeLists.txt @@ -1,6 +1,6 @@ -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +tribits_include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library(pwswue_b SOURCES B.cpp HEADERS B.hpp diff --git a/test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt b/test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt index 8743fee86..bc3222d05 100644 --- a/test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt +++ b/test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt @@ -4,7 +4,7 @@ ############################################################### if(NOT ${PACKAGE_NAME}_turn_off_passing_call_order) tribits_package(PkgWithUserErrors) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library( pkgwithusererrors HEADERS PkgWithUserErrorsLib.hpp @@ -21,7 +21,7 @@ endif() if(${PACKAGE_NAME}_no_POSTPROCESS_call) message("User forgets to call TRIBITS_PACKAGE_POSTPROCESS") tribits_package(PkgWithUserErrors) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library( pkgwithusererrors HEADERS PkgWithUserErrorsLib.hpp @@ -36,7 +36,7 @@ endif() ############################################################### if(${PACKAGE_NAME}_ADD_LIBRARY_with_no_package_init) message("") - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library( pkgwithusererrors HEADERS PkgWithUserErrorsLib.hpp @@ -52,7 +52,7 @@ endif() ############################################################### if(${PACKAGE_NAME}_ADD_EXECUTABLE_with_no_package_init) message("User forgets to call TRIBITS_PACKAGE before adding exe") - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_executable( usererrorexec SOURCES PkgWithUserErrorsEX.cpp @@ -88,7 +88,7 @@ endif() if(${PACKAGE_NAME}_ADD_LIBRARY_after_POSTPROCESS) message("adding a library after POSTPROCESS") tribits_package(PkgWithUserErrors) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_package_postprocess() tribits_add_library( pkgwithusererrors @@ -104,7 +104,7 @@ endif() if(${PACKAGE_NAME}_ADD_EXECUTABLE_after_POSTPROCESS) message("adding an exe after POSTPROCESS") tribits_package(PkgWithUserErrors) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_package_postprocess() tribits_add_executable( usererrorexec @@ -130,7 +130,7 @@ endif() if(${PACKAGE_NAME}_UNPARSED_ARGUMENTS_ADD_LIBRARY) message("unparsed arguments in ADD_LIBRARY") tribits_package(PkgWithUserErrors) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) message("building library") tribits_add_library( pkgwithusererrors @@ -149,7 +149,7 @@ endif() if(${PACKAGE_NAME}_UNPARSED_ARGUMENTS_ADD_EXECUTABLE) message("unparsed arguments in ADD_EXECUTABLE") tribits_package(PkgWithUserErrors) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) message("building executable") tribits_add_executable( usererrorexec diff --git a/tribits/examples/InsertedPkg/CMakeLists.txt b/tribits/examples/InsertedPkg/CMakeLists.txt index 595541621..7df9c56e8 100644 --- a/tribits/examples/InsertedPkg/CMakeLists.txt +++ b/tribits/examples/InsertedPkg/CMakeLists.txt @@ -1,6 +1,6 @@ tribits_package(InsertedPkg) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library( externalpkg diff --git a/tribits/examples/MixedSharedStaticLibs/shared_only/CMakeLists.txt b/tribits/examples/MixedSharedStaticLibs/shared_only/CMakeLists.txt index 5a4746eda..7cec4e8ca 100644 --- a/tribits/examples/MixedSharedStaticLibs/shared_only/CMakeLists.txt +++ b/tribits/examples/MixedSharedStaticLibs/shared_only/CMakeLists.txt @@ -1,6 +1,6 @@ tribits_subpackage(SharedOnly) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library( shared_only_lib diff --git a/tribits/examples/MixedSharedStaticLibs/static_only/CMakeLists.txt b/tribits/examples/MixedSharedStaticLibs/static_only/CMakeLists.txt index 62e8bddd8..7df259489 100644 --- a/tribits/examples/MixedSharedStaticLibs/static_only/CMakeLists.txt +++ b/tribits/examples/MixedSharedStaticLibs/static_only/CMakeLists.txt @@ -1,6 +1,6 @@ tribits_subpackage(StaticOnly) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library( static_only_lib diff --git a/tribits/examples/TargetDefinesPkg/CMakeLists.txt b/tribits/examples/TargetDefinesPkg/CMakeLists.txt index 4ca9cd0fa..0952d5736 100644 --- a/tribits/examples/TargetDefinesPkg/CMakeLists.txt +++ b/tribits/examples/TargetDefinesPkg/CMakeLists.txt @@ -1,6 +1,6 @@ tribits_package(TargetDefinesPkg) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library( targetdefinespkg diff --git a/tribits/examples/TribitsExampleProject/packages/mixed_lang/src/CMakeLists.txt b/tribits/examples/TribitsExampleProject/packages/mixed_lang/src/CMakeLists.txt index a8d33b430..ddbeb6658 100644 --- a/tribits/examples/TribitsExampleProject/packages/mixed_lang/src/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/packages/mixed_lang/src/CMakeLists.txt @@ -4,12 +4,12 @@ tribits_configure_file(${PACKAGE_NAME}_config.h) set(HEADERS "") set(SOURCES "") -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +tribits_include_directories(${CMAKE_CURRENT_BINARY_DIR}) append_set(HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) append_set(HEADERS MixedLang.hpp Ray_Tracer.hh diff --git a/tribits/examples/TribitsExampleProject/packages/simple_cxx/src/CMakeLists.txt b/tribits/examples/TribitsExampleProject/packages/simple_cxx/src/CMakeLists.txt index d00de0da8..234a196d5 100644 --- a/tribits/examples/TribitsExampleProject/packages/simple_cxx/src/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/packages/simple_cxx/src/CMakeLists.txt @@ -11,12 +11,12 @@ tribits_configure_file(${PACKAGE_NAME}_config.h) set(HEADERS "") set(SOURCES "") -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +tribits_include_directories(${CMAKE_CURRENT_BINARY_DIR}) append_set(HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) append_set(HEADERS SimpleCxx_HelloWorld.hpp ) diff --git a/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt b/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt index e7cdf9cf6..9de350b0a 100644 --- a/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt @@ -16,9 +16,9 @@ tribits_pkg_export_cache_var(${PACKAGE_NAME}_SPECIAL_VALUE) tribits_configure_file(${PACKAGE_NAME}_config.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +tribits_include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library(pws_a SOURCES A.cpp HEADERS A.hpp ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h diff --git a/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/src/CMakeLists.txt b/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/src/CMakeLists.txt index cde554625..0f64659a5 100644 --- a/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/src/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/src/CMakeLists.txt @@ -1,10 +1,10 @@ tribits_configure_file(${PACKAGE_NAME}_config.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +tribits_include_directories(${CMAKE_CURRENT_BINARY_DIR}) include(${CMAKE_CURRENT_LIST_DIR}/ShowLibErrors.cmake) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_BINARY_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library(pws_b SOURCES B.cpp HEADERS B.hpp ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h diff --git a/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/tests/testlib/CMakeLists.txt b/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/tests/testlib/CMakeLists.txt index 407fc6a27..215659e60 100644 --- a/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/tests/testlib/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/tests/testlib/CMakeLists.txt @@ -1,6 +1,6 @@ # Define the include dirs for the TESTONLY lib. -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) # # Create a test-only b_mixed_lang lib which uses the optional test dependent diff --git a/tribits/examples/TribitsExampleProject/packages/with_subpackages/c/CMakeLists.txt b/tribits/examples/TribitsExampleProject/packages/with_subpackages/c/CMakeLists.txt index 475912fac..696a5815c 100644 --- a/tribits/examples/TribitsExampleProject/packages/with_subpackages/c/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/packages/with_subpackages/c/CMakeLists.txt @@ -7,7 +7,7 @@ tribits_add_executable( c_util include(${CMAKE_CURRENT_LIST_DIR}/ShowLibErrors.cmake) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library(pws_c SOURCES C.cpp HEADERS wsp_c/C.hpp diff --git a/tribits/examples/TribitsExampleProject/packages/wrap_external/CMakeLists.txt b/tribits/examples/TribitsExampleProject/packages/wrap_external/CMakeLists.txt index 3adfc2cdb..0efcd994f 100644 --- a/tribits/examples/TribitsExampleProject/packages/wrap_external/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/packages/wrap_external/CMakeLists.txt @@ -145,7 +145,7 @@ add_dependencies(build_external_func pws_a) append_set(${PACKAGE_NAME}_LIB_TARGETS external_func) global_set(${PACKAGE_NAME}_LIBRARIES external_func pws_a) global_set(${PACKAGE_NAME}_HAS_NATIVE_LIBRARIES ON) -include_directories(${EXTERNAL_FUNC_SOURCE_DIR}) +tribits_include_directories(${EXTERNAL_FUNC_SOURCE_DIR}) # NOTE: Above, you have to add the upstream dependent libraries to the current # package's list of libraries because you can't link to an importing lib with # link_target_libraries() :-( diff --git a/tribits/examples/TribitsExampleProject2/CMakeLists.txt b/tribits/examples/TribitsExampleProject2/CMakeLists.txt index 661cb556e..8e63bc40e 100644 --- a/tribits/examples/TribitsExampleProject2/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject2/CMakeLists.txt @@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 3.17.0 FATAL_ERROR) include("${CMAKE_CURRENT_SOURCE_DIR}/ProjectName.cmake") project(${PROJECT_NAME} LANGUAGES NONE) +set(TRIBITS_HIDE_DEPRECATED_INCLUDE_DIRECTORIES_OVERRIDE TRUE) set(${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." CACHE STRING "TriBITS base directory (default assumes in TriBITS source tree)") diff --git a/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt b/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt index a0d23199e..b74162bb2 100644 --- a/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt @@ -1,7 +1,7 @@ set(HEADERS "") set(SOURCES "") -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) append_set(HEADERS Package1.hpp diff --git a/tribits/examples/TribitsExampleProject2/packages/package2/src/CMakeLists.txt b/tribits/examples/TribitsExampleProject2/packages/package2/src/CMakeLists.txt index 1de2194cb..5f95a0ef0 100644 --- a/tribits/examples/TribitsExampleProject2/packages/package2/src/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject2/packages/package2/src/CMakeLists.txt @@ -2,9 +2,9 @@ set(HEADERS "") set(SOURCES "") tribits_configure_file(${PACKAGE_NAME}_config.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +tribits_include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) append_set(HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h diff --git a/tribits/examples/TribitsExampleProject2/packages/package3/src/CMakeLists.txt b/tribits/examples/TribitsExampleProject2/packages/package3/src/CMakeLists.txt index ffe0ecc60..8b36f56b9 100644 --- a/tribits/examples/TribitsExampleProject2/packages/package3/src/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject2/packages/package3/src/CMakeLists.txt @@ -2,9 +2,9 @@ set(HEADERS "") set(SOURCES "") tribits_configure_file(${PACKAGE_NAME}_config.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +tribits_include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) append_set(HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h diff --git a/tribits/examples/TribitsExampleProjectAddons/packages/addon1/src/CMakeLists.txt b/tribits/examples/TribitsExampleProjectAddons/packages/addon1/src/CMakeLists.txt index d4fffaa07..c890968cd 100644 --- a/tribits/examples/TribitsExampleProjectAddons/packages/addon1/src/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProjectAddons/packages/addon1/src/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) tribits_add_library(addon1 SOURCES Addon1.cpp HEADERS Addon1.hpp From 3cfe867c3d75c9e7709ffd1da736dd1d3d05f65a Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Thu, 15 Dec 2022 11:34:56 -0700 Subject: [PATCH 10/10] Suppress deprecation warnings for unit tests of deprecated functionality (#429) The only remaining deprecation warnings are for tests that run an grep the STDOUT for the deprecation warning text and test TriBITS_CTestDriver_TribitsExMetaProj_version_date that pulls in older versions of the repos (that still use include_directories()). In a later commit, I will update the snapshots of the TriBITS example repos to update the test TriBITS_CTestDriver_TribitsExMetaProj_version_date to make these deprecation warnings go away. --- test/core/TestingFunctionMacro_UnitTests.cmake | 5 ++++- test/core/TribitsAdjustPackageEnables_UnitTests.cmake | 5 ++++- ...itsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/core/TestingFunctionMacro_UnitTests.cmake b/test/core/TestingFunctionMacro_UnitTests.cmake index 56dcb63da..a4e632c07 100644 --- a/test/core/TestingFunctionMacro_UnitTests.cmake +++ b/test/core/TestingFunctionMacro_UnitTests.cmake @@ -94,9 +94,12 @@ include(AppendStringVar) function(unittest_append_string_var) message("\n***") - message("*** Testing append_string_var()") + message("*** Testing append_string_var() (deprecated)") message("***\n") + # Suppress deprecation warnings + set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE IGNORE) + message("append_string_var(): Testing simple concatenation") set(SOME_STRING_VAR "") append_string_var(SOME_STRING_VAR diff --git a/test/core/TribitsAdjustPackageEnables_UnitTests.cmake b/test/core/TribitsAdjustPackageEnables_UnitTests.cmake index 811333abf..b460f17de 100644 --- a/test/core/TribitsAdjustPackageEnables_UnitTests.cmake +++ b/test/core/TribitsAdjustPackageEnables_UnitTests.cmake @@ -379,6 +379,9 @@ function(unittest_enable_all_st_generate_export_deps_only_ex2package1_se_pkgs) message("*** Test generation of export dependencies only up to Ex2Package1 with deprecated var _GENERATE_EXPORT_FILES_FOR_ONLY_LISTED_SE_PACKAGES") message("***\n") + # Suppress deprecation warnings + set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE IGNORE) + # Debugging #set(${PROJECT_NAME}_VERBOSE_CONFIGURE ON) #set(${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES ON) @@ -387,7 +390,7 @@ function(unittest_enable_all_st_generate_export_deps_only_ex2package1_se_pkgs) set(${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE ON) set(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES ON) set(${PROJECT_NAME}_GENERATE_EXPORT_FILES_FOR_ONLY_LISTED_SE_PACKAGES - Ex2Package1 RTOp) + Ex2Package1 RTOp) # Deprecated! unittest_helper_read_and_process_packages() diff --git a/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake b/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake index 878459e52..f742ecbb4 100644 --- a/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake +++ b/test/core/TribitsReadAllProjectDepsFilesCreateDepsGraph_UnitTests.cmake @@ -195,6 +195,9 @@ function(unitest_tribits_set_ss_for_dev_mode_backward_compatible) message("*** Testing tribits_set_ss_for_dev_mode() backward compatibility") message("***\n") + # Suppress deprecation warnings + set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE IGNORE) + message("\nTest in dev mode, ST off ...") set(${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE ON) set(${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE OFF)