Skip to content

Commit 42725d0

Browse files
committed
Update the README to be in sync with master
1 parent 7b7b260 commit 42725d0

File tree

1 file changed

+16
-94
lines changed

1 file changed

+16
-94
lines changed

README.md

Lines changed: 16 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
cmkr, pronounced "cmaker", is A CMakeLists.txt generator from TOML.
44

5+
See the [cmkr topic](https://github.com/topics/cmkr) for examples. Feel free to add the `cmkr` topic to your projects if you used cmkr!
56

67
## Building
8+
79
cmkr requires a C++11 compiler, cmake >= 3.15.
10+
811
```
912
git clone https://github.com/moalyousef/cmkr
1013
cd cmkr
@@ -13,7 +16,9 @@ cmake --build bin --parallel
1316
```
1417

1518
## Usage
19+
1620
cmkr parses cmake.toml files (using toml11 by Toru Niina) at the project directory. A basic hello world format with the minimum required fields:
21+
1722
```toml
1823
[cmake]
1924
minimum = "3.15"
@@ -22,106 +27,15 @@ minimum = "3.15"
2227
name = "app"
2328
version = "0.1.0"
2429

25-
[[target]]
26-
name = "app"
30+
[target.app]
2731
type = "executable"
2832
sources = ["src/main.cpp"]
2933
```
3034

31-
This project's cmake.toml:
32-
```toml
33-
[cmake]
34-
minimum = "3.15"
35-
36-
[project]
37-
name = "cmkr"
38-
version = "0.1.4"
39-
description = "CMakeLists generator from TOML"
40-
41-
[fetch-content]
42-
toml11 = { git = "https://github.com/ToruNiina/toml11" }
43-
filesystem = { git = "https://github.com/gulrak/filesystem" }
44-
mpark_variant = { url = "https://github.com/mpark/variant/archive/v1.4.0.tar.gz" }
45-
46-
[[target]]
47-
name = "cmkrlib"
48-
type = "static"
49-
sources = ["src/cmake.cpp", "src/gen.cpp", "src/help.cpp", "src/build.cpp", "src/error.cpp"]
50-
include-directories = ["include"]
51-
compile-features = ["cxx_std_11"]
52-
link-libraries = ["toml11::toml11", "ghc_filesystem"]
53-
54-
[[target]]
55-
name = "cmkr"
56-
type = "executable"
57-
sources = ["src/main.cpp", "src/args.cpp"]
58-
link-libraries = ["cmkrlib"]
59-
60-
[[install]]
61-
targets = ["cmkr"]
62-
destination = "${CMAKE_INSTALL_PREFIX}/bin"
63-
```
64-
65-
Currently supported fields:
66-
```toml
67-
[cmake] # required for top-level project
68-
minimum = "3.15" # required
69-
description = "" # optional
70-
subdirs = [] # optional
71-
build-dir = "build" # optional
72-
cpp-flags = [] # optional
73-
c-flags = [] # optional
74-
link-flags = [] # optional
75-
generator = "Ninja" # optional, only valid when run using: cmkr build
76-
config = "Release" # optional, only valid when run using: cmkr build
77-
arguments = ["CMAKE_TOOLCHAIN_FILE=/path/to/toolchain"] # optional, valid when run using: cmkr build
78-
79-
[settings] # optional
80-
CMAKE_BUILD_TYPE = "Release"
81-
TOML_BUILD_TESTS = false # optional
82-
TOML_BUILD_DOCS = { value = false, comment = "builds dependency docs", cache = true, force = true } # optional
83-
OLD_VERSION = "0.1.1" # optional
84-
85-
[project] # required per project
86-
name = "app" # required
87-
version = "0.1.0" # required
88-
89-
[find-package] # optional, runs find_package, use "*" to ignore version
90-
Boost = { version = "1.74.0", required = false, components = ["system"] } # optional
91-
spdlog = "*"
92-
93-
[fetch-content] # optional, runs fetchContent
94-
toml11 = { git = "https://github.com/ToruNiina/toml11", tag = "v3.5.0" } # optional
95-
96-
[options] # optional
97-
APP_BUILD_STUFF = false # optional
98-
APP_OTHER_STUFF = { comment = "does other stuff", value = false } # optional
99-
100-
[[target]] # required, can define several binaries
101-
name = "app" # required
102-
type = "executable" # required (executable || library || shared || static || interface)
103-
sources = ["src/*.cpp"] # required, supports globbing
104-
include-directories = ["include"] # optional
105-
alias = "" # optional
106-
compile-features = [] # optional
107-
compile-definitions = [] # optional
108-
link-libraries = [] # optional
109-
properties = { PROPERTY1 = "property1", ... } # optional
110-
111-
[[test]] # optional, can define several
112-
name = "test1" # required
113-
command = "app" # required
114-
arguments = ["arg1", "arg2"] # optional
115-
116-
[[install]] # optional, can define several
117-
targets = ["app"] # optional
118-
files = ["include/*.h"] # optional
119-
dirs = [] # optional
120-
configs = [] # optional (Release|Debug...etc)
121-
destination = "${CMAKE_INSTALL_PREFIX}/bin" # required
122-
```
35+
**NOTE**: The documentation is currently a work-in-progress due to breaking changes since `0.1.4`. For examples you can check the [cmkr topic](https://github.com/topics/cmkr).
12336

12437
The cmkr executable can be run from the command-line:
38+
12539
```
12640
Usage: cmkr [arguments]
12741
arguments:
@@ -133,28 +47,36 @@ arguments:
13347
help Show help.
13448
version Current cmkr version.
13549
```
50+
13651
The build command invokes cmake and the default build-system on your platform (unless a generator is specified), it also accepts extra cmake build arguments:
52+
13753
```
13854
cmkr build --config Release
13955
```
14056

14157
## Binary types
14258

14359
### executable
60+
14461
Executable binary. Equivalent to [add_executable(name)](https://cmake.org/cmake/help/latest/command/add_executable.html).
14562

14663
### library
64+
14765
Library, can be static or shared depending on the BUILD_SHARED_LIBS variable. Equivalent to [add_library()](https://cmake.org/cmake/help/latest/command/add_library.html).
14866

14967
### static
68+
15069
Static library/archive. Equivalent to [add_library(name STATIC)](https://cmake.org/cmake/help/latest/command/add_library.html).
15170

15271
### shared
72+
15373
Shared/dynamic library. Equivalent to [add_library(name SHARED)](https://cmake.org/cmake/help/latest/command/add_library.html).
15474

15575
### interface
76+
15677
Header-only library. Equivalent to [add_library(name INTERFACE)](https://cmake.org/cmake/help/latest/command/add_library.html).
15778

15879
## Roadmap
80+
15981
- Support more cmake fields.
16082
- Support conditional cmake args somehow!

0 commit comments

Comments
 (0)