Skip to content

Commit

Permalink
Merge removing the deprecated variable in CMake gko_rename_cache
Browse files Browse the repository at this point in the history
This makes sure the deprecation warnings caused by `gko_rename_cache` only appear once.

Related PR: #1471
  • Loading branch information
upsj authored Nov 28, 2023
2 parents 5591f99 + b16e069 commit f40f46d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmake/rename.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ macro(gko_rename_cache deprecated actual type doc_string)
message("actual ${actual} and deprecated ${deprecated}")
if("${${actual}}" STREQUAL "${${deprecated}}")
# They are the same, so only throw warning
message(WARNING "${deprecated} was deprecated, please only use ${actual} instead.")
message(WARNING "${deprecated} was deprecated, please only use ${actual} instead. We removed the old variable.")
unset(${deprecated} CACHE)
else()
# They are different
message(FATAL_ERROR "Both ${deprecated} and ${actual} were specified differently, please only use ${actual} instead.")
endif()
else()
# Only set `deprecated`, move it to `actual`.
message(WARNING "${deprecated} was deprecated, please use ${actual} instead. "
"We copy ${${deprecated}} to ${actual}")
"We copied ${${deprecated}} to ${actual} and removed the old variable.")
set(${actual} ${${deprecated}} CACHE ${type} "${doc_string}")
unset(${deprecated} CACHE)
endif()
endif()
endmacro()
endmacro()

0 comments on commit f40f46d

Please sign in to comment.