refactor generate_project code

This commit is contained in:
MoAlyousef
2020-09-11 18:01:26 +03:00
parent 76a4367b57
commit 4688ba718c
4 changed files with 78 additions and 44 deletions
+4 -1
View File
@@ -1,5 +1,6 @@
#include "build.h"
#include "error.h"
#include "gen.h"
#include <filesystem>
#include <sstream>
@@ -14,8 +15,10 @@ namespace cmkr::build {
int run(int argc, char **argv) {
std::stringstream ss;
std::string bin_dir = "bin";
if (!std::filesystem::exists("CMakeLists.txt"))
throw std::runtime_error("No valid CMakeLists.txt found!");
if (gen::generate_cmake("."))
throw std::runtime_error("CMake generation failure!");
const auto toml = toml::parse("cmake.toml");
if (toml.contains("cmake")) {