From 9db82dfd057e293c79a21b502d2bdf46a66dca32 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Thu, 30 Dec 2021 02:43:17 +0100 Subject: [PATCH] Update toml reference --- docs/cmake-toml.md | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/docs/cmake-toml.md b/docs/cmake-toml.md index f5e826e..d00522b 100644 --- a/docs/cmake-toml.md +++ b/docs/cmake-toml.md @@ -47,6 +47,8 @@ arch64 = "CMAKE_SIZEOF_VOID_P EQUALS 8" arch32 = "CMAKE_SIZEOF_VOID_P EQUALS 4" ``` +This will make the `arch64` and `arch32` conditions available with their respective CMake expressions. + You can also prefix most keys with `condition.` to represent a conditional: ```toml @@ -56,7 +58,7 @@ sources = ["src/main.cpp"] windows.sources = ["src/windows_specific.cpp"] ``` -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): +The following conditions are predefined (you can override them if you desire): ```toml [conditions] @@ -74,7 +76,7 @@ msvc = "MSVC" ```toml [subdir.mysubdir] -condition = "linux" +condition = "mycondition" cmake-before = """ message(STATUS "CMake injected before the add_subdirectory() call" """ @@ -101,11 +103,8 @@ To specify package features you can use the following syntax: `imgui[docking-exp ## Packages ```toml -[find-package] -mypackage = { version = "1.0", required = true, config = true, components = ["mycomponent"] } - -# Alternative syntax [find-package.mypackage] +condition = "mycondition" version = "1.0" required = true config = true @@ -117,22 +116,27 @@ components = ["mycomponent"] **Note**: The `[fetch-content]` feature is unpolished and will likely change in a future release. ```toml -[fetch-content] -gitcontent = { git = "https://github.com/myuser/gitcontent", tag = "v0.1" } -svncontent = { svn = "https://svn-host.com/url", rev = "svn_rev" } -urlcontent = { url = "https://content-host.com/urlcontent.zip", hash = "123123123123" } - -# Alternative syntax [fetch-content.gitcontent] +condition = "mycondition" git = "https://github.com/myuser/gitcontent" tag = "v0.1" + +[fetch-content.svncontent] +condition = "mycondition" +svn = "https://svn-host.com/url" +rev = "svn_rev" + +[fetch-content.urlcontent] +condition = "mycondition" +url = "https://content-host.com/urlcontent.zip" +hash = "123123123123" ``` ## Targets ```toml [target.mytarget] -condition = "linux" +condition = "mycondition" alias = "mytarget::mytarget" type = "static" # executable, shared (DLL), static, interface, object, library, custom headers = ["src/mytarget.h"] @@ -180,6 +184,7 @@ FOLDER = "MyFolder" ```toml # You can declare as many as you want like this, but the name has to be unique [[test]] +condition = "mycondition" name = "mytest" command = "$" arguments = ["arg1", "arg2"] @@ -189,6 +194,7 @@ working-directory = "mytest-dir" ```toml [[install]] +condition = "mycondition" targets = ["mytarget", "mytest"] destination = ["bin"] files = ["content/my.png"]