Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: automatically install runtimes for vcpkg
Browse files Browse the repository at this point in the history
FeignClaims committed Sep 18, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6b6dee4 commit 9ccd37f
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -77,6 +77,7 @@ words:
- libc
- libcuda
- libg
- libm
- libstdc
- LPSTR
- LPWSTR
24 changes: 24 additions & 0 deletions src/PackageProject.cmake
Original file line number Diff line number Diff line change
@@ -134,6 +134,7 @@ function(package_project)
set(_PackageProject_NAMESPACE "${_PackageProject_NAME}::")
set(_PackageProject_VARS_PREFIX ${_PackageProject_NAME})
set(_PackageProject_EXPORT ${_PackageProject_NAME})
set(_PackageProject_SET "${_PackageProject}_deps_set")

# default version to the project version
if("${_PackageProject_VERSION}" STREQUAL "")
@@ -249,12 +250,35 @@ function(package_project)
install(
TARGETS ${_targets_list}
EXPORT ${_PackageProject_EXPORT}
RUNTIME_DEPENDENCY_SET ${_PackageProject_SET}
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_PackageProject_NAME}" COMPONENT dev
${FILE_SET_ARGS}
)
set(runtime_dirs)
if(VCPKG_INSTALLED_DIR)
list(APPEND runtime_dirs
"${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
"${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/lib"
)
endif()
if(runtime_dirs)
install(RUNTIME_DEPENDENCY_SET ${_PackageProject_SET}
PRE_EXCLUDE_REGEXES
[[api-ms-win-.*]]
[[ext-ms-.*]]
[[kernel32\.dll]]
[[(libc|libgcc_s|libgcc_s_seh|libm|libstdc\+\+|libc\+\+|libunwind)(-[0-9.]+)?\..*]]
POST_EXCLUDE_REGEXES
[[.*/system32/.*\.dll]]
[[^/lib.*]]
[[^/usr/lib.*]]
DIRECTORIES
${runtime_dirs}
)
endif()

# download ForwardArguments
FetchContent_Declare(

0 comments on commit 9ccd37f

Please sign in to comment.