aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authornicole mazzuca <mazzucan@outlook.com>2020-09-03 09:58:15 -0700
committerGitHub <noreply@github.com>2020-09-03 09:58:15 -0700
commit619b29470031781e0c787eff32dbc7d8568bdbe6 (patch)
tree23995767a0b1d1ecd440252d6a8e7bca4043ee15 /scripts
parentff1d20fd9a72d72d51a549c27b669cd6040fb7d9 (diff)
downloadvcpkg-619b29470031781e0c787eff32dbc7d8568bdbe6.tar.gz
vcpkg-619b29470031781e0c787eff32dbc7d8568bdbe6.zip
[vcpkg.cmake] error out if the mode has changed (#13313)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/buildsystems/vcpkg.cmake23
1 files changed, 18 insertions, 5 deletions
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index 753c0523c..c1df616da 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)