diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 753c0523c8..c1df616dad 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -5,6 +5,8 @@ mark_as_advanced(CMAKE_TOOLCHAIN_FILE) option(VCPKG_VERBOSE "Enables messages from the VCPKG toolchain for debugging purposes." OFF) mark_as_advanced(VCPKG_VERBOSE) +include(CMakeDependentOption) + function(_vcpkg_get_directory_name_of_file_above OUT DIRECTORY FILENAME) set(_vcpkg_get_dir_candidate ${DIRECTORY}) while(IS_DIRECTORY ${_vcpkg_get_dir_candidate} AND NOT DEFINED _vcpkg_get_dir_out) @@ -43,15 +45,26 @@ elseif(VCPKG_MANIFEST_MODE AND NOT _VCPKG_MANIFEST_DIR) "disable manifests by turning off VCPKG_MANIFEST_MODE.") endif() -if(VCPKG_MANIFEST_MODE) - option(VCPKG_MANIFEST_INSTALL -[[ +if(NOT DEFINED _INTERNAL_CHECK_VCPKG_MANIFEST_MODE) + set(_INTERNAL_CHECK_VCPKG_MANIFEST_MODE "${VCPKG_MANIFEST_MODE}" + CACHE INTERNAL "Making sure VCPKG_MANIFEST_MODE doesn't change") +endif() + +if(NOT VCPKG_MANIFEST_MODE STREQUAL _INTERNAL_CHECK_VCPKG_MANIFEST_MODE) + message(FATAL_ERROR [[ +vcpkg manifest mode was enabled for a build directory where it was initially disabled. +This is not supported. Please delete the build directory and reconfigure. +]]) +endif() + +CMAKE_DEPENDENT_OPTION(VCPKG_MANIFEST_INSTALL [[ Install the dependencies listed in your manifest: If this is off, you will have to manually install your dependencies. See https://github.com/microsoft/vcpkg/tree/master/docs/specifications/manifests.md for more info. ]] - ON) -endif() + ON + "VCPKG_MANIFEST_MODE" + OFF) # Determine whether the toolchain is loaded during a try-compile configuration get_property(_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)