mirror of
https://github.com/build-cpp/cmkr
synced 2026-06-08 13:22:55 +00:00
fix C++11 build
This commit is contained in:
+9
-6
@@ -3,14 +3,15 @@
|
||||
#include "gen.h"
|
||||
#include "help.h"
|
||||
|
||||
#include <exception>
|
||||
#include "fs.hpp"
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace cmkr::args {
|
||||
namespace cmkr {
|
||||
namespace args {
|
||||
const char *handle_args(int argc, char **argv) {
|
||||
std::vector<std::string> args;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
@@ -25,9 +26,10 @@ const char *handle_args(int argc, char **argv) {
|
||||
cont = true;
|
||||
auto current_path = fs::current_path();
|
||||
if (fs::exists(current_path / "CMakeLists.txt") && cont == false) {
|
||||
std::cout << "A CMakeLists.txt file already exists in the current directory.\nWould you "
|
||||
"like to overwrite it?[y/n]"
|
||||
<< std::endl;
|
||||
std::cout
|
||||
<< "A CMakeLists.txt file already exists in the current directory.\nWould you "
|
||||
"like to overwrite it?[y/n]"
|
||||
<< std::endl;
|
||||
std::string resp;
|
||||
std::cin >> resp;
|
||||
if (resp != "y")
|
||||
@@ -68,7 +70,8 @@ const char *handle_args(int argc, char **argv) {
|
||||
return "Unknown argument!";
|
||||
}
|
||||
}
|
||||
} // namespace cmkr::args
|
||||
} // namespace args
|
||||
} // namespace cmkr
|
||||
|
||||
const char *cmkr_args_handle_args(int argc, char **argv) {
|
||||
try {
|
||||
|
||||
+4
-3
@@ -10,7 +10,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <system_error>
|
||||
|
||||
namespace cmkr::build {
|
||||
namespace cmkr {
|
||||
namespace build {
|
||||
|
||||
int run(int argc, char **argv) {
|
||||
cmake::CMake cmake(".", true);
|
||||
@@ -63,8 +64,8 @@ int install() {
|
||||
auto cmd = "cmake --install " + cmake.bin_dir;
|
||||
return ::system(cmd.c_str());
|
||||
}
|
||||
|
||||
} // namespace cmkr::build
|
||||
} // namespace build
|
||||
} // namespace cmkr
|
||||
|
||||
int cmkr_build_run(int argc, char **argv) {
|
||||
try {
|
||||
|
||||
+4
-2
@@ -4,7 +4,8 @@
|
||||
#include <stdexcept>
|
||||
#include <toml.hpp>
|
||||
|
||||
namespace cmkr::cmake {
|
||||
namespace cmkr {
|
||||
namespace cmake {
|
||||
|
||||
namespace detail {
|
||||
std::vector<std::string> to_string_vec(
|
||||
@@ -233,4 +234,5 @@ CMake::CMake(const std::string &path, bool build) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace cmkr::cmake
|
||||
} // namespace cmake
|
||||
} // namespace cmkr
|
||||
|
||||
+4
-2
@@ -5,7 +5,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace cmkr::cmake {
|
||||
namespace cmkr {
|
||||
namespace cmake {
|
||||
|
||||
namespace detail {
|
||||
template <typename T, typename O>
|
||||
@@ -106,4 +107,5 @@ struct CMake {
|
||||
CMake(const std::string &path, bool build);
|
||||
};
|
||||
|
||||
} // namespace cmkr::cmake
|
||||
} // namespace cmake
|
||||
} // namespace cmkr
|
||||
+4
-2
@@ -2,7 +2,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
namespace cmkr::error {
|
||||
namespace cmkr {
|
||||
namespace error {
|
||||
|
||||
Status::Status(Code ec) noexcept : ec_(ec) {}
|
||||
|
||||
@@ -10,7 +11,8 @@ Status::operator int() const noexcept { return static_cast<int>(ec_); }
|
||||
|
||||
Status::Code Status::code() const noexcept { return ec_; }
|
||||
|
||||
} // namespace cmkr::error
|
||||
} // namespace error
|
||||
} // namespace cmkr
|
||||
|
||||
const char *err_string[] = {
|
||||
"Success", "Runtime error", "Initialization error", "CMake generation error", "Build error",
|
||||
|
||||
+4
-2
@@ -12,7 +12,8 @@
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
namespace cmkr::gen {
|
||||
namespace cmkr {
|
||||
namespace gen {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -394,7 +395,8 @@ int generate_cmake(const char *path) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace cmkr::gen
|
||||
} // namespace gen
|
||||
} // namespace cmkr
|
||||
|
||||
int cmkr_gen_generate_project(const char *typ) {
|
||||
try {
|
||||
|
||||
+4
-2
@@ -1,6 +1,7 @@
|
||||
#include "help.h"
|
||||
|
||||
namespace cmkr::help {
|
||||
namespace cmkr {
|
||||
namespace help {
|
||||
|
||||
const char *version() noexcept { return "cmkr version 0.1.2"; }
|
||||
|
||||
@@ -17,7 +18,8 @@ arguments:
|
||||
version Current cmkr version.
|
||||
)lit";
|
||||
}
|
||||
} // namespace cmkr::help
|
||||
} // namespace help
|
||||
} // namespace cmkr
|
||||
|
||||
const char *cmkr_help_version(void) { return cmkr::help::version(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user