11#include " cmake_generator.hpp"
2- #include " error.hpp"
32#include " literals.hpp"
43#include < resources/cmkr.hpp>
54
65#include " fs.hpp"
76#include " project_parser.hpp"
87#include < cstdio>
9- #include < fstream>
108#include < memory>
119#include < sstream>
1210#include < stdexcept>
@@ -43,7 +41,7 @@ static tsl::ordered_map<std::string, std::vector<std::string>> known_languages =
4341 {" Swift" , {" .swift" }},
4442};
4543
46- static std::string format (const char *format, tsl::ordered_map<std::string, std::string> variables) {
44+ static std::string format (const char *format, const tsl::ordered_map<std::string, std::string> & variables) {
4745 std::string s = format;
4846 for (const auto &itr : variables) {
4947 size_t start_pos = 0 ;
@@ -249,7 +247,7 @@ void generate_project(const std::string &type) {
249247
250248struct CommandEndl {
251249 std::stringstream &ss;
252- CommandEndl (std::stringstream &ss) : ss(ss) {
250+ explicit CommandEndl (std::stringstream &ss) : ss(ss) {
253251 }
254252 void endl () {
255253 ss << ' \n ' ;
@@ -258,7 +256,7 @@ struct CommandEndl {
258256
259257struct RawArg {
260258 RawArg () = default ;
261- RawArg (std::string arg) : arg(std::move(arg)) {
259+ explicit RawArg (std::string arg) : arg(std::move(arg)) {
262260 }
263261
264262 std::string arg;
@@ -293,7 +291,7 @@ struct Command {
293291 // https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#unquoted-argument
294292 // NOTE: Normally '/' does not require quoting according to the documentation but this has been the case here
295293 // previously, so for backwards compatibility its still here.
296- if (str.find_first_of (" ()#\"\\ '> |/;" ) == str. npos )
294+ if (str.find_first_of (" ()#\"\\ '> |/;" ) == std::string:: npos)
297295 return str;
298296 std::string result;
299297 result += " \" " ;
@@ -442,10 +440,10 @@ static std::string tolf(const std::string &str) {
442440 }
443441 }
444442 return result;
445- };
443+ }
446444
447445struct Generator {
448- Generator (const parser::Project &project, const fs::path & path) : project(project), path(path) {
446+ Generator (const parser::Project &project, fs::path path) : project(project), path(std::move( path) ) {
449447 }
450448 Generator (const Generator &) = delete ;
451449
@@ -893,7 +891,7 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
893891 gen.conditional_includes (content.include_before );
894892 gen.conditional_cmake (content.cmake_before );
895893
896- std::string version_info = " " ;
894+ std::string version_info;
897895 if (content.arguments .contains (" GIT_TAG" )) {
898896 version_info = " (" + content.arguments .at (" GIT_TAG" ) + " )" ;
899897 } else if (content.arguments .contains (" SVN_REVISION" )) {
0 commit comments