From 075e2a7b4b0d6ba7c5ba1ea7d0e1793caf55784e Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Tue, 20 Dec 2022 10:33:38 -0700 Subject: [PATCH] Automatic snapshot commit from tribits at b0749b08 Origin repo remote tracking branch: 'github/master' Origin repo remote repo URL: 'github = git@github.com:TriBITSPub/TriBITS.git' Git describe: Vera4.0-RC1-start-1416-g5d375826 At commit: commit b0749b08964ba9133f200b331e5b8d104f0d3588 Author: Roscoe A. Bartlett Date: Tue Dec 20 07:06:40 2022 -0700 Summary: Add replace_set_and_inc_dirs_r.sh and CHANGLOG entry (#429) --- cmake/tribits/CHANGELOG.md | 26 ++++ .../core/package_arch/TribitsAddLibrary.cmake | 2 +- .../package_arch/TribitsGlobalMacros.cmake | 6 +- .../TribitsIncludeDirectories.cmake | 38 ++++-- .../TribitsSetAndIncDirs.cmake} | 22 +++- cmake/tribits/core/utils/CMakeOverrides.cmake | 117 ------------------ .../core/utils/TribitsDeprecatedHelpers.cmake | 44 ++++--- .../build_ref/TribitsBuildReferenceBody.rst | 20 +++ .../guides/TribitsCoreDetailedReference.rst | 14 +++ .../TribitsMacroFunctionDocTemplate.rst | 1 + .../guides/UtilsMacroFunctionDocTemplate.rst | 1 - .../examples/InsertedPkg/CMakeLists.txt | 2 +- .../shared_only/CMakeLists.txt | 2 +- .../static_only/CMakeLists.txt | 2 +- .../examples/TargetDefinesPkg/CMakeLists.txt | 2 +- .../TribitsExampleProject/CMakeLists.txt | 2 + .../packages/mixed_lang/src/CMakeLists.txt | 4 +- .../packages/simple_cxx/src/CMakeLists.txt | 4 +- .../packages/simple_cxx/test/CMakeLists.txt | 3 + .../test/SimpleCxx_HelloWorld_Tests.cpp | 7 +- .../test/inc/SimpleCxx_HelloWorld_Tests.hpp | 10 ++ .../with_subpackages/a/CMakeLists.txt | 4 +- .../with_subpackages/b/src/CMakeLists.txt | 6 +- .../b/tests/testlib/CMakeLists.txt | 2 +- .../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 +- 31 files changed, 174 insertions(+), 184 deletions(-) rename cmake/tribits/core/{utils/SetAndIncDirs.cmake => package_arch/TribitsSetAndIncDirs.cmake} (76%) delete mode 100644 cmake/tribits/core/utils/CMakeOverrides.cmake create mode 100644 cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/inc/SimpleCxx_HelloWorld_Tests.hpp diff --git a/cmake/tribits/CHANGELOG.md b/cmake/tribits/CHANGELOG.md index 5b1147d3391e..c0ad93274308 100644 --- a/cmake/tribits/CHANGELOG.md +++ b/cmake/tribits/CHANGELOG.md @@ -2,6 +2,32 @@ ChangeLog for TriBITS ---------------------------------------- +## 2022-12-20: + +* **Deprecated:** The macro `set_and_inc_dirs()` is deprecated and replaced by + `tribits_set_and_inc_dirs()`. Use the script + `TriBITS/refactoring/replace_set_and_inc_dirs_r.sh` to update + `CMakeLists.txt` files. + +## 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/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake b/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake index 6f7890a33689..30036149dbdc 100644 --- a/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake @@ -49,7 +49,7 @@ include(RemoveGlobalDuplicates) include(TribitsGeneralMacros) include(TribitsReportInvalidTribitsUsage) include(TribitsDeprecatedHelpers) -include(SetAndIncDirs) +include(TribitsSetAndIncDirs) # @FUNCTION: tribits_add_library() diff --git a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake index 283d81af78d2..7f452f338b7a 100644 --- a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/cmake/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/cmake/tribits/core/package_arch/TribitsIncludeDirectories.cmake b/cmake/tribits/core/package_arch/TribitsIncludeDirectories.cmake index f31da5dfb38b..e288094953e2 100644 --- a/cmake/tribits/core/package_arch/TribitsIncludeDirectories.cmake +++ b/cmake/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) diff --git a/cmake/tribits/core/utils/SetAndIncDirs.cmake b/cmake/tribits/core/package_arch/TribitsSetAndIncDirs.cmake similarity index 76% rename from cmake/tribits/core/utils/SetAndIncDirs.cmake rename to cmake/tribits/core/package_arch/TribitsSetAndIncDirs.cmake index 80d4f688c40b..55991e4fdb63 100644 --- a/cmake/tribits/core/utils/SetAndIncDirs.cmake +++ b/cmake/tribits/core/package_arch/TribitsSetAndIncDirs.cmake @@ -38,19 +38,29 @@ # @HEADER -# @MACRO: set_and_inc_dirs() +# @MACRO: tribits_set_and_inc_dirs() # -# Set a variable to an include directory and call ``include_directories()`` -# (removes boiler-plate code). +# Set a variable to an include directory and call +# `tribits_include_directories()`_ (removes boiler-plate code). # # Usage: # -# set_and_inc_dirs( ) +# tribits_set_and_inc_dirs( ) # # On output, this sets ```` to ```` in the local scope -# and calls ``include_directories()``. +# and calls ``tribits_include_directories()``. +# +macro(tribits_set_and_inc_dirs dirVarName includeDir) + set(${dirVarName} ${includeDir}) + tribits_include_directories(${${dirVarName}}) +endmacro() + + +# Deprecated! Use tribits_set_and_inc_dirs() instead! # macro(set_and_inc_dirs DIR_VAR_NAME INCLUDE_DIR) + tribits_deprecated_command(set_and_inc_dirs + MESSAGE "Use tribits_set_and_inc_dirs() instead." ) set(${DIR_VAR_NAME} ${INCLUDE_DIR}) - include_directories(${${DIR_VAR_NAME}}) + tribits_include_directories(${${DIR_VAR_NAME}}) endmacro() diff --git a/cmake/tribits/core/utils/CMakeOverrides.cmake b/cmake/tribits/core/utils/CMakeOverrides.cmake deleted file mode 100644 index 1c95ecfdb703..000000000000 --- a/cmake/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() diff --git a/cmake/tribits/core/utils/TribitsDeprecatedHelpers.cmake b/cmake/tribits/core/utils/TribitsDeprecatedHelpers.cmake index 4dec816bf8e1..0ae57138e050 100644 --- a/cmake/tribits/core/utils/TribitsDeprecatedHelpers.cmake +++ b/cmake/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/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index f71863a55821..07f0570a2b6f 100644 --- a/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/cmake/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/cmake/tribits/doc/guides/TribitsCoreDetailedReference.rst b/cmake/tribits/doc/guides/TribitsCoreDetailedReference.rst index e5ef0fa6625c..2cc0fb95e97d 100644 --- a/cmake/tribits/doc/guides/TribitsCoreDetailedReference.rst +++ b/cmake/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 ---------------------------- diff --git a/cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst b/cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst index c045c1962e54..c0916454df5b 100644 --- a/cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst +++ b/cmake/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst @@ -44,6 +44,7 @@ @MACRO: tribits_project_enable_all() + @MACRO: tribits_repository_define_packages() + @MACRO: tribits_repository_define_tpls() + +@MACRO: tribits_set_and_inc_dirs() + @FUNCTION: tribits_set_st_for_dev_mode() + @MACRO: tribits_subpackage() + @MACRO: tribits_subpackage_postprocess() + diff --git a/cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst b/cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst index d7d18c8d7e39..acc98214c162 100644 --- a/cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst +++ b/cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst @@ -31,7 +31,6 @@ @FUNCTION: print_var() + @FUNCTION: print_var_with_spaces() + @FUNCTION: remove_global_duplicates() + -@MACRO: set_and_inc_dirs() + @FUNCTION: set_cache_on_off_empty() + @MACRO: set_default() + @MACRO: set_default_and_from_env() + diff --git a/cmake/tribits/examples/InsertedPkg/CMakeLists.txt b/cmake/tribits/examples/InsertedPkg/CMakeLists.txt index 59554162100b..7df9c56e8157 100644 --- a/cmake/tribits/examples/InsertedPkg/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/MixedSharedStaticLibs/shared_only/CMakeLists.txt b/cmake/tribits/examples/MixedSharedStaticLibs/shared_only/CMakeLists.txt index 5a4746eda691..7cec4e8cad26 100644 --- a/cmake/tribits/examples/MixedSharedStaticLibs/shared_only/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/MixedSharedStaticLibs/static_only/CMakeLists.txt b/cmake/tribits/examples/MixedSharedStaticLibs/static_only/CMakeLists.txt index 62e8bddd8490..7df2594891a6 100644 --- a/cmake/tribits/examples/MixedSharedStaticLibs/static_only/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TargetDefinesPkg/CMakeLists.txt b/cmake/tribits/examples/TargetDefinesPkg/CMakeLists.txt index 4ca9cd0fa681..0952d5736ffd 100644 --- a/cmake/tribits/examples/TargetDefinesPkg/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/CMakeLists.txt index a44121b807fa..f413d381b010 100644 --- a/cmake/tribits/examples/TribitsExampleProject/CMakeLists.txt +++ b/cmake/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 # diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/mixed_lang/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/mixed_lang/src/CMakeLists.txt index a8d33b430650..ddbeb6658fe0 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/mixed_lang/src/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/src/CMakeLists.txt index d00de0da8757..234a196d5144 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/src/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/CMakeLists.txt index 4b39105c91bc..f553d4ef2bc9 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/SimpleCxx_HelloWorld_Tests.cpp b/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/SimpleCxx_HelloWorld_Tests.cpp index 575555ffbe59..85430c8cffea 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/SimpleCxx_HelloWorld_Tests.cpp +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/inc/SimpleCxx_HelloWorld_Tests.hpp b/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/test/inc/SimpleCxx_HelloWorld_Tests.hpp new file mode 100644 index 000000000000..78b70ccc3d89 --- /dev/null +++ b/cmake/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 diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt index e7cdf9cf6f63..9de350b0a25a 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/a/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/src/CMakeLists.txt index cde554625db3..0f64659a5c98 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/src/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/tests/testlib/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/tests/testlib/CMakeLists.txt index 407fc6a27fe7..215659e60f2b 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/b/tests/testlib/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/c/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/c/CMakeLists.txt index 475912fac4ab..696a5815c850 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/with_subpackages/c/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject/packages/wrap_external/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject/packages/wrap_external/CMakeLists.txt index 3adfc2cdb90b..0efcd994f721 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/wrap_external/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject2/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/CMakeLists.txt index 661cb556e0a0..8e63bc40e843 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt index a0d23199e246..b74162bb25ed 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject2/packages/package2/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package2/src/CMakeLists.txt index 1de2194cb03a..5f95a0ef0b9a 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package2/src/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProject2/packages/package3/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package3/src/CMakeLists.txt index ffe0ecc60d12..8b36f56b97af 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package3/src/CMakeLists.txt +++ b/cmake/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/cmake/tribits/examples/TribitsExampleProjectAddons/packages/addon1/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProjectAddons/packages/addon1/src/CMakeLists.txt index d4fffaa075b4..c890968cdb23 100644 --- a/cmake/tribits/examples/TribitsExampleProjectAddons/packages/addon1/src/CMakeLists.txt +++ b/cmake/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