fix: GFLAGS_* variables take precedence in gflags_define

This commit is contained in:
Andreas Schuh 2018-12-05 10:28:57 +00:00
parent 524b83d026
commit be65295633

View file

@ -65,16 +65,18 @@ macro (gflags_define type varname docstring default)
message (FATAL_ERROR "gflags_variable: Too many macro arguments")
endif ()
if (NOT DEFINED GFLAGS_${varname})
if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5)
set (GFLAGS_${varname} "${ARGV4}")
if (DEFINED ${varname})
set(GFLAGS_${varname} "${${varname}}")
else ()
set (GFLAGS_${varname} "${default}")
if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5)
set (GFLAGS_${varname} "${ARGV4}")
else ()
set (GFLAGS_${varname} "${default}")
endif ()
endif ()
endif ()
if (GFLAGS_IS_SUBPROJECT)
if (NOT DEFINED ${varname})
set (${varname} "${GFLAGS_${varname}}")
endif ()
set (${varname} "${GFLAGS_${varname}}")
else ()
set (${varname} "${GFLAGS_${varname}}" CACHE ${type} "${docstring}")
endif ()