Modules: Check for ARGC before using ARGV#

ARGV# could be defined from a parent scope.
This commit is contained in:
Daniele E. Domenichelli
2015-02-26 17:26:12 +01:00
committed by Brad King
parent 4efef3f775
commit a7631fc4e0
8 changed files with 121 additions and 39 deletions

View File

@@ -395,7 +395,7 @@ function(add_compiler_export_flags)
# Either return the extra flags needed in the supplied argument, or to the
# CMAKE_CXX_FLAGS if no argument is supplied.
if(ARGV0)
if(ARGC GREATER 0)
set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE)