From 06a4c04df6dc7f8ef5236869376d82cba4145fc6 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sat, 12 Feb 2022 03:10:25 +0100 Subject: [PATCH] Add support for 'shallow' in fetch-content --- src/project_parser.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/project_parser.cpp b/src/project_parser.cpp index 09d1072..05bc4aa 100644 --- a/src/project_parser.cpp +++ b/src/project_parser.cpp @@ -370,6 +370,8 @@ Project::Project(const Project *parent, const std::string &path, bool build) { key = "GIT_REPOSITORY"; } else if (key == "tag") { key = "GIT_TAG"; + } else if (key == "shallow") { + key = "GIT_SHALLOW"; } else if (key == "svn") { key = "SVN_REPOSITORY"; } else if (key == "rev") { @@ -381,7 +383,14 @@ Project::Project(const Project *parent, const std::string &path, bool build) { } else { // don't change arg } - content.arguments.emplace(key, argItr.second.as_string()); + + std::string value; + if (argItr.second.is_boolean()) { + value = argItr.second.as_boolean() ? "ON" : "OFF"; + } else { + value = argItr.second.as_string(); + } + content.arguments.emplace(key, value); } contents.emplace_back(std::move(content)); }