Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Eli F-F
CMake
Commits
2e900f1e
Commit
2e900f1e
authored
Mar 15, 2017
by
Daniel Pfeifer
Browse files
CPackComponent: use cmake_parse_arguments
parent
b557f3e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Modules/CPackComponent.cmake
View file @
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
}
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment