Skip to content

Commit 9db82df

Browse files
committed
Update toml reference
1 parent 459ebb1 commit 9db82df

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

docs/cmake-toml.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ arch64 = "CMAKE_SIZEOF_VOID_P EQUALS 8"
4747
arch32 = "CMAKE_SIZEOF_VOID_P EQUALS 4"
4848
```
4949

50+
This will make the `arch64` and `arch32` conditions available with their respective CMake expressions.
51+
5052
You can also prefix most keys with `condition.` to represent a conditional:
5153

5254
```toml
@@ -56,7 +58,7 @@ sources = ["src/main.cpp"]
5658
windows.sources = ["src/windows_specific.cpp"]
5759
```
5860

59-
This will make the `arch64` and `arch32` conditions available with their respective CMake expressions. The following conditions are predefined (you can override them if you desire):
61+
The following conditions are predefined (you can override them if you desire):
6062

6163
```toml
6264
[conditions]
@@ -74,7 +76,7 @@ msvc = "MSVC"
7476

7577
```toml
7678
[subdir.mysubdir]
77-
condition = "linux"
79+
condition = "mycondition"
7880
cmake-before = """
7981
message(STATUS "CMake injected before the add_subdirectory() call"
8082
"""
@@ -101,11 +103,8 @@ To specify package features you can use the following syntax: `imgui[docking-exp
101103
## Packages
102104

103105
```toml
104-
[find-package]
105-
mypackage = { version = "1.0", required = true, config = true, components = ["mycomponent"] }
106-
107-
# Alternative syntax
108106
[find-package.mypackage]
107+
condition = "mycondition"
109108
version = "1.0"
110109
required = true
111110
config = true
@@ -117,22 +116,27 @@ components = ["mycomponent"]
117116
**Note**: The `[fetch-content]` feature is unpolished and will likely change in a future release.
118117

119118
```toml
120-
[fetch-content]
121-
gitcontent = { git = "https://github.com/myuser/gitcontent", tag = "v0.1" }
122-
svncontent = { svn = "https://svn-host.com/url", rev = "svn_rev" }
123-
urlcontent = { url = "https://content-host.com/urlcontent.zip", hash = "123123123123" }
124-
125-
# Alternative syntax
126119
[fetch-content.gitcontent]
120+
condition = "mycondition"
127121
git = "https://github.com/myuser/gitcontent"
128122
tag = "v0.1"
123+
124+
[fetch-content.svncontent]
125+
condition = "mycondition"
126+
svn = "https://svn-host.com/url"
127+
rev = "svn_rev"
128+
129+
[fetch-content.urlcontent]
130+
condition = "mycondition"
131+
url = "https://content-host.com/urlcontent.zip"
132+
hash = "123123123123"
129133
```
130134

131135
## Targets
132136

133137
```toml
134138
[target.mytarget]
135-
condition = "linux"
139+
condition = "mycondition"
136140
alias = "mytarget::mytarget"
137141
type = "static" # executable, shared (DLL), static, interface, object, library, custom
138142
headers = ["src/mytarget.h"]
@@ -180,6 +184,7 @@ FOLDER = "MyFolder"
180184
```toml
181185
# You can declare as many as you want like this, but the name has to be unique
182186
[[test]]
187+
condition = "mycondition"
183188
name = "mytest"
184189
command = "$<TARGET_FILE:mytest>"
185190
arguments = ["arg1", "arg2"]
@@ -189,6 +194,7 @@ working-directory = "mytest-dir"
189194

190195
```toml
191196
[[install]]
197+
condition = "mycondition"
192198
targets = ["mytarget", "mytest"]
193199
destination = ["bin"]
194200
files = ["content/my.png"]

0 commit comments

Comments
 (0)