summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDaniele E. Domenichelli <daniele.domenichelli@iit.it>2015-02-26 16:26:12 (GMT)
committerBrad King <brad.king@kitware.com>2015-02-27 15:59:23 (GMT)
commita7631fc4e026f2e330b10eae73f473f240c3d0c1 (patch)
treed51c0ee64c296bedf59e18db82821457f93f3b66 /Modules
parent4efef3f775e78bdcb4591dc37aa974bc28e8fd84 (diff)
downloadCMake-a7631fc4e026f2e330b10eae73f473f240c3d0c1.zip
CMake-a7631fc4e026f2e330b10eae73f473f240c3d0c1.tar.gz
CMake-a7631fc4e026f2e330b10eae73f473f240c3d0c1.tar.bz2
Modules: Check for ARGC before using ARGV#
ARGV# could be defined from a parent scope.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/BundleUtilities.cmake6
-rw-r--r--Modules/DeployQt4.cmake90
-rw-r--r--Modules/ExternalProject.cmake2
-rw-r--r--Modules/FeatureSummary.cmake10
-rw-r--r--Modules/FindPkgConfig.cmake2
-rw-r--r--Modules/GenerateExportHeader.cmake2
-rw-r--r--Modules/GetPrerequisites.cmake36
-rw-r--r--Modules/Qt4Macros.cmake12
8 files changed, 121 insertions, 39 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index ce90f30..b7975d3 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -457,7 +457,11 @@ endfunction()
function(set_bundle_key_values keys_var context item exepath dirs copyflag)
- set(rpaths "${ARGV6}")
+ if(ARGC GREATER 6)
+ set(rpaths "${ARGV6}")
+ else()
+ set(rpaths "")
+ endif()
get_filename_component(item_name "${item}" NAME)
get_item_key("${item}" key)
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index b1a2370..de475e4 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -126,7 +126,10 @@ function(write_qt4_conf qt_conf_dir qt_conf_contents)
endfunction()
function(resolve_qt4_paths paths_var)
- set(executable_path ${ARGV1})
+ unset(executable_path)
+ if(ARGC GREATER 1)
+ set(executable_path ${ARGV1})
+ endif()
set(paths_resolved)
foreach(path ${${paths_var}})
@@ -144,11 +147,26 @@ function(resolve_qt4_paths paths_var)
endfunction()
function(fixup_qt4_executable executable)
- set(qtplugins ${ARGV1})
- set(libs ${ARGV2})
- set(dirs ${ARGV3})
- set(plugins_dir ${ARGV4})
- set(request_qt_conf ${ARGV5})
+ unset(qtplugins)
+ if(ARGC GREATER 1)
+ set(qtplugins ${ARGV1})
+ endif()
+ unset(libs)
+ if(ARGC GREATER 2)
+ set(libs ${ARGV2})
+ endif()
+ unset(dirs)
+ if(ARGC GREATER 3)
+ set(dirs ${ARGV3})
+ endif()
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(request_qt_conf)
+ if(ARGC GREATER 5)
+ set(request_qt_conf ${ARGV5})
+ endif()
message(STATUS "fixup_qt4_executable")
message(STATUS " executable='${executable}'")
@@ -169,7 +187,7 @@ function(fixup_qt4_executable executable)
set(qt_conf_dir "${executable}/Contents/Resources")
set(executable_path "${executable}")
set(write_qt_conf TRUE)
- if(NOT plugins_dir)
+ if(NOT DEFINED plugins_dir)
set(plugins_dir "${DeployQt4_apple_plugins_dir}")
endif()
else()
@@ -204,9 +222,19 @@ function(fixup_qt4_executable executable)
endfunction()
function(install_qt4_plugin_path plugin executable copy installed_plugin_path_var)
- set(plugins_dir ${ARGV4})
- set(component ${ARGV5})
- set(configurations ${ARGV6})
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(component)
+ if(ARGC GREATER 5)
+ set(component ${ARGV5})
+ endif()
+ unset(configurations)
+ if(ARGC GREATER 6)
+ set(configurations ${ARGV6})
+ endif()
+
if(EXISTS "${plugin}")
if(APPLE)
if(NOT plugins_dir)
@@ -253,8 +281,15 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va
endfunction()
function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
- set(plugins_dir ${ARGV4})
- set(component ${ARGV5})
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(component)
+ if(ARGC GREATER 5)
+ set(component ${ARGV5})
+ endif()
+
if(EXISTS "${plugin}")
install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
else()
@@ -287,12 +322,31 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
endfunction()
function(install_qt4_executable executable)
- set(qtplugins ${ARGV1})
- set(libs ${ARGV2})
- set(dirs ${ARGV3})
- set(plugins_dir ${ARGV4})
- set(request_qt_conf ${ARGV5})
- set(component ${ARGV6})
+ unset(qtplugins)
+ if(ARGC GREATER 1)
+ set(qtplugins ${ARGV1})
+ endif()
+ unset(libs)
+ if(ARGC GREATER 2)
+ set(libs ${ARGV2})
+ endif()
+ unset(dirs)
+ if(ARGC GREATER 3)
+ set(dirs ${ARGV3})
+ endif()
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(request_qt_conf)
+ if(ARGC GREATER 5)
+ set(request_qt_conf ${ARGV5})
+ endif()
+ unset(component)
+ if(ARGC GREATER 6)
+ set(component ${ARGV6})
+ endif()
+
if(QT_LIBRARY_DIR)
list(APPEND dirs "${QT_LIBRARY_DIR}")
endif()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 74e8ae2..1f9f4d3 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1360,7 +1360,7 @@ endfunction()
function(ExternalProject_Add_StepTargets name)
set(steps ${ARGN})
- if("${ARGV1}" STREQUAL "NO_DEPENDS")
+ if(ARGC GREATER 1 AND "${ARGV1}" STREQUAL "NO_DEPENDS")
set(no_deps 1)
list(REMOVE_AT steps 0)
endif()
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index ce5a4ed..dc31086 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -562,8 +562,14 @@ endfunction()
# The stuff below is only kept for compatibility
function(SET_PACKAGE_INFO _name _desc)
- set(_url "${ARGV2}")
- set(_purpose "${ARGV3}")
+ unset(_url)
+ unset(_purpose)
+ if(ARGC GREATER 2)
+ set(_url "${ARGV2}")
+ endif()
+ if(ARGC GREATER 3)
+ set(_purpose "${ARGV3}")
+ endif()
set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
if(NOT _url STREQUAL "")
set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" )
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index bf58ede..64ccde5 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -143,7 +143,7 @@ endmacro()
# - _pkgconfig_add_extra_path(_extra_paths ENV VAR)
function(_pkgconfig_add_extra_path _extra_paths_var _var)
set(_is_env 0)
- if(_var STREQUAL "ENV")
+ if(ARGC GREATER 2 AND _var STREQUAL "ENV")
set(_var ${ARGV2})
set(_is_env 1)
endif()
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 0c6256c..aab29ea 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -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)
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 9fb85fe..23d486e 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -330,7 +330,11 @@ endfunction()
function(gp_resolve_item context item exepath dirs resolved_item_var)
set(resolved 0)
set(resolved_item "${item}")
- set(rpaths "${ARGV5}")
+ if(ARGC GREATER 5)
+ set(rpaths "${ARGV5}")
+ else()
+ set(rpaths "")
+ endif()
# Is it already resolved?
#
@@ -481,7 +485,11 @@ endfunction()
function(gp_resolved_file_type original_file file exepath dirs type_var)
- set(rpaths "${ARGV5}")
+ if(ARGC GREATER 5)
+ set(rpaths "${ARGV5}")
+ else()
+ set(rpaths "")
+ endif()
#message(STATUS "**")
if(NOT IS_ABSOLUTE "${original_file}")
@@ -623,7 +631,11 @@ endfunction()
function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
set(verbose 0)
set(eol_char "E")
- set(rpaths "${ARGV6}")
+ if(ARGC GREATER 6)
+ set(rpaths "${ARGV6}")
+ else()
+ set(rpaths "")
+ endif()
if(NOT IS_ABSOLUTE "${target}")
message("warning: target '${target}' is not absolute...")
@@ -881,22 +893,22 @@ endfunction()
function(list_prerequisites target)
- if("${ARGV1}" STREQUAL "")
- set(all 1)
- else()
+ if(ARGC GREATER 1 AND NOT "${ARGV1}" STREQUAL "")
set(all "${ARGV1}")
+ else()
+ set(all 1)
endif()
- if("${ARGV2}" STREQUAL "")
- set(exclude_system 0)
- else()
+ if(ARGC GREATER 2 AND NOT "${ARGV2}" STREQUAL "")
set(exclude_system "${ARGV2}")
+ else()
+ set(exclude_system 0)
endif()
- if("${ARGV3}" STREQUAL "")
- set(verbose 0)
- else()
+ if(ARGC GREATER 3 AND NOT "${ARGV3}" STREQUAL "")
set(verbose "${ARGV3}")
+ else()
+ set(verbose 0)
endif()
set(count 0)
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 6516b0a..3b0a6cc 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -158,7 +158,7 @@ macro (QT4_GENERATE_MOC infile outfile )
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
endif()
- if ("x${ARGV2}" STREQUAL "xTARGET")
+ if (${ARGC} GREATER 3 AND "x${ARGV2}" STREQUAL "xTARGET")
set(moc_target ${ARGV3})
endif()
QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}")
@@ -329,7 +329,10 @@ endmacro()
macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName)
get_filename_component(_infile ${_xml_file} ABSOLUTE)
- set(_optionalBasename "${ARGV4}")
+ unset(_optionalBasename)
+ if(${ARGC} GREATER 4)
+ set(_optionalBasename "${ARGV4}")
+ endif()
if (_optionalBasename)
set(_basename ${_optionalBasename} )
else ()
@@ -337,7 +340,10 @@ macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional
string(TOLOWER ${_basename} _basename)
endif ()
- set(_optionalClassName "${ARGV5}")
+ unset(_optionalClassName)
+ if(${ARGC} GREATER 5)
+ set(_optionalClassName "${ARGV5}")
+ endif()
set(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h")
set(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp")
set(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc")