Skip to content

Commit

Permalink
Merge pull request TriBITSPub#553 from bartlettroscoe/429-deprecation-3
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlettroscoe authored Dec 20, 2022
2 parents 64309c9 + b0749b0 commit 5d37582
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 8 deletions.
26 changes: 26 additions & 0 deletions refactoring/replace_set_and_inc_dirs_r.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Run this in a subdir to replace all occurrences of SET_AND_INC_DIRS with
# TRIBITS_SET_AND_INC_DIRS (and lower-case versions). Take into account
# token boundaries so will not replace in the middle of a token.
#
# Run as:
#
# $ cd <some-base-dir>
# $ <this-script-dir>/replace_set_and_inc_dirs_r.sh
#

_SCRIPT_DIR=`echo $0 | sed "s/\(.*\)\/.*replace_set_and_inc_dirs_r.sh/\1/g"`
#echo $_SCRIPT_DIR

echo
echo "Replacing SET_AND_INC_DIRS with TRIBITS_SET_AND_INC_DIRS in all CMakeList.txt and *.cmake files ..."
echo

find . \( -name CMakeLists.txt -or -name "*.cmake" \) -exec ${_SCRIPT_DIR}/token-replace.py -t SET_AND_INC_DIRS -r TRIBITS_SET_AND_INC_DIRS -f {} \;

echo
echo "Replacing set_and_inc_dirs with tribits_set_and_inc_dirs in all CMakeList.txt and *.cmake files ..."
echo

find . \( -name CMakeLists.txt -or -name "*.cmake" \) -exec ${_SCRIPT_DIR}/token-replace.py -t set_and_inc_dirs -r tribits_set_and_inc_dirs -f {} \;
7 changes: 7 additions & 0 deletions tribits/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
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
Expand Down
2 changes: 1 addition & 1 deletion tribits/core/package_arch/TribitsAddLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ include(RemoveGlobalDuplicates)
include(TribitsGeneralMacros)
include(TribitsReportInvalidTribitsUsage)
include(TribitsDeprecatedHelpers)
include(SetAndIncDirs)
include(TribitsSetAndIncDirs)


# @FUNCTION: tribits_add_library()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(<dirVarName> <includeDir>)
# tribits_set_and_inc_dirs(<dirVarName> <includeDir>)
#
# On output, this sets ``<dirVarName>`` to ``<includeDir>`` in the local scope
# and calls ``include_directories(<includeDir>)``.
# and calls ``tribits_include_directories(<includeDir>)``.
#
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()
1 change: 1 addition & 0 deletions tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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() +
Expand Down
1 change: 0 additions & 1 deletion tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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() +
Expand Down

0 comments on commit 5d37582

Please sign in to comment.