You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Automatically generated from tests/compile-options/cmake.toml - DO NOT EDIT
3
+
layout: default
4
+
title: Compiler flags
5
+
permalink: /examples/compile-options
6
+
parent: Examples
7
+
nav_order: 9
8
+
---
9
+
10
+
# Compiler flags
11
+
12
+
Example project that sets compiler/linker flags for various platforms.
13
+
14
+
```toml
15
+
[project]
16
+
name = "compile-options"
17
+
description = "Compiler flags"
18
+
19
+
[target.hello]
20
+
type = "executable"
21
+
sources = ["src/main.cpp"]
22
+
msvc.compile-options = ["/W2"]
23
+
gcc.compile-options = ["-Wall"]
24
+
clang.compile-options = ["-Wall"]
25
+
```
26
+
27
+
The `hello` target uses [conditions](/cmake-toml#conditions) to set different compiler flags depending on the platform. See the [targets](/cmake-toml/#targets) documentation for other things you can set.
28
+
29
+
_Note_: In general you only want to specify flags _required_ to compile your code without errors.
30
+
31
+
<sup><sub>This page was automatically generated from [tests/compile-options/cmake.toml](https://github.com/build-cpp/cmkr/tree/main/tests/compile-options/cmake.toml).</sub></sup>
# Example project that sets compiler/linker flags for various platforms.
2
+
3
+
[project]
4
+
name = "compile-options"
5
+
description = "Compiler flags"
6
+
7
+
[target.hello]
8
+
type = "executable"
9
+
sources = ["src/main.cpp"]
10
+
msvc.compile-options = ["/W2"]
11
+
gcc.compile-options = ["-Wall"]
12
+
clang.compile-options = ["-Wall"]
13
+
14
+
# The `hello` target uses [conditions](/cmake-toml#conditions) to set different compiler flags depending on the platform. See the [targets](/cmake-toml/#targets) documentation for other things you can set.
15
+
# _Note_: In general you only want to specify flags _required_ to compile your code without errors.
0 commit comments