diff --git a/refactoring/replace_set_and_inc_dirs_r.sh b/refactoring/replace_set_and_inc_dirs_r.sh new file mode 100755 index 000000000..655107a15 --- /dev/null +++ b/refactoring/replace_set_and_inc_dirs_r.sh @@ -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 +# $ /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 {} \; diff --git a/tribits/CHANGELOG.md b/tribits/CHANGELOG.md index 0d122142a..c0ad93274 100644 --- a/tribits/CHANGELOG.md +++ b/tribits/CHANGELOG.md @@ -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 diff --git a/tribits/core/package_arch/TribitsAddLibrary.cmake b/tribits/core/package_arch/TribitsAddLibrary.cmake index 6f7890a33..30036149d 100644 --- a/tribits/core/package_arch/TribitsAddLibrary.cmake +++ b/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/tribits/core/utils/SetAndIncDirs.cmake b/tribits/core/package_arch/TribitsSetAndIncDirs.cmake similarity index 76% rename from tribits/core/utils/SetAndIncDirs.cmake rename to tribits/core/package_arch/TribitsSetAndIncDirs.cmake index 80d4f688c..55991e4fd 100644 --- a/tribits/core/utils/SetAndIncDirs.cmake +++ b/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/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst b/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst index c045c1962..c0916454d 100644 --- a/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst +++ b/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/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst b/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst index d7d18c8d7..acc98214c 100644 --- a/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst +++ b/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() +