Skip to content

Commit 72f810d

Browse files
committed
Generalize C++ flags in presets
Standard exceptions should always be enabled on Windows and the flag presets were renamed to make it clear that these are the presets that ought to hold any and all flags used by default.
1 parent d475b2c commit 72f810d

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

cmake-init/__main__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ def ask(*args, **kwargs):
115115
),
116116
"examples": False,
117117
"os": "windows" if os.name == "nt" else "unix",
118-
"win_flags": "warnings",
119-
"win_extra_flags": "",
120118
}
121119
d["uc_name"] = d["name"].upper().replace("-", "_")
122120
if d["type_id"] != "e":
@@ -126,9 +124,6 @@ def ask(*args, **kwargs):
126124
mapper=lambda v: v[0:1].lower(),
127125
predicate=lambda v: v in ["y", "n"],
128126
)
129-
else:
130-
d["win_flags"] = "flags"
131-
d["win_extra_flags"] = " /EHsc"
132127
return d
133128

134129

cmake-init/templates/common/CMakePresets.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
},
88
"configurePresets": [
99
{
10-
"name": "warnings-unix",
10+
"name": "flags-unix",
1111
"hidden": true,
1212
"cacheVariables": {
1313
"CMAKE_CXX_FLAGS": "-Wall -Wextra -pedantic"
1414
}
1515
},
1616
{
17-
"name": "%(win_flags)s-windows",
17+
"name": "flags-windows",
1818
"hidden": true,
1919
"cacheVariables": {
20-
"CMAKE_CXX_FLAGS": "/W4 /permissive-%(win_extra_flags)s"
20+
"CMAKE_CXX_FLAGS": "/W4 /permissive- /EHsc"
2121
}
2222
},
2323
{
@@ -29,7 +29,7 @@
2929
"name": "ci-unix",
3030
"generator": "Unix Makefiles",
3131
"hidden": true,
32-
"inherits": ["warnings-unix", "ci-build"],
32+
"inherits": ["flags-unix", "ci-build"],
3333
"cacheVariables": {
3434
"CMAKE_BUILD_TYPE": "Release"
3535
}
@@ -44,7 +44,7 @@
4444
},
4545
{
4646
"name": "ci-windows",
47-
"inherits": ["%(win_flags)s-windows", "ci-build"],
47+
"inherits": ["flags-windows", "ci-build"],
4848
"generator": "Visual Studio 16 2019",
4949
"architecture": "x64"
5050
}

0 commit comments

Comments
 (0)