parent
1ab5e3f9f7
commit
3ca8866752
@ -0,0 +1,91 @@
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
IncludeBlocks: Preserve
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
@ -1 +1,2 @@
|
||||
bin
|
||||
bin
|
||||
compile_commands.json
|
||||
|
@ -1,10 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(cmk)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(CMK_SRCS
|
||||
src/main.cpp
|
||||
)
|
||||
|
||||
add_executable(cmk ${CMK_SRCS})
|
||||
|
||||
target_compile_features(cmk PRIVATE cxx_std_17)
|
||||
target_include_directories(cmk PRIVATE ${CMAKE_CURRENT_LIST_DIR}/vendor)
|
@ -0,0 +1,13 @@
|
||||
[cmake]
|
||||
minimum_required = "3.0"
|
||||
|
||||
[project]
|
||||
name = "cmk"
|
||||
version = "0.1.0"
|
||||
authors = ["MoAlyousef <mohammed.alyousef@neurosrg.com>"]
|
||||
|
||||
[[executable]]
|
||||
name = "cmk"
|
||||
sources = ["src/main.cpp"]
|
||||
include_directories = ["vendor"]
|
||||
compile_features = ["cxx_std_17"]
|
@ -1 +1,26 @@
|
||||
int main() {}
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <toml.hpp>
|
||||
#include <vector>
|
||||
|
||||
int main(int argc, char **argv) try {
|
||||
std::vector<std::string> args;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
args.push_back(argv[i]);
|
||||
const auto data = toml::parse("../cmake.toml");
|
||||
const auto &cmake = toml::find(data, "cmake");
|
||||
const auto cmake_min = toml::find(cmake, "minimum_required");
|
||||
const auto &project = toml::find(data, "project");
|
||||
const auto name = toml::find(project, "name");
|
||||
const auto version = toml::find(project, "version");
|
||||
const auto &bin = toml::find(data, "executable");
|
||||
const auto bin1 = toml::find(bin, 0);
|
||||
const auto bin1_name = toml::find(bin1, "name");
|
||||
std::cout << cmake_min << std::endl;
|
||||
std::cout << name << std::endl;
|
||||
std::cout << version << std::endl;
|
||||
std::cout << bin.size() << std::endl;
|
||||
std::cout << bin1_name << std::endl;
|
||||
} catch (const std::exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
Loading…
Reference in new issue