Skip to content

Commit 14409c7

Browse files
authored
Merge pull request mixxxdj#15899 from Sanjana272621/fix-15016-vcpkg-root-validation
CMake: fail early when MIXXX_VCPKG_ROOT is invalid
2 parents b00f566 + 62217c7 commit 14409c7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,19 @@ if(DEFINED ENV{MIXXX_VCPKG_ROOT} AND NOT DEFINED MIXXX_VCPKG_ROOT)
244244
endif()
245245

246246
if(DEFINED MIXXX_VCPKG_ROOT)
247+
# Validate MIXXX_VCPKG_ROOT points to a vcpkg root to avoid confusing follow-up errors.
248+
set(_vcpkg_toolchain "${MIXXX_VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
249+
if(NOT EXISTS "${_vcpkg_toolchain}")
250+
file(TO_NATIVE_PATH "${_vcpkg_toolchain}" _vcpkg_toolchain_native)
251+
message(
252+
STATUS
253+
"MIXXX_VCPKG_ROOT was set to \"${MIXXX_VCPKG_ROOT}\", but this is not a valid vcpkg root.\n"
254+
"Expected to find: ${_vcpkg_toolchain_native}\n"
255+
"Please set MIXXX_VCPKG_ROOT to the vcpkg root directory, the folder containing the vcpkg tool (vcpkg.exe on Windows)."
256+
)
257+
fatal_error_missing_env()
258+
endif()
259+
247260
if(
248261
EXISTS "${MIXXX_VCPKG_ROOT}/overlay/ports"
249262
OR NOT EXISTS "${MIXXX_VCPKG_ROOT}/ports"

0 commit comments

Comments
 (0)