Use absolute paths for vcpkg overlays

This commit is contained in:
Duncan Ogilvie
2024-11-28 23:01:14 +01:00
parent 73147747a4
commit 068977e2f5
+6 -1
View File
@@ -865,12 +865,17 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
comment("vcpkg settings");
auto emit_overlay = [&cmd](const std::string &name, const std::vector<std::string> &overlay) {
if (!overlay.empty()) {
std::vector<std::string> set_args;
for (const auto &directory : overlay) {
if (!fs::path(directory).is_relative()) {
throw std::runtime_error("[vcpkg] overlay is not a relative path: " + directory);
}
if (!fs::is_directory(directory)) {
throw std::runtime_error("[vcpkg] overlay is not a directory: " + directory);
}
set_args.emplace_back("${CMAKE_CURRENT_SOURCE_DIR}/" + directory);
}
cmd("set")(name, overlay);
cmd("set")(name, set_args);
}
};
emit_overlay("VCPKG_OVERLAY_PORTS", project.vcpkg.overlay_ports);