Minor fixes (removed TODOs and rename checks)

vcpkg-wip
Duncan Ogilvie 4 years ago
parent 3b4bc919a1
commit bf14f069a7

@ -159,19 +159,6 @@ CMake::CMake(const std::string &path, bool build) {
target.type = to_enum<TargetType>(toml::find(t, "type").as_string(), "target type"); target.type = to_enum<TargetType>(toml::find(t, "type").as_string(), "target type");
get_optional(t, "sources", target.sources); 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-definitions", target.compile_definitions);
get_optional(t, "compile-features", target.compile_features); get_optional(t, "compile-features", target.compile_features);
get_optional(t, "compile-options", target.compile_options); get_optional(t, "compile-options", target.compile_options);

@ -41,7 +41,6 @@ static std::vector<std::string> expand_cmake_path(const fs::path &name, const fs
std::vector<std::string> temp; std::vector<std::string> temp;
auto extract_suffix = [](const fs::path &base, const fs::path &full) { auto extract_suffix = [](const fs::path &base, const fs::path &full) {
// TODO: delet this
auto fullpath = full.string(); auto fullpath = full.string();
auto base_len = base.string().length(); auto base_len = base.string().length();
auto delet = fullpath.substr(base_len + 1, fullpath.length() - base_len); 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<std::string> &includes) { auto inject_includes = [&cmd, &endl](const std::vector<std::string> &includes) {
if (!includes.empty()) { if (!includes.empty()) {
for (const auto &file : includes) { 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); cmd("include")(file);
} }
endl(); endl();

Loading…
Cancel
Save