summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2023-12-29 23:25:01 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-08 16:01:29 (GMT)
commitccde6f80488cd91d47e00ca97e9b23263f7ef939 (patch)
tree3d4416a38c818a99e13c83e034e0b16f3b9f3413 /Modules
parent2c616e85cf76ec57500a629a2152e118c223674c (diff)
downloadCMake-ccde6f80488cd91d47e00ca97e9b23263f7ef939.zip
CMake-ccde6f80488cd91d47e00ca97e9b23263f7ef939.tar.gz
CMake-ccde6f80488cd91d47e00ca97e9b23263f7ef939.tar.bz2
CPack/NuGet: Add support for repository tag
Fixes: #23703
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Internal/CPack/CPack.NuGet.nuspec.in1
-rw-r--r--Modules/Internal/CPack/CPackNuGet.cmake18
2 files changed, 19 insertions, 0 deletions
diff --git a/Modules/Internal/CPack/CPack.NuGet.nuspec.in b/Modules/Internal/CPack/CPack.NuGet.nuspec.in
index f54a3f5..4548a59 100644
--- a/Modules/Internal/CPack/CPack.NuGet.nuspec.in
+++ b/Modules/Internal/CPack/CPack.NuGet.nuspec.in
@@ -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@
diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake
index bd482bd..67f318a 100644
--- a/Modules/Internal/CPack/CPackNuGet.cmake
+++ b/Modules/Internal/CPack/CPackNuGet.cmake
@@ -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)