vcpkg-wip
Duncan Ogilvie 4 years ago
parent 1e8b756276
commit 461f26d0c6

@ -17,21 +17,21 @@ project(cmkr VERSION ${cmkr_PROJECT_VERSION})
add_subdirectory(third_party)
set(cmkrlib_SOURCES
src/cmkrlib/args.cpp
src/cmkrlib/build.cpp
src/cmkrlib/cmake.cpp
src/cmkrlib/error.cpp
src/cmkrlib/gen.cpp
src/cmkrlib/help.cpp
src/cmkrlib/cmake.hpp
src/cmkrlib/enum_helper.hpp
src/cmkrlib/fs.hpp
include/args.h
include/build.h
include/error.h
include/gen.h
include/help.h
include/literals.h
"src/cmkrlib/args.cpp"
"src/cmkrlib/build.cpp"
"src/cmkrlib/cmake.cpp"
"src/cmkrlib/error.cpp"
"src/cmkrlib/gen.cpp"
"src/cmkrlib/help.cpp"
"src/cmkrlib/cmake.hpp"
"src/cmkrlib/enum_helper.hpp"
"src/cmkrlib/fs.hpp"
"include/args.h"
"include/build.h"
"include/error.h"
"include/gen.h"
"include/help.h"
"include/literals.h"
cmake.toml
)
@ -55,7 +55,7 @@ target_link_libraries(cmkrlib PUBLIC
)
set(cmkr_SOURCES
src/main.cpp
"src/main.cpp"
cmake.toml
)

@ -139,7 +139,7 @@ struct Command {
std::string quote(const std::string &str) {
// Don't quote arguments that don't need quoting
if (str.find(' ') == std::string::npos && str.find('\"') == std::string::npos && str.find("${") == std::string::npos) {
if (str.find(' ') == std::string::npos && str.find('\"') == std::string::npos && str.find('/') == std::string::npos) {
return str;
}
std::string result;
@ -201,7 +201,7 @@ struct Command {
} else {
ss << ' ';
}
ss << value;
ss << quote(value);
return true;
}
@ -212,7 +212,9 @@ struct Command {
} else {
ss << ' ';
}
ss << value;
std::stringstream tmp;
tmp << value;
ss << quote(tmp.str());
return true;
}
@ -245,7 +247,7 @@ int generate_cmake(const char *path, bool root) {
}
return Command(ss, indent, command);
};
auto comment = [&ss](const char *comment) {
auto comment = [&ss](const std::string &comment) {
ss << "# " << comment << '\n';
return CommandEndl(ss);
};
@ -427,13 +429,14 @@ int generate_cmake(const char *path, bool root) {
cmd("endif")();
// clang-format on
cmd("add_subdirectory")(dir);
cmd("set")("CMAKE_FOLDER", "CMKR_CMAKE_FOLDER");
cmd("set")("CMAKE_FOLDER", "${CMKR_CMAKE_FOLDER}").endl();
}
endl();
}
if (!cmake.targets.empty()) {
for (const auto &target : cmake.targets) {
comment("Target " + target.name);
if (!target.cmake_before.empty()) {
ss << tolf(target.cmake_before) << "\n\n";
}

Loading…
Cancel
Save