diff options
Diffstat (limited to 'Modules/Internal/CPack')
-rw-r--r-- | Modules/Internal/CPack/CPack.NuGet.nuspec.in | 5 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPackDeb.cmake | 4 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPackNuGet.cmake | 80 | ||||
-rw-r--r-- | Modules/Internal/CPack/NSIS.template.in | 2 |
4 files changed, 84 insertions, 7 deletions
diff --git a/Modules/Internal/CPack/CPack.NuGet.nuspec.in b/Modules/Internal/CPack/CPack.NuGet.nuspec.in index b7beb5d..d89d69f 100644 --- a/Modules/Internal/CPack/CPack.NuGet.nuspec.in +++ b/Modules/Internal/CPack/CPack.NuGet.nuspec.in @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> +<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <!-- Required elements--> <id>@CPACK_NUGET_PACKAGE_NAME@</id> @@ -12,11 +12,14 @@ @_CPACK_NUGET_OWNERS_TAG@ @_CPACK_NUGET_PROJECTURL_TAG@ @_CPACK_NUGET_LICENSEURL_TAG@ + @_CPACK_NUGET_LICENSE_TAG@ @_CPACK_NUGET_ICONURL_TAG@ + @_CPACK_NUGET_ICON_TAG@ @_CPACK_NUGET_REQUIRELICENSEACCEPTANCE_TAG@ @_CPACK_NUGET_SUMMARY_TAG@ @_CPACK_NUGET_RELEASENOTES_TAG@ @_CPACK_NUGET_COPYRIGHT_TAG@ + @_CPACK_NUGET_LANGUAGE_TAG@ @_CPACK_NUGET_TAGS_TAG@ @_CPACK_NUGET_DEPENDENCIES_TAG@ </metadata> diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index 431b074..48d451a 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -768,6 +768,10 @@ function(cpack_deb_prepare_package_vars) set(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME "${CPACK_DBGSYM_OUTPUT_FILE_NAME}" PARENT_SCOPE) list(JOIN BUILD_IDS " " BUILD_IDS) set(GEN_BUILD_IDS "${BUILD_IDS}" PARENT_SCOPE) + else() + unset(GEN_DBGSYMDIR PARENT_SCOPE) + unset(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME PARENT_SCOPE) + unset(GEN_BUILD_IDS PARENT_SCOPE) endif() endfunction() diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake index 20eed2e..fb363f4 100644 --- a/Modules/Internal/CPack/CPackNuGet.cmake +++ b/Modules/Internal/CPack/CPackNuGet.cmake @@ -107,21 +107,44 @@ endfunction() function(_cpack_nuget_variable_fallback_and_wrap_into_element ELEMENT NUGET_VAR_NAME) set(_options) set(_one_value_args) - set(_multi_value_args FALLBACK_VARS) - cmake_parse_arguments(PARSE_ARGV 0 _args "${_options}" "${_one_value_args}" "${_multi_value_args}") + set(_multi_value_args FALLBACK_VARS ATTRIBUTES) + cmake_parse_arguments(PARSE_ARGV 2 _args "${_options}" "${_one_value_args}" "${_multi_value_args}") + + if(_args_ATTRIBUTES) + list(JOIN _args_ATTRIBUTES " " _attributes) + string(PREPEND _attributes " ") + endif() _cpack_nuget_variable_fallback(_value ${NUGET_VAR_NAME} ${ARGN} USE_CDATA) + string(TOUPPER "${ELEMENT}" _ELEMENT_UP) if(_value) - string(TOUPPER "${ELEMENT}" _ELEMENT_UP) set( _CPACK_NUGET_${_ELEMENT_UP}_TAG - "<${ELEMENT}>${_value}</${ELEMENT}>" + "<${ELEMENT}${_attributes}>${_value}</${ELEMENT}>" + PARENT_SCOPE + ) + elseif(_attributes) + set( + _CPACK_NUGET_${_ELEMENT_UP}_TAG + "<${ELEMENT}${_attributes} />" PARENT_SCOPE ) endif() endfunction() +# Warn of obsolete nuspec fields, referencing CMake variables and suggested +# replacement, if any +function(_cpack_nuget_deprecation_warning NUGET_ELEMENT VARNAME REPLACEMENT) + if(${VARNAME}) + if(REPLACEMENT) + message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider replacing `${VARNAME}` with `${REPLACEMENT}`") + else() + message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider removing `${VARNAME}`") + endif() + endif() +endfunction() + # Print some debug info _cpack_nuget_debug("---[CPack NuGet Input Variables]---") _cpack_nuget_debug_var(CPACK_PACKAGE_NAME) @@ -168,6 +191,21 @@ function(_cpack_nuget_render_spec) set(CPACK_NUGET_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") endif() + # Warn about deprecated nuspec elements; warnings only display if + # variable is set + # Note that while nuspec's "summary" element is deprecated, there + # is no suggested replacement so (for now) no deprecation warning + # is shown for `CPACK_NUGET_*_DESCRIPTION_SUMMARY` + _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_PACKAGE_LICENSEURL + "CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME or CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION") + _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSEURL + "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_FILE_NAME or CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_EXPRESSION") + _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_PACKAGE_ICONURL + "CPACK_NUGET_PACKAGE_ICON") + _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICONURL + "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICON") + + # Set nuspec fields _cpack_nuget_variable_fallback( CPACK_NUGET_PACKAGE_VERSION VERSION FALLBACK_VARS @@ -207,8 +245,35 @@ function(_cpack_nuget_render_spec) FALLBACK_VARS CPACK_PACKAGE_HOMEPAGE_URL ) + + # "licenseUrl" is deprecated in favor of "license" _cpack_nuget_variable_fallback_and_wrap_into_element(licenseUrl LICENSEURL) + + # "iconUrl" is deprecated in favor of "icon" _cpack_nuget_variable_fallback_and_wrap_into_element(iconUrl ICONURL) + + # "license" takes a "type" attribute of either "file" or "expression" + # "file" refers to a file path of a .txt or .md file relative to the installation root + # "expression" refers to simple or compound expression of license identifiers + # listed at https://spdx.org/licenses/ + # Note that only one of CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME and + # CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION may be specified. If both are specified, + # CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME takes precedence and CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION is ignored. + if(CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME) + _cpack_nuget_variable_fallback_and_wrap_into_element( + license LICENSE_FILE_NAME + ATTRIBUTES [[type="file"]] + ) + elseif(CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION) + _cpack_nuget_variable_fallback_and_wrap_into_element( + license LICENSE_EXPRESSION + ATTRIBUTES [[type="expression"]] + ) + endif() + + # "icon" refers to a file path relative to the installation root + _cpack_nuget_variable_fallback_and_wrap_into_element(icon ICON) + # "summary" is deprecated in favor of "description" _cpack_nuget_variable_fallback_and_wrap_into_element( summary DESCRIPTION_SUMMARY FALLBACK_VARS @@ -222,7 +287,12 @@ function(_cpack_nuget_render_spec) endif() _cpack_nuget_variable_fallback_and_wrap_into_element(releaseNotes RELEASE_NOTES) _cpack_nuget_variable_fallback_and_wrap_into_element(copyright COPYRIGHT) + # "language" is a locale identifier such as "en_CA" + _cpack_nuget_variable_fallback_and_wrap_into_element(language LANGUAGE) _cpack_nuget_variable_fallback_and_wrap_into_element(tags TAGS LIST_GLUE " ") + # "repository" holds repository metadata consisting of four optional + # attributes: "type", "url", "branch", and "commit". While all fields are + # considered optional, they are not independent. Currently unsupported. # Handle dependencies _cpack_nuget_variable_fallback(_deps DEPENDENCIES) @@ -262,7 +332,7 @@ endfunction() function(_cpack_nuget_make_files_tag) set(_files) foreach(_comp IN LISTS ARGN) - string(APPEND _files " <file src=\"${_comp}\\**\" target=\".\" />\n") + string(APPEND _files " <file src=\"${_comp}/**\" target=\".\" />\n") endforeach() set(_CPACK_NUGET_FILES_TAG "<files>\n${_files} </files>" PARENT_SCOPE) endfunction() diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in index 6009ce0..b448c76 100644 --- a/Modules/Internal/CPack/NSIS.template.in +++ b/Modules/Internal/CPack/NSIS.template.in @@ -1,4 +1,4 @@ -; CPack install script designed for a nmake build +; CPack install script designed for a nmake build ;-------------------------------- ; You must define these values |