Strings must contain ONLY numbers to be integers

The old pattern matched if there was an integer (digit) in the string;
it would have to be all non-digits to be quoted.
This commit is contained in:
Roland Kaufmann 2013-05-22 11:51:58 +02:00
parent 6757860aac
commit 2183a243cb

View File

@ -89,11 +89,11 @@ function (configure_vars obj syntax filename verb)
# integer variables (specifically 0 and 1) are written as they are,
# whereas everything else (including version numbers, which could
# be interpreted as floats) are quoted as strings
if (${_var} MATCHES "[0-9]+")
if (${_var} MATCHES "^[0-9]+$")
set (_quoted "${${_var}}")
else (${_var} MATCHES "[0-9]+")
else (${_var} MATCHES "^[0-9]+$")
set (_quoted "\"${${_var}}\"")
endif (${_var} MATCHES "[0-9]+")
endif (${_var} MATCHES "^[0-9]+$")
# write to file using the correct syntax
if ("${syntax}" STREQUAL "CMAKE")