summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomguy3 <dev@randomguy3.me.uk>2017-05-16 11:35:11 +0100
committerAndreas Schuh <andreas.schuh.84@gmail.com>2017-05-16 11:35:11 +0100
commit21c7bcd895ac296e5395503b590bc74ceb0520a8 (patch)
tree99243d9de3f2c71f5fdfff32779b877ef54b64fa
parent95ffb27c9c7496ede1409e042571054c70cb9519 (diff)
downloadgflags-21c7bcd895ac296e5395503b590bc74ceb0520a8.tar.gz
gflags-21c7bcd895ac296e5395503b590bc74ceb0520a8.tar.bz2
gflags-21c7bcd895ac296e5395503b590bc74ceb0520a8.zip
Fix CMake macro special variable usage (#216)
The argument-related variables in a macro body are not real variables, but special substitutions. They cannot be directly referred to by name, only expanded.
-rw-r--r--cmake/utils.cmake10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index c1e3ab9..d039e5c 100644
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -59,11 +59,13 @@ endmacro ()
# variable. When gflags is a subproject of another project (GFLAGS_IS_SUBPROJECT),
# the variable is not added to the CMake cache. Otherwise it is cached.
macro (gflags_define type varname docstring default)
- if (ARGC GREATER 5)
+ # note that ARGC must be expanded here, as it is not a "real" variable
+ # (see the CMake documentation for the macro command)
+ if ("${ARGC}" GREATER 5)
message (FATAL_ERROR "gflags_variable: Too many macro arguments")
endif ()
if (NOT DEFINED GFLAGS_${varname})
- if (GFLAGS_IS_SUBPROJECT AND ARGC EQUAL 5)
+ if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5)
set (GFLAGS_${varname} "${ARGV4}")
else ()
set (GFLAGS_${varname} "${default}")
@@ -83,7 +85,9 @@ endmacro ()
macro (gflags_property varname property value)
gflags_is_cached (_cached ${varname})
if (_cached)
- if (property STREQUAL ADVANCED)
+ # note that property must be expanded here, as it is not a "real" variable
+ # (see the CMake documentation for the macro command)
+ if ("${property}" STREQUAL "ADVANCED")
if (${value})
mark_as_advanced (FORCE ${varname})
else ()