|
|
@@ -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)
|