Do not warn if just def'ed HAVE_ vars are set to 1
Some configuration scripts probe and just set HAVE_FOO without any values, whereas others set it explicitly to 1. If these two are mixed, for instance that the same package is used by two of our prerequisites, but in different manner, then we get compatibility warnings when we try to run the configuration script, even though there is no real conflict. dune-fem, dune-alugrid and dune-localfunctions have this problem (around release 2018.04). This patch special-code the test so if the old value was previously either just defined or explicitly set to the value 1, a warning will not be issued if then suddenly the other variant is used.
This commit is contained in:
parent
5fb0c91c05
commit
d847e10d96
@ -78,7 +78,17 @@ function (configure_vars obj syntax filename verb)
|
||||
# write a CMake statements that warns if the value has changed
|
||||
if ("${syntax}" STREQUAL "CMAKE")
|
||||
set (_db "\${") # to avoid parsing problems
|
||||
file (APPEND "${filename}" "if (DEFINED ${_var} AND NOT \"${_db}${_var}}\" STREQUAL \"${${_var}}\")\n")
|
||||
# special case: if we have a truth variable HAVE_ and this is
|
||||
# either just defined (as is), or set to 1 explicitly, then both
|
||||
# of these count as "true", so put in a check that also accepts
|
||||
# both of these values.
|
||||
if (("${_var}" MATCHES "^HAVE_.*") AND
|
||||
(("${${_var}}" STREQUAL "") OR ("${${_var}}" STREQUAL "1")))
|
||||
set (_cond "(\"${_db}${_var}}\" STREQUAL \"\") OR (\"${_db}${_var}}\" STREQUAL \"1\")")
|
||||
else ()
|
||||
set (_cond "\"${_db}${_var}}\" STREQUAL \"${${_var}}\"")
|
||||
endif ()
|
||||
file (APPEND "${filename}" "if (DEFINED ${_var} AND NOT (${_cond}))\n")
|
||||
file (APPEND "${filename}" "\tmessage (WARNING \"Incompatible value \\\"${_db}${_var}}\\\" of variable \\\"${_var}\\\"\")\n")
|
||||
file (APPEND "${filename}" "endif ()\n")
|
||||
endif ()
|
||||
|
Loading…
Reference in New Issue
Block a user