Skip to content

Commit f565ad2

Browse files
committed
fix formatting, add check for project version in manifest mode
1 parent dc4b59f commit f565ad2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/gen.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#include <cstring>
1010
#include <fstream>
1111
#include <iomanip>
12-
#include <nlohmann/json.hpp>
1312
#include <new>
13+
#include <nlohmann/json.hpp>
1414
#include <sstream>
1515
#include <stdexcept>
1616
#include <string>
@@ -524,14 +524,16 @@ int generate_cmake(const char *path, bool root) {
524524

525525
if (!cmake.vcpkg.packages.empty()) {
526526
cmd("include")("FetchContent");
527-
cmd("message")("STATUS \"Fetching vcpkg...\"");
528-
cmd("FetchContent_Declare")("vcpkg\n\tURL\thttps://github.com/microsoft/vcpkg/archive/refs/tags/2021.05.12.tar.gz");
527+
cmd("message")("STATUS", "Fetching vcpkg...");
528+
cmd("FetchContent_Declare")("vcpkg", "https://github.com/microsoft/vcpkg/archive/refs/tags/2021.05.12.tar.gz");
529529
cmd("FetchContent_MakeAvailable")("vcpkg");
530530
cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");
531531
using namespace nlohmann;
532532
json j;
533533
j["$schema"] = "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json";
534534
j["name"] = cmake.project_name;
535+
if (!cmake.project_version.empty())
536+
throw std::runtime_error("vcpkg manifest mode requires that the project have a version string");
535537
j["version"] = cmake.project_version;
536538
j["dependencies"] = cmake.vcpkg.packages;
537539
std::ofstream ofs("vcpkg.json");

0 commit comments

Comments
 (0)