Copy local dependencies for library targets (#2787)

* Fix for issue #2786

* [vcpkg-cmake-toolchain] Only applocal dependencies for shared libraries
This commit is contained in:
Bruce Jones 2018-02-13 19:13:27 -05:00 committed by Robert Schumacher
parent 89bd6330dc
commit 78b1396b88

View File

@ -163,6 +163,15 @@ function(add_library name)
list(FIND ARGV "INTERFACE" INTERFACE_IDX)
list(FIND ARGV "ALIAS" ALIAS_IDX)
if(IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1)
get_target_property(IS_LIBRARY_SHARED ${name} TYPE)
if(VCPKG_APPLOCAL_DEPS AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" AND IS_LIBRARY_SHARED STREQUAL "SHARED_LIBRARY")
add_custom_command(TARGET ${name} POST_BUILD
COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1
-targetBinary $<TARGET_FILE:${name}>
-installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
-OutVariable out
)
endif()
set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props)
set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false)
endif()