From b919cf7f7c382e8180ea995a500c5b91b2ba6384 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Sat, 22 Aug 2020 02:04:16 -0700 Subject: [PATCH] [vcpkg.cmake] check for vcpkg.json only in `${CMAKE_SOURCE_DIR}` (#12523) --- scripts/buildsystems/vcpkg.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 7eb6d474ae..3471521f06 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -23,7 +23,13 @@ function(_vcpkg_get_directory_name_of_file_above OUT DIRECTORY FILENAME) set(${OUT} ${_vcpkg_get_dir_out} CACHE INTERNAL "_vcpkg_get_directory_name_of_file_above: ${OUT}") endfunction() -_vcpkg_get_directory_name_of_file_above(_VCPKG_MANIFEST_DIR ${CMAKE_CURRENT_SOURCE_DIR} "vcpkg.json") +if(NOT DEFINED VCPKG_MANIFEST_DIR) + if(EXISTS "${CMAKE_SOURCE_DIR}/vcpkg.json") + set(_VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}/vcpkg.json") + endif() +else() + set(_VCPKG_MANIFEST_DIR ${VCPKG_MANIFEST_DIR}) +endif() if(NOT DEFINED VCPKG_MANIFEST_MODE) if(_VCPKG_MANIFEST_DIR) set(VCPKG_MANIFEST_MODE ON)