Skip to content

Commit e08bd5a

Browse files
authored
Merge pull request #164 from build-cpp/vcpkg-overlay-bugfix
Use absolute paths for vcpkg overlays
2 parents 7314774 + 068977e commit e08bd5a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cmake_generator.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,17 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
865865
comment("vcpkg settings");
866866
auto emit_overlay = [&cmd](const std::string &name, const std::vector<std::string> &overlay) {
867867
if (!overlay.empty()) {
868+
std::vector<std::string> set_args;
868869
for (const auto &directory : overlay) {
870+
if (!fs::path(directory).is_relative()) {
871+
throw std::runtime_error("[vcpkg] overlay is not a relative path: " + directory);
872+
}
869873
if (!fs::is_directory(directory)) {
870874
throw std::runtime_error("[vcpkg] overlay is not a directory: " + directory);
871875
}
876+
set_args.emplace_back("${CMAKE_CURRENT_SOURCE_DIR}/" + directory);
872877
}
873-
cmd("set")(name, overlay);
878+
cmd("set")(name, set_args);
874879
}
875880
};
876881
emit_overlay("VCPKG_OVERLAY_PORTS", project.vcpkg.overlay_ports);

0 commit comments

Comments
 (0)