diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 15496ce45a..739495fb7e 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -56,12 +56,13 @@ if(VCPKG_PREFER_SYSTEM_LIBS) endif() # Manifest options and settings +set(Z_VCPKG_MANIFEST_DIR_INITIAL_VALUE "${VCPKG_MANIFEST_DIR}") if(NOT DEFINED VCPKG_MANIFEST_DIR) if(EXISTS "${CMAKE_SOURCE_DIR}/vcpkg.json") - set(VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}") + set(Z_VCPKG_MANIFEST_DIR_INITIAL_VALUE "${CMAKE_SOURCE_DIR}") endif() endif() -set(VCPKG_MANIFEST_DIR "${VCPKG_MANIFEST_DIR}" +set(VCPKG_MANIFEST_DIR "${Z_VCPKG_MANIFEST_DIR_INITIAL_VALUE}" CACHE PATH "The path to the vcpkg manifest directory." FORCE) if(DEFINED VCPKG_MANIFEST_DIR AND NOT VCPKG_MANIFEST_DIR STREQUAL "") @@ -392,16 +393,16 @@ if(NOT Z_VCPKG_ROOT_DIR) endif() if(DEFINED VCPKG_INSTALLED_DIR) - # do nothing + set(Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE "${VCPKG_INSTALLED_DIR}") elseif(DEFINED _VCPKG_INSTALLED_DIR) - set(VCPKG_INSTALLED_DIR "${_VCPKG_INSTALLED_DIR}") + set(Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE "${_VCPKG_INSTALLED_DIR}") elseif(VCPKG_MANIFEST_MODE) - set(VCPKG_INSTALLED_DIR "${CMAKE_BINARY_DIR}/vcpkg_installed") + set(Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE "${CMAKE_BINARY_DIR}/vcpkg_installed") else() - set(VCPKG_INSTALLED_DIR "${Z_VCPKG_ROOT_DIR}/installed") + set(Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE "${Z_VCPKG_ROOT_DIR}/installed") endif() -set(VCPKG_INSTALLED_DIR "${VCPKG_INSTALLED_DIR}" +set(VCPKG_INSTALLED_DIR "${Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE}" CACHE PATH "The directory which contains the installed libraries for each triplet" FORCE) set(_VCPKG_INSTALLED_DIR "${VCPKG_INSTALLED_DIR}"