mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-23 03:27:54 +08:00
5304f826b5
* [rollup:2021-07-26 1/6] PR #18783 (@strega-nil) [scripts-audit] vcpkg_copy_tools and friends * [rollup:2021-07-26 2/6] PR #18898 (@dg0yt) [vcpkg] Fix toolchain compatibility with cmake < 3.15 * [rollup:2021-07-26 3/6] PR #18980 (@strega-nil) [cmake-guidelines] Minor update, for `if()` * [rollup:2021-07-26 4/6] PR #18981 (@strega-nil) [scripts-audit] vcpkg_check_linkage * [rollup:2021-07-26 5/6] PR #19158 (@Hoikas) [vcpkg.cmake] Fix variable case. * [rollup:2021-07-26 6/6] PR #18839 [scripts-audit] z_vcpkg_get_cmake_vars Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
50 lines
1.8 KiB
CMake
50 lines
1.8 KiB
CMake
#[===[.md:
|
|
# vcpkg_copy_tool_dependencies
|
|
|
|
Copy all DLL dependencies of built tools into the tool folder.
|
|
|
|
## Usage
|
|
```cmake
|
|
vcpkg_copy_tool_dependencies(<${CURRENT_PACKAGES_DIR}/tools/${PORT}>)
|
|
```
|
|
## Parameters
|
|
The path to the directory containing the tools.
|
|
|
|
## Notes
|
|
This command should always be called by portfiles after they have finished rearranging the binary output, if they have any tools.
|
|
|
|
## Examples
|
|
|
|
* [glib](https://github.com/Microsoft/vcpkg/blob/master/ports/glib/portfile.cmake)
|
|
* [fltk](https://github.com/Microsoft/vcpkg/blob/master/ports/fltk/portfile.cmake)
|
|
#]===]
|
|
|
|
function(z_vcpkg_copy_tool_dependencies_search tool_dir path_to_search)
|
|
file(GLOB tools "${tool_dir}/*.exe" "${tool_dir}/*.dll" "${tool_dir}/*.pyd")
|
|
foreach(tool IN LISTS tools)
|
|
vcpkg_execute_required_process(
|
|
COMMAND "${Z_VCPKG_POWERSHELL_CORE}" -noprofile -executionpolicy Bypass -nologo
|
|
-file "${SCRIPTS}/buildsystems/msbuild/applocal.ps1"
|
|
-targetBinary "${tool}"
|
|
-installedDir "${path_to_search}"
|
|
WORKING_DIRECTORY "${VCPKG_ROOT_DIR}"
|
|
LOGNAME copy-tool-dependencies
|
|
)
|
|
endforeach()
|
|
endfunction()
|
|
|
|
function(vcpkg_copy_tool_dependencies tool_dir)
|
|
if(ARGC GREATER 1)
|
|
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${ARGN}")
|
|
endif()
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
find_program(Z_VCPKG_POWERSHELL_CORE pwsh)
|
|
if (NOT Z_VCPKG_POWERSHELL_CORE)
|
|
message(FATAL_ERROR "Could not find PowerShell Core; please open an issue to report this.")
|
|
endif()
|
|
z_vcpkg_copy_tool_dependencies_search("${tool_dir}" "${CURRENT_PACKAGES_DIR}/bin")
|
|
z_vcpkg_copy_tool_dependencies_search("${tool_dir}" "${CURRENT_INSTALLED_DIR}/bin")
|
|
endif()
|
|
endfunction()
|