From 0e2cddcbe6bc077120381529a6002206b1363ae5 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Tue, 16 Mar 2021 16:36:23 +0100 Subject: [PATCH] Add support for include-before and include-after --- src/cmkrlib/cmake.cpp | 10 ++++++++-- src/cmkrlib/cmake.hpp | 6 ++++-- src/cmkrlib/gen.cpp | 25 +++++++++++++++++++++---- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/cmkrlib/cmake.cpp b/src/cmkrlib/cmake.cpp index 033f738..420bb68 100644 --- a/src/cmkrlib/cmake.cpp +++ b/src/cmkrlib/cmake.cpp @@ -71,8 +71,14 @@ CMake::CMake(const std::string &path, bool build) { if (toml.contains("project")) { const auto &project = toml::find(toml, "project"); - proj_name = toml::find(project, "name").as_string(); - proj_version = toml::find(project, "version").as_string(); + project_name = toml::find(project, "name").as_string(); + project_version = toml::find(project, "version").as_string(); + if (project.contains("include-before")) { + include_before = detail::to_string_vec(toml::find(project, "include-before").as_array()); + } + if (project.contains("include-after")) { + include_after = detail::to_string_vec(toml::find(project, "include-after").as_array()); + } } if (toml.contains("settings")) { diff --git a/src/cmkrlib/cmake.hpp b/src/cmkrlib/cmake.hpp index f510eb8..294b5b4 100644 --- a/src/cmkrlib/cmake.hpp +++ b/src/cmkrlib/cmake.hpp @@ -67,8 +67,10 @@ struct CMake { std::vector linkflags; std::vector gen_args; std::vector build_args; - std::string proj_name; - std::string proj_version; + std::string project_name; + std::string project_version; + std::vector include_before; + std::vector include_after; std::vector settings; std::vector