Skip to content

Commit a64fa9c

Browse files
authored
Merge pull request #163 from build-cpp/vcpkg-fetch-folder
Move vcpkg download location directly in `${CMAKE_BINARY_DIR}/vcpkg`
2 parents 91dd8ce + eb6ccb3 commit a64fa9c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cmake_generator.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,13 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
921921
}
922922
}
923923

924+
tsl::ordered_map<std::string, std::string> vcpkg_args = {
925+
{"URL", url},
926+
{"SUBBUILD_DIR", "CMakeFiles/vcpkg-subbuild"},
927+
{"SOURCE_DIR", "vcpkg"},
928+
{"BINARY_DIR", "CMakeFiles/vcpkg-build"},
929+
};
930+
924931
// CMake to bootstrap vcpkg and download the packages
925932
// clang-format off
926933
cmd("if")("CMKR_ROOT_PROJECT", "AND", "NOT", "CMKR_DISABLE_VCPKG");
@@ -930,7 +937,7 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
930937
cmd("cmake_policy")("SET", "CMP0135", "NEW");
931938
cmd("endif")();
932939
cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")...");
933-
cmd("FetchContent_Declare")("vcpkg", "URL", url);
940+
cmd("FetchContent_Declare")("vcpkg", vcpkg_args);
934941
// Not using FetchContent_MakeAvailable here in case vcpkg adds CMakeLists.txt
935942
cmd("FetchContent_GetProperties")("vcpkg");
936943
cmd("if")("NOT", "vcpkg_POPULATED");

0 commit comments

Comments
 (0)