CPack/NuGet: Add support for repository tag

Fixes: #23703
This commit is contained in:
Alex Turbov
2023-12-29 18:25:01 -05:00
committed by Brad King
parent 2c616e85cf
commit ccde6f8048
2 changed files with 19 additions and 0 deletions

View File

@@ -22,6 +22,7 @@
@_CPACK_NUGET_COPYRIGHT_TAG@
@_CPACK_NUGET_LANGUAGE_TAG@
@_CPACK_NUGET_TAGS_TAG@
@_CPACK_NUGET_REPOSITORY_TAG@
@_CPACK_NUGET_DEPENDENCIES_TAG@
</metadata>
@_CPACK_NUGET_FILES_TAG@

View File

@@ -297,6 +297,24 @@ function(_cpack_nuget_render_spec)
# NuGet >= 5.10
_cpack_nuget_variable_fallback_and_wrap_into_element(readme README)
set(_CPACK_NUGET_REPOSITORY_TAG)
_cpack_nuget_variable_fallback(_repo_type REPOSITORY_TYPE)
_cpack_nuget_variable_fallback(_repo_url REPOSITORY_URL)
if(_repo_type AND _repo_url)
set(_CPACK_NUGET_REPOSITORY_TAG "<repository type=\"${_repo_type}\" url=\"${_repo_url}\"")
_cpack_nuget_variable_fallback(_repo_br REPOSITORY_BRANCH)
if(_repo_br)
string(APPEND _CPACK_NUGET_REPOSITORY_TAG " branch=\"${_repo_br}\"")
endif()
_cpack_nuget_variable_fallback(_repo_commit REPOSITORY_COMMIT)
if(_repo_commit)
string(APPEND _CPACK_NUGET_REPOSITORY_TAG " commit=\"${_repo_commit}\"")
endif()
string(APPEND _CPACK_NUGET_REPOSITORY_TAG " />")
else()
message(AUTHOR_WARNING "Skip adding the `<repository .../>` element due to missing URL or type")
endif()
# Handle dependencies
_cpack_nuget_variable_fallback(_deps DEPENDENCIES)
set(_collected_deps)