/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file LICENSE.rst or https://cmake.org/licensing for details. */ #pragma once #include #include #include #include #include #include class cmTarget; class cmCxxModuleMetadata { public: struct PreprocessorDefineData { std::string Name; cm::optional Value; bool Undef = false; cm::optional Vendor; }; struct LocalArgumentsData { std::vector IncludeDirectories; std::vector SystemIncludeDirectories; std::vector Definitions; cm::optional Vendor; }; struct ModuleData { std::string LogicalName; std::string SourcePath; bool IsInterface = true; bool IsStdLibrary = false; cm::optional LocalArguments; cm::optional Vendor; }; int Version = 0; int Revision = 0; std::vector Modules; std::string MetadataFilePath; std::unordered_map Extensions; struct ParseResult; struct SaveResult { bool Ok = false; std::string Error; explicit operator bool() const { return Ok; } }; static ParseResult LoadFromFile(std::string const& path); static Json::Value ToJsonValue(cmCxxModuleMetadata const& meta); static SaveResult SaveToFile(std::string const& path, cmCxxModuleMetadata const& meta); static void PopulateTarget(cmTarget& target, cmCxxModuleMetadata const& meta, std::vector const& configs); static void PopulateTarget(cmTarget& target, cmCxxModuleMetadata const& meta, cm::string_view config) { PopulateTarget(target, meta, std::vector{ std::string(config) }); } static void PopulateTarget(cmTarget& target, cmCxxModuleMetadata const& meta) { PopulateTarget(target, meta, "NOCONFIG"); } }; struct cmCxxModuleMetadata::ParseResult { cm::optional Meta; std::string Error; explicit operator bool() const { return static_cast(Meta); } };