Commit 48dc2d12 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'CPackComponent-use-cmake_parse_arguments'

2e900f1e

 CPackComponent: use cmake_parse_arguments
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !588
parents 3eda6a97 2e900f1e
......@@ -303,38 +303,6 @@
if(NOT CPackComponent_CMake_INCLUDED)
set(CPackComponent_CMake_INCLUDED 1)
# Argument-parsing macro from https://cmake.org/Wiki/CMakeMacroParseArguments
macro(cpack_parse_arguments prefix arg_names option_names)
set(${prefix}_DEFAULT_ARGS)
foreach(arg_name ${arg_names})
set(${prefix}_${arg_name})
endforeach()
foreach(option ${option_names})
set(${prefix}_${option} FALSE)
endforeach()
set(current_arg_name DEFAULT_ARGS)
set(current_arg_list)
foreach(arg ${ARGN})
set(larg_names ${arg_names})
list(FIND larg_names "${arg}" is_arg_name)
if (is_arg_name GREATER -1)
set(${prefix}_${current_arg_name} ${current_arg_list})
set(current_arg_name ${arg})
set(current_arg_list)
else ()
set(loption_names ${option_names})
list(FIND loption_names "${arg}" is_option)
if (is_option GREATER -1)
set(${prefix}_${arg} TRUE)
else ()
set(current_arg_list ${current_arg_list} ${arg})
endif ()
endif ()
endforeach()
set(${prefix}_${current_arg_name} ${current_arg_list})
endmacro()
# Macro that appends a SET command for the given variable name (var)
# to the macro named strvar, but only if the variable named "var"
# has been defined. The string will eventually be appended to a CPack
......@@ -392,9 +360,10 @@ endmacro()
# Macro that adds a component to the CPack installer
macro(cpack_add_component compname)
string(TOUPPER ${compname} _CPACK_ADDCOMP_UNAME)
cpack_parse_arguments(CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}
"DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE;PLIST"
cmake_parse_arguments(CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}
"HIDDEN;REQUIRED;DISABLED;DOWNLOADED"
"DISPLAY_NAME;DESCRIPTION;GROUP;ARCHIVE_FILE;PLIST"
"DEPENDS;INSTALL_TYPES"
${ARGN}
)
......@@ -464,9 +433,10 @@ endmacro()
# Macro that adds a component group to the CPack installer
macro(cpack_add_component_group grpname)
string(TOUPPER ${grpname} _CPACK_ADDGRP_UNAME)
cpack_parse_arguments(CPACK_COMPONENT_GROUP_${_CPACK_ADDGRP_UNAME}
"DISPLAY_NAME;DESCRIPTION;PARENT_GROUP"
cmake_parse_arguments(CPACK_COMPONENT_GROUP_${_CPACK_ADDGRP_UNAME}
"EXPANDED;BOLD_TITLE"
"DISPLAY_NAME;DESCRIPTION;PARENT_GROUP"
""
${ARGN}
)
......@@ -498,7 +468,8 @@ endmacro()
# Macro that adds an installation type to the CPack installer
macro(cpack_add_install_type insttype)
string(TOUPPER ${insttype} _CPACK_INSTTYPE_UNAME)
cpack_parse_arguments(CPACK_INSTALL_TYPE_${_CPACK_INSTTYPE_UNAME}
cmake_parse_arguments(CPACK_INSTALL_TYPE_${_CPACK_INSTTYPE_UNAME}
""
"DISPLAY_NAME"
""
${ARGN}
......@@ -521,9 +492,10 @@ macro(cpack_add_install_type insttype)
endmacro()
macro(cpack_configure_downloads site)
cpack_parse_arguments(CPACK_DOWNLOAD
"UPLOAD_DIRECTORY"
cmake_parse_arguments(CPACK_DOWNLOAD
"ALL;ADD_REMOVE;NO_ADD_REMOVE"
"UPLOAD_DIRECTORY"
""
${ARGN}
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment