Skip to content

Commit c3335be

Browse files
committed
Only explicitly enable developer mode
Remove check for the `CI` environment variable when declaring the developer mode option to avoid enabling it when the project is built on a CI server from source by 3rd parties.
1 parent ea3c4b6 commit c3335be

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

cmake-init/templates/common/CMakePresets.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
"patch": 0
77
},
88
"configurePresets": [
9+
{
10+
"name": "dev-mode",
11+
"hidden": true,
12+
"cacheVariables": {
13+
"%(name)s_DEVELOPER_MODE": "ON"
14+
}
15+
},
916
{
1017
"name": "cppcheck",
1118
"hidden": true,
@@ -58,7 +65,7 @@
5865
},
5966
{
6067
"name": "ci-coverage",
61-
"inherits": "ci-unix",
68+
"inherits": ["ci-unix", "dev-mode"],
6269
"cacheVariables": {
6370
"CMAKE_BUILD_TYPE": "Coverage",
6471
"CMAKE_CXX_FLAGS_COVERAGE": "-O0 -g --coverage -fkeep-inline-functions -fkeep-static-functions",
@@ -68,23 +75,23 @@
6875
},
6976
{
7077
"name": "ci-sanitizer",
71-
"inherits": "ci-unix",
78+
"inherits": ["ci-unix", "dev-mode"],
7279
"cacheVariables": {
7380
"CMAKE_BUILD_TYPE": "Sanitizer",
7481
"CMAKE_CXX_FLAGS_SANITIZER": "-O2 -g -fsanitize=$env{SANITIZER} -fno-omit-frame-pointer $env{EXTRA_FLAGS}"
7582
}
7683
},
7784
{
7885
"name": "ci-macos",
79-
"inherits": "ci-unix"
86+
"inherits": ["ci-unix", "dev-mode"]
8087
},
8188
{
8289
"name": "ci-ubuntu",
83-
"inherits": ["ci-unix", "clang-tidy", "cppcheck"]
90+
"inherits": ["ci-unix", "clang-tidy", "cppcheck", "dev-mode"]
8491
},
8592
{
8693
"name": "ci-windows",
87-
"inherits": "ci-win64"
94+
"inherits": ["ci-win64", "dev-mode"]
8895
}
8996
]
9097
}

cmake-init/templates/common/CMakeUserPresets.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
"configurePresets": [
99
{
1010
"name": "dev",
11-
"inherits": ["ci-%(os)s"{if use_clang_tidy}, "clang-tidy"{end}{if use_cppcheck}, "cppcheck"{end}],
11+
"inherits": ["dev-mode", "ci-%(os)s"{if use_clang_tidy}, "clang-tidy"{end}{if use_cppcheck}, "cppcheck"{end}],
1212
"cacheVariables": {
13-
"%(name)s_DEVELOPER_MODE": "ON",
1413
"BUILD_DOCUMENTATION": "ON"
1514
}
1615
}

cmake-init/templates/common/HACKING.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ option makes tests and other developer targets and options available. Not
1414
enabling this option means that you are a consumer of this project and thus you
1515
have no need for these targets and options.
1616

17-
Developer mode is forced to be on when the `CI` environment variable is set to
18-
a value that CMake recognizes as "on", which is set to `true` in all of the CI
19-
workflows.
17+
Developer mode is always set to on in CI workflows.
2018

2119
### Presets
2220

@@ -42,10 +40,7 @@ the project:
4240
"configurePresets": [
4341
{
4442
"name": "dev",
45-
"inherits": ["ci-<os>"],
46-
"cacheVariables": {
47-
"%(name)s_DEVELOPER_MODE": "ON"
48-
}
43+
"inherits": ["dev-mode", "ci-<os>"]
4944
}
5045
]
5146
}

cmake-init/templates/common/cmake/variables.cmake

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
# Targets necessary to build the project must be provided unconditionally, so
66
# consumers can trivially build and package the project
77
if(PROJECT_IS_TOP_LEVEL)
8-
option(%(name)s_DEVELOPER_MODE "Enable developer mode" OFF)
9-
{type shared} option(BUILD_SHARED_LIBS "Build shared libs." OFF){end}
10-
if("$ENV{CI}")
11-
set(%(name)s_DEVELOPER_MODE ON CACHE INTERNAL "")
12-
endif()
8+
option(%(name)s_DEVELOPER_MODE "Enable developer mode" OFF){type shared}
9+
option(BUILD_SHARED_LIBS "Build shared libs." OFF){end}
1310
endif()
1411

1512
{type shared}# ---- Suppress C4251 on Windows ----

0 commit comments

Comments
 (0)