diff --git a/src/core/conf.cpp b/src/core/conf.cpp index 0ae09de..82b38f1 100644 --- a/src/core/conf.cpp +++ b/src/core/conf.cpp @@ -509,9 +509,7 @@ namespace mob { set_path_if_empty("pf_x86", find_program_files_x86); set_path_if_empty("pf_x64", find_program_files_x64); set_path_if_empty("vs", find_vs); - set_path_if_empty("vcpkg", []() { - return this_env::get().get("VCPKG_ROOT"); - }); + set_path_if_empty("vcpkg", find_vcpkg); // set after vs as it will use the VS set_path_if_empty("qt_install", find_qt); set_path_if_empty("temp_dir", find_temp_dir); set_path_if_empty("patches", find_in_root("patches")); diff --git a/src/core/paths.cpp b/src/core/paths.cpp index 8652459..9248a64 100644 --- a/src/core/paths.cpp +++ b/src/core/paths.cpp @@ -254,6 +254,24 @@ namespace mob { } } + fs::path find_vcpkg() + { + const auto env_path = this_env::get().get("VCPKG_ROOT"); + + if (!env_path.empty()) { + return fs::absolute(env_path); + } + + const auto vs_path = conf().path().vs(); + const auto vcpkg_vs_path = vs_path / "VC" / "vcpkg"; + if (!exists(vcpkg_vs_path)) { + gcx().bail_out(context::conf, "vcpkg is not part of VS installation at {}", + vs_path); + } + + return vcpkg_vs_path; + } + fs::path find_qt() { // check from the ini first diff --git a/src/core/paths.h b/src/core/paths.h index 597823a..b36d806 100644 --- a/src/core/paths.h +++ b/src/core/paths.h @@ -33,6 +33,11 @@ namespace mob { // fs::path find_vs(); + // returns the absolute path to VCPKG root directory to be used as VCPKG_ROOT when + // building + // + fs::path find_vcpkg(); + // returns the absolute path to Qt's root directory, the one that contains // bin, include, etc.; bails if not found //