From bf14f069a7407b13afce41c55621a98e0fb6692e Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sun, 2 May 2021 21:51:04 +0200 Subject: [PATCH] Minor fixes (removed TODOs and rename checks) --- src/cmkrlib/cmake.cpp | 13 ------------- src/cmkrlib/gen.cpp | 5 +++-- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/cmkrlib/cmake.cpp b/src/cmkrlib/cmake.cpp index 3042e6f..e1e040b 100644 --- a/src/cmkrlib/cmake.cpp +++ b/src/cmkrlib/cmake.cpp @@ -159,19 +159,6 @@ CMake::CMake(const std::string &path, bool build) { target.type = to_enum(toml::find(t, "type").as_string(), "target type"); get_optional(t, "sources", target.sources); - -#define renamed(from, to) \ - if (t.contains(from)) { \ - throw std::runtime_error(from "has been renamed to " to); \ - } - - renamed("include-dirs", "include-directories"); - renamed("link-libs", "link-libraries"); - renamed("defines", "compile-definitions"); - renamed("features", "compile-features"); - -#undef renamed - get_optional(t, "compile-definitions", target.compile_definitions); get_optional(t, "compile-features", target.compile_features); get_optional(t, "compile-options", target.compile_options); diff --git a/src/cmkrlib/gen.cpp b/src/cmkrlib/gen.cpp index ae708f4..d941e0a 100644 --- a/src/cmkrlib/gen.cpp +++ b/src/cmkrlib/gen.cpp @@ -41,7 +41,6 @@ static std::vector expand_cmake_path(const fs::path &name, const fs std::vector temp; auto extract_suffix = [](const fs::path &base, const fs::path &full) { - // TODO: delet this auto fullpath = full.string(); auto base_len = base.string().length(); auto delet = fullpath.substr(base_len + 1, fullpath.length() - base_len); @@ -321,7 +320,9 @@ int generate_cmake(const char *path, bool root) { auto inject_includes = [&cmd, &endl](const std::vector &includes) { if (!includes.empty()) { for (const auto &file : includes) { - // TODO: warn/error if file doesn't exist? + if (!fs::is_regular_file(file)) { + throw std::runtime_error("Include '" + file + "' does not exist"); + } cmd("include")(file); } endl();