From 2bcf15c4edf337459140de5211d80ebd8968f4ee Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Thu, 23 Dec 2021 00:00:41 +0100 Subject: [PATCH] Add support for object libraries Closes #34 --- include/project_parser.hpp | 1 + src/cmake_generator.cpp | 6 ++++++ src/project_parser.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/project_parser.hpp b/include/project_parser.hpp index f065ccb..5a19605 100644 --- a/include/project_parser.hpp +++ b/include/project_parser.hpp @@ -45,6 +45,7 @@ enum TargetType { target_static, target_interface, target_custom, + target_object, }; template diff --git a/src/cmake_generator.cpp b/src/cmake_generator.cpp index 4f55433..639ef28 100644 --- a/src/cmake_generator.cpp +++ b/src/cmake_generator.cpp @@ -766,6 +766,12 @@ void generate_cmake(const char *path, const parser::Project *parent_project) { target_type = "SOURCES"; target_scope = "PUBLIC"; break; + case parser::target_object: + // NOTE: This is properly supported since 3.12 + add_command = "add_library"; + target_type = "OBJECT"; + target_scope = "PUBLIC"; + break; default: assert("Unimplemented enum value" && false); } diff --git a/src/project_parser.cpp b/src/project_parser.cpp index b18d827..b3d7ef7 100644 --- a/src/project_parser.cpp +++ b/src/project_parser.cpp @@ -9,7 +9,7 @@ #include template <> -const char *enumStrings::data[] = {"executable", "library", "shared", "static", "interface", "custom"}; +const char *enumStrings::data[] = {"executable", "library", "shared", "static", "interface", "custom", "object"}; namespace cmkr { namespace parser {