-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add macro in CommonCPackUtils to help package subprojects
- Loading branch information
Raphael Dumusc
committed
Dec 15, 2017
1 parent
61e9179
commit ab06fad
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright (c) 2017 [email protected] | ||
# | ||
# Helper function for packaging subprojects using CommonCPack. | ||
# | ||
# Add subproject dependencies to the current project's package: | ||
# add_deb_depends(<Subproject> | ||
# [PACKAGE_NAME <subproject_package_name>] | ||
# [MIN_VERSION <subproject_min_version>] [<subproject_deb_depends>]) | ||
# | ||
# Arguments: | ||
# * Subproject: name of the subproject | ||
# * PACKAGE_NAME: if subproject package name differs from lower_case(Subproject) | ||
# * MIN_VERSION: minimum version of the subproject's package | ||
# * ARGN: list of dependencies of the subproject | ||
# | ||
# Output (list append): | ||
# * NAME_PACKAGE_REPLACES: Subproject package name if it is being built | ||
# * NAME_PACKAGE_DEB_DEPENDS: the list of Subproject's dependencies if it is | ||
# being built; otherwise its package name. | ||
|
||
macro(add_deb_depends Subproject) | ||
set(_opts) | ||
set(_singleArgs PACKAGE_NAME MIN_VERSION) | ||
set(_multiArgs) | ||
cmake_parse_arguments(THIS "${_opts}" "${_singleArgs}" "${_multiArgs}" | ||
${ARGN}) | ||
set(_packages ${THIS_UNPARSED_ARGUMENTS}) | ||
|
||
if(THIS_PACKAGE_NAME) | ||
set(_subproject_pkg ${THIS_PACKAGE_NAME}) | ||
else() | ||
string(TOLOWER ${Subproject} _subproject_pkg) | ||
endif() | ||
|
||
if(${Subproject}_IS_SUBPROJECT) | ||
list(APPEND ${UPPER_PROJECT_NAME}_PACKAGE_REPLACES ${_subproject_pkg}) | ||
list(APPEND ${UPPER_PROJECT_NAME}_PACKAGE_DEB_DEPENDS ${_packages}) | ||
else() | ||
if(THIS_MIN_VERSION) | ||
set(_subproject_pkg "${_subproject_pkg} (>= ${THIS_MIN_VERSION})") | ||
endif() | ||
list(APPEND ${UPPER_PROJECT_NAME}_PACKAGE_DEB_DEPENDS "${_subproject_pkg}") | ||
endif() | ||
endmacro() |