aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSander Cox <sander@paralleldimension.nl>2020-11-20 22:28:14 +0100
committerGitHub <noreply@github.com>2020-11-20 13:28:14 -0800
commit42456b785a4508386f080ae8fad2642e056b747d (patch)
tree0f58948e807852bd78b1add923c91afaa9e3c5fb /scripts
parenta6966c202148b29363b4a4ca48a293b2841e55d5 (diff)
downloadvcpkg-42456b785a4508386f080ae8fad2642e056b747d.tar.gz
vcpkg-42456b785a4508386f080ae8fad2642e056b747d.zip
[vcpkg] X_VCPKG_APPINSTALL_DEPS_INSTALL optionally install dependencies on install (#14243)
* Adding an install command override for dependencies * Apply suggestions from code review Use variables directly instead of prefixing with `${}` as is done in rest of the file. Thanks @shatur95 Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com> * Update scripts/buildsystems/vcpkg.cmake Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com> Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/buildsystems/vcpkg.cmake40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index ecacaf066..55516b1f7 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -515,6 +515,46 @@ function(x_vcpkg_install_local_dependencies)
endif()
endfunction()
+set(X_VCPKG_APPLOCAL_DEPS_INSTALL ${X_VCPKG_APPLOCAL_DEPS_INSTALL} CACHE BOOL "(experimental) Automatically copy dependencies into the install target directory for executables.")
+if(X_VCPKG_APPLOCAL_DEPS_INSTALL)
+ function(install)
+ _install(${ARGV})
+
+ if(ARGV0 STREQUAL "TARGETS")
+ # Will contain the list of targets
+ set(PARSED_TARGETS "")
+
+ # Destination - [RUNTIME] DESTINATION argument overrides this
+ set(DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
+
+ # Parse arguments given to the install function to find targets and (runtime) destination
+ set(MODIFIER "") # Modifier for the command in the argument
+ set(LAST_COMMAND "") # Last command we found to process
+ foreach(ARG ${ARGN})
+ if(ARG MATCHES "ARCHIVE|LIBRARY|RUNTIME|OBJECTS|FRAMEWORK|BUNDLE|PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE")
+ set(MODIFIER ${ARG})
+ continue()
+ endif()
+
+ if(ARG MATCHES "TARGETS|DESTINATION|PERMISSIONS|CONFIGURATIONS|COMPONENT|NAMELINK_COMPONENT|OPTIONAL|EXCLUDE_FROM_ALL|NAMELINK_ONLY|NAMELINK_SKIP")
+ set(LAST_COMMAND ${ARG})
+ continue()
+ endif()
+
+ if(LAST_COMMAND STREQUAL "TARGETS")
+ list(APPEND PARSED_TARGETS "${ARG}")
+ endif()
+
+ if(LAST_COMMAND STREQUAL "DESTINATION" AND (MODIFIER STREQUAL "" OR MODIFIER STREQUAL "RUNTIME"))
+ set(DESTINATION "${ARG}")
+ endif()
+ endforeach()
+
+ x_vcpkg_install_local_dependencies(TARGETS ${PARSED_TARGETS} DESTINATION ${DESTINATION})
+ endif()
+ endfunction()
+endif()
+
if(NOT DEFINED VCPKG_OVERRIDE_FIND_PACKAGE_NAME)
set(VCPKG_OVERRIDE_FIND_PACKAGE_NAME find_package)
endif()