SIRF-SuperBuild
SIRF-SuperBuild copied to clipboard
Macro RenameVariable does change default value and does not rename variable
The implementation of the macro RenameVariable does do 2 things:
- overrides the default value with the
OLDvalue ifOLDexists - does unset the
OLD - does NOT set the
NEWvariable
This is confusing as a default value should not get overridden. Also, the name suggests that the macro would rename an old variable with a new and set the default value if the old one isn't set and this is not what happens.
Probably something like this should do:
macro(RenameVariable OLD NEW DEFAULT_VAR)
if (DEFINED ${NEW})
message (WARNING "Great job, you are using the new variable name already! 100 SIRF points!")
else()
# NEW is not defined and we will define it with OLD if defined else with DEFAULT_VAR
if (DEFINED ${OLD})
message(WARNING "Obsolete use of ${OLD}. I have used its value to set ${NEW} (use that variable in future!)")
set(${NEW} ${${OLD}})
unset(${OLD} CACHE)
else()
message(WARNING "${NEW} variable is set to default: ${DEFAULT_VAR} ")
set(${NEW} ${${DEFAULT_VAR}})
endif()
endmacro()
Let's actually get rid of this function and break backward compatibility, which we will actually break anyway with the new SIRF version.
@KrisThielemans any opinion?
yes sure, get rid of it (put it in CHANGES.md)