[vcpkg-cmake] Search for binaries after manifest-based installs (#16605)

Otherwise, find_package() fails to find any binaries for many manifest installed packages until a second cmake run commences.

Fixes #16604
This commit is contained in:
Chris Townsend 2021-03-08 15:44:32 -05:00 committed by GitHub
parent c47216ac79
commit 0dc27b9b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -546,15 +546,6 @@ set(CMAKE_SYSTEM_IGNORE_PATH
"C:/OpenSSL-Win64/lib/VC/static"
)
list(APPEND CMAKE_PROGRAM_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools")
file(GLOB Z_VCPKG_TOOLS_DIRS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*")
foreach(Z_VCPKG_TOOLS_DIR IN LISTS Z_VCPKG_TOOLS_DIRS)
if(IS_DIRECTORY "${Z_VCPKG_TOOLS_DIR}")
list(APPEND CMAKE_PROGRAM_PATH "${Z_VCPKG_TOOLS_DIR}")
endif()
endforeach()
# CMAKE_EXECUTABLE_SUFFIX is not yet defined
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(Z_VCPKG_EXECUTABLE "${Z_VCPKG_ROOT_DIR}/vcpkg.exe")
@ -655,6 +646,14 @@ if(VCPKG_MANIFEST_MODE AND VCPKG_MANIFEST_INSTALL AND NOT Z_VCPKG_CMAKE_IN_TRY_C
endif()
endif()
list(APPEND CMAKE_PROGRAM_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools")
file(GLOB Z_VCPKG_TOOLS_DIRS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*")
foreach(Z_VCPKG_TOOLS_DIR IN LISTS Z_VCPKG_TOOLS_DIRS)
if(IS_DIRECTORY "${Z_VCPKG_TOOLS_DIR}")
list(APPEND CMAKE_PROGRAM_PATH "${Z_VCPKG_TOOLS_DIR}")
endif()
endforeach()
function(add_executable)
z_vcpkg_function_arguments(ARGS)
_add_executable(${ARGS})