Skip to content

Commit

Permalink
Use deprecated helpers in a number of places
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleFromKitware committed Nov 3, 2022
1 parent a4d32e6 commit c3394fc
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 33 deletions.
7 changes: 4 additions & 3 deletions tribits/core/package_arch/TribitsAddExecutable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ include(TribitsAddTestHelpers)
include(TribitsGeneralMacros)
include(TribitsLibIsTestOnly)
include(TribitsReportInvalidTribitsUsage)
include(TribitsDeprecatedHelpers)

include(PrintVar)
include(AppendSet)
Expand Down Expand Up @@ -374,7 +375,7 @@ function(tribits_add_executable EXE_NAME)
endif()

if (PARSE_DEFINES)
message(WARNING "WARNING: Passing extra defines through 'DEFINES' ${PARSE_DEFINES}"
tribits_deprecated("Passing extra defines through 'DEFINES' ${PARSE_DEFINES}"
" is deprecated. Instead, pass them through 'TARGET_DEFINES'. The 'DEFINES'"
" argument was incorrectly implemented by calling add_definitions() which has"
" directory scope and not function scope as was documented. This resulted in"
Expand Down Expand Up @@ -657,12 +658,12 @@ macro(tribits_add_executable_convert_from_deplibs)
set(prefixedDepLib "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${depLib}")
tribits_lib_is_testonly(${prefixedDepLib} depLibIsTestOnlyLib)
if (depLibIsTestOnlyLib)
message(WARNING "WARNING: Passing TESTONLY lib '${depLib}' through DEPLIBS"
tribits_deprecated("Passing TESTONLY lib '${depLib}' through DEPLIBS"
" is deprecated! Instead, please pass through TESTONLYLIBS instead!"
" DEPLIBS is deprecated!")
list(APPEND PARSE_TESTONLYLIBS ${depLib})
elseif (TARGET ${prefixedDepLib})
message(WARNING "WARNING: Passing non-TESTONLY lib '${depLib}' through DEPLIBS"
tribits_deprecated("Passing non-TESTONLY lib '${depLib}' through DEPLIBS"
" is deprecated! The library '${depLib}' appears to be a"
" library defined in this CMake project."
" TriBITS takes care of linking against libraries in dependent upstream"
Expand Down
5 changes: 5 additions & 0 deletions tribits/core/package_arch/TribitsAddExecutableAndTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

include(TribitsAddExecutable)
include(TribitsAddTest)
include(TribitsDeprecatedHelpers)


#
Expand Down Expand Up @@ -207,6 +208,10 @@ function(tribits_add_executable_and_test EXE_NAME)
# C) tribits_add_executable(...)
#

if (PARSE_DEPLIBS)
tribits_deprecated("DEPLIBS argument of tribits_add_executable_and_test() is deprecated.")
endif()

set(CALL_ARGS "")
tribits_fwd_parse_arg(CALL_ARGS SOURCES)
tribits_fwd_parse_arg(CALL_ARGS DEPLIBS) # Deprecated
Expand Down
9 changes: 5 additions & 4 deletions tribits/core/package_arch/TribitsAddLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ include(PrependGlobalSet)
include(RemoveGlobalDuplicates)
include(TribitsGeneralMacros)
include(TribitsReportInvalidTribitsUsage)
include(TribitsDeprecatedHelpers)
include(SetAndIncDirs)


Expand Down Expand Up @@ -670,7 +671,7 @@ function(tribits_add_library_assert_deplibs)
# dependency on the upstream package that owns this upstream TESTONLY
# library if it comes from an upstream package.
elseif (NOT PARSE_TESTONLY AND depLibIsTestOnlyLib) # any depLibAlreadyInPkgLibs
message(WARNING "WARNING: '${depLib}' in DEPLIBS is a TESTONLY lib"
tribits_deprecated("'${depLib}' in DEPLIBS is a TESTONLY lib"
" and it is illegal to link to this non-TESTONLY library '${LIBRARY_NAME}'."
" Such usage is deprecated (and this warning will soon become an error)!"
" If this is a regular library in this package or in an dependent upstream"
Expand All @@ -680,7 +681,7 @@ function(tribits_add_library_assert_deplibs)
" ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/Dependencies.cmake")
# ToDo: Turn the above to FATAL_ERROR after dropping deprecated code
elseif (NOT depLibAlreadyInPkgLibs AND TARGET ${prefixedDepLib}) # any PARSE_TESTONLY
message(WARNING "WARNING: '${depLib}' in DEPLIBS is not"
tribits_deprecated("'${depLib}' in DEPLIBS is not"
" a lib in this package but is a library defined in the current"
" cmake project! Such usage is deprecated (and"
" will result in a configure error soon). If this is a library in"
Expand All @@ -691,7 +692,7 @@ function(tribits_add_library_assert_deplibs)
" this package's dependencies file"
" ${${PACKAGE_NAME}_SOURCE_DIR}/cmake/Dependencies.cmake.")
elseif (NOT depLibAlreadyInPkgLibs AND NOT TARGET ${prefixedDepLib} )
message(WARNING "WARNING: '${depLib}' in DEPLIBS is not"
tribits_deprecated("'${depLib}' in DEPLIBS is not"
" a lib defined in the current cmake project! Such usage is deprecated (and"
" will result in a configure error soon). If this is an external"
" lib you are trying to link in, it should likely be handled as a TriBITS"
Expand Down Expand Up @@ -725,7 +726,7 @@ function(tribits_add_library_assert_importedlibs)
FOUND_IMPORTEDLIB_IN_LIBRARIES_IDX)
tribits_lib_is_testonly(${prefixedImportedLib} importedLibIsTestOnlyLib)
if (importedLibIsTestOnlyLib)
message(WARNING "WARNING: '${importedLib}' in IMPORTEDLIBS is a TESTONLY lib"
tribits_deprecated("'${importedLib}' in IMPORTEDLIBS is a TESTONLY lib"
" and it is illegal to pass in through IMPORTEDLIBS!"
" Such usage is deprecated (and this warning will soon become an error)!"
" Should '${importedLib}' instead be passed through DEPLIBS?")
Expand Down
6 changes: 3 additions & 3 deletions tribits/core/package_arch/TribitsGeneralMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ include(AssertDefined)
include(MessageWrapper)
include(TribitsParseArgumentsHelpers)
include(TribitsSortListAccordingToMasterList)
include(TribitsDeprecatedHelpers)


# Optionally start CMake code configure timing
Expand Down Expand Up @@ -337,9 +338,8 @@ endfunction()

# For backward compatibility
macro(tribits_set_ss_for_dev_mode OUTPUT_VAR)
message(WARNING
"WARNING: tribits_set_ss_for_dev_mode() is deprecated,"
" use tribits_set_st_for_dev_mode() instead!")
tribits_deprecated_command(tribits_set_ss_for_dev_mode
MESSAGE "Use tribits_set_st_for_dev_mode() instead.")
tribits_set_st_for_dev_mode(${OUTPUT_VAR})
endmacro()

Expand Down
12 changes: 6 additions & 6 deletions tribits/core/package_arch/TribitsIncludeDirectories.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# @HEADER

include(CMakeParseArguments)
include(TribitsDeprecatedHelpers)


# @MACRO: tribits_include_directories()
Expand Down Expand Up @@ -89,7 +90,11 @@ endmacro()
# Deprecated. Use tribits_include_directories() instead!
macro(include_directories)

cmake_parse_arguments(
tribits_deprecated_command(include_directories
MESSAGE "Use tribits_include_directories() instead."
)

cmake_parse_arguments(
#prefix
PARSE
#options
Expand All @@ -101,11 +106,6 @@ macro(include_directories)
${ARGN}
)

# if (PARSE_REQUIRED_DURING_INSTALLATION_TESTING)
# message(WARNING "Warning: the override include_directories() is deprecated,"
# " use tribits_include_directories() instead!")
# endif()

if(NOT ${PROJECT_NAME}_ENABLE_INSTALLATION_TESTING OR PARSE_REQUIRED_DURING_INSTALLATION_TESTING)
_include_directories(${PARSE_UNPARSED_ARGUMENTS})
endif()
Expand Down
11 changes: 6 additions & 5 deletions tribits/core/package_arch/TribitsListHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@


include(TribitsHostType)
include(TribitsDeprecatedHelpers)


#
Expand Down Expand Up @@ -120,8 +121,8 @@ endmacro()


macro( package_disable_on_platforms PACKAGE_NAME_IN_ )
message(WARNING "package_disable_on_platforms() is deprecated!"
" Use tribits_disable_package_on_platforms() instead!")
tribits_deprecated_command(package_disable_on_platforms
MESSAGE "Use tribits_disable_package_on_platforms() instead!")
tribits_disable_package_on_platforms(${PACKAGE_NAME_IN_} ${ARGN})
endmacro()

Expand All @@ -136,19 +137,19 @@ function(tribits_update_ps_pt_ss_st THING_TYPE THING_NAME TESTGROUP_VAR)

if (TESTGROUP_IN STREQUAL PS)
if (${PROJECT_NAME}_VERBOSE_CONFIGURE)
message("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'PS' is deprecated."
tribits_deprecated("${THING_TYPE} ${THING_NAME} TESTGROUP 'PS' is deprecated."
" Use 'PT' instead!")
endif()
set(TESTGROUP_OUT PT)
elseif (TESTGROUP_IN STREQUAL SS)
if (${PROJECT_NAME}_VERBOSE_CONFIGURE)
message("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'SS' is deprecated."
tribits_deprecated("${THING_TYPE} ${THING_NAME} TESTGROUP 'SS' is deprecated."
" Use 'ST' instead!")
endif()
set(TESTGROUP_OUT ST)
elseif (TESTGROUP_IN STREQUAL TS)
if (${PROJECT_NAME}_VERBOSE_CONFIGURE)
message("-- " "WARNING: ${THING_TYPE} ${THING_NAME} TESTGROUP 'TS' is deprecated."
tribits_deprecated("${THING_TYPE} ${THING_NAME} TESTGROUP 'TS' is deprecated."
" Use 'TT' instead!")
endif()
set(TESTGROUP_OUT TT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
# ************************************************************************
# @HEADER

include(TribitsDeprecatedHelpers)


# Function that creates enable-only dependency data-structures
#
Expand All @@ -63,8 +65,8 @@ function(tribits_set_up_enabled_only_dependencies)
AND NOT
"${${PROJECT_NAME}_GENERATE_EXPORT_FILES_FOR_ONLY_LISTED_SE_PACKAGES}" STREQUAL ""
)
message(DEPRECATION
"WARNING! The cache var"
tribits_deprecated(
"The cache var"
" ${PROJECT_NAME}_GENERATE_EXPORT_FILES_FOR_ONLY_LISTED_SE_PACKAGES"
"='${${PROJECT_NAME}_GENERATE_EXPORT_FILES_FOR_ONLY_LISTED_SE_PACKAGES}'"
" is deprecated! Please instead set"
Expand Down
3 changes: 2 additions & 1 deletion tribits/core/package_arch/TribitsTestCategories.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
include(FindListElement)
include(MessageWrapper)
include(Join)
include(TribitsDeprecatedHelpers)


# Define the valid categories that will be recognized in the CATEGORIES keyword
Expand Down Expand Up @@ -97,7 +98,7 @@ function(tribits_filter_and_assert_categories CATEGORIES_VAR_INOUT)
set(CATEGORIES_OUT)
foreach(CATEGORY ${${CATEGORIES_VAR_INOUT}})
if (CATEGORY STREQUAL "WEEKLY")
message_wrapper(WARNING "Warning: The test category 'WEEKLY' is deprecated"
tribits_deprecated("The test category 'WEEKLY' is deprecated"
" and is replaced with 'HEAVY'. Please change to use 'HEAVY' instead.")
list(APPEND CATEGORIES_OUT "HEAVY")
else()
Expand Down
7 changes: 4 additions & 3 deletions tribits/core/package_arch/TribitsTplDeclareLibraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
# @HEADER

include(TribitsTplFindIncludeDirsAndLibraries)
include(TribitsDeprecatedHelpers)

function(tribits_tpl_declare_libraries TPL_NAME)
message(WARNING
"WARNING: tribits_tpl_declare_libraries() is deprecated, instead use"
" tribits_tpl_find_include_dirs_and_libraries()!"
tribits_deprecated_command(tribits_tpl_declare_libraries
MESSAGE
"Use tribits_tpl_find_include_dirs_and_libraries() instead."
" Make this change in the file:\n"
" ${${TPL_NAME}_FINDMOD}\n"
"which is pointed to by the file:\n"
Expand Down
3 changes: 3 additions & 0 deletions tribits/core/utils/AppendStringVar.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

include(ConcatStrings)
include(PrintVar)
include(TribitsDeprecatedHelpers)


# @FUNCTION: append_string_var()
Expand All @@ -60,6 +61,8 @@ include(PrintVar)
# string(APPEND <stringVar> "<string1>" "<string2>" ...)
#
function(append_string_var STRING_VAR_OUT)
tribits_deprecated_command(append_string_var
MESSAGE "Use string(APPEND) instead.")
#message("APPEND_STRING_VAR: ${STRING_VAR_OUT} {${ARGN}}")
concat_strings( STRING_VAR "${${STRING_VAR_OUT}}" ${ARGN} )
#print_var( STRING_VAR )
Expand Down
10 changes: 4 additions & 6 deletions tribits/core/utils/ParseVariableArguments.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@
# ************************************************************************
# @HEADER

# Set up to use cmake_parse_arguments() function!
include(CMakeParseArguments)
# NOTE: For CMake versions 3.5.0 and above, this module is empty so the
# natively implemented function cmake_parse_arguments() will get used!
include(TribitsDeprecatedHelpers)


macro(parse_arguments_deprecated_warning)
message(DEPRECATION "parse_arguments() is deprecated and should not be used."
" Instead use cmake_parse_arguments()")
tribits_deprecated_command(parse_arguments
MESSAGE "Use cmake_parse_arguments() instead.")
endmacro()

parse_arguments_deprecated_warning()
Expand Down

0 comments on commit c3394fc

Please sign in to comment.