aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSilvio Traversaro <silvio.traversaro@iit.it>2020-07-08 00:01:01 +0200
committerGitHub <noreply@github.com>2020-07-07 15:01:01 -0700
commitc916abaa0ddd5d1e248834c0bd5aea81c7ed5165 (patch)
tree9c4cab0be0fe18dcb8f766457126202f35ba1356 /scripts
parent3e615cdb1d7b6e8e4abc4308607b39e3e33f8cb9 (diff)
downloadvcpkg-c916abaa0ddd5d1e248834c0bd5aea81c7ed5165.tar.gz
vcpkg-c916abaa0ddd5d1e248834c0bd5aea81c7ed5165.zip
[vcpkg.cmake] Support toolchains that set CMAKE_FIND_ROOT_PATH_MODE_* variables to ONLY (#11753)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/buildsystems/vcpkg.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index 10be7a423..96f847190 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -230,6 +230,16 @@ else() #Release build: Put Release paths before Debug paths. Debug Paths are req
)
endif()
+# If one CMAKE_FIND_ROOT_PATH_MODE_* variables is set to ONLY, to make sure that ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
+# and ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug are searched, it is not sufficient to just add them to CMAKE_FIND_ROOT_PATH,
+# as CMAKE_FIND_ROOT_PATH specify "one or more directories to be prepended to all other search directories", so to make sure that
+# the libraries are searched as they are, it is necessary to add "/" to the CMAKE_PREFIX_PATH
+if(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE STREQUAL "ONLY" OR
+ CMAKE_FIND_ROOT_PATH_MODE_LIBRARY STREQUAL "ONLY" OR
+ CMAKE_FIND_ROOT_PATH_MODE_PACKAGE STREQUAL "ONLY")
+ list(APPEND CMAKE_PREFIX_PATH "/")
+endif()
+
set(VCPKG_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)