Skip to content

Commit 0a446a3

Browse files
cmake: Add dev-mode CMake preset
To use, invoke `cmake` with argument `--preset dev-mode`. Solves one item in bitcoin-core#1235. One disadvantage over `./configure --enable-dev-mode` is that CMake does not provide a way to "hide" presets from users. That is, `cmake --list-presets` will list dev-mode, and it will also appear in `cmake-gui`, even though it's not selectable there due to bug https://gitlab.kitware.com/cmake/cmake/-/issues/23341. (So in our case, that's probably rather a feature than a bug.) We curently use version 3 presets which require CMake 3.21+. Unfortunately, CMake versions before 3.19 may ignore the `--preset` argument silently. So if the preset is not picked up, make sure you have a recent enough CMake version. More unfortunately, we can't even spell this warning out in CMakePresets.json because CMake does not support officially support comments in JSON, see - https://gitlab.kitware.com/cmake/cmake/-/issues/21858 - https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5853 . We could use a hack hinted at in https://gitlab.kitware.com/cmake/cmake/-/issues/21858#note_908543 but that's risky, because it could simply break for future versions, and we probably want to use presets not only for dev mode.
1 parent 5658209 commit 0a446a3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

CMakePresets.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"cmakeMinimumRequired": {"major": 3, "minor": 21, "patch": 0},
3+
"version": 3,
4+
"configurePresets": [
5+
{
6+
"name": "dev-mode",
7+
"displayName": "Development mode (intended only for developers of the library)",
8+
"cacheVariables": {
9+
"SECP256K1_EXPERIMENTAL": "ON",
10+
"SECP256K1_ENABLE_MODULE_RECOVERY": "ON",
11+
"SECP256K1_BUILD_EXAMPLES": "ON"
12+
},
13+
"warnings": {
14+
"dev": true,
15+
"uninitialized": true
16+
}
17+
}
18+
]
19+
}

0 commit comments

Comments
 (0)