# Determining the compiler default C++ standard

**URL:** https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389
**Category:** Usage
**Created:** [March 18, 2024, 10:41am UTC](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389 "2024-03-18T10:41:45Z")
**Posts on this page:** 4
**Page:** 2

<div class="post-metadata">

### Author: ![redbaron](https://discourse.cmake.org/user_avatar/discourse.cmake.org/redbaron/32/2129_2.png) [@redbaron](https://discourse.cmake.org/u/redbaron)
#### Post date: [October 1, 2024, 12:59pm UTC](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389/21 "2024-10-01T12:59:02Z")

</div>

> [@Determining the compiler default C++ standard](#):
>
> or set(CMAKE\_CXX\_STANDARD 14) before creating the target.

This is exactly what `cmake -DCMAKE_CXX_STANDARD=14` does, but without editing any files (provided there is no `set` call in file already, which in my case there isn’t)

---

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [October 1, 2024, 1:08pm UTC](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389/22 "2024-10-01T13:08:08Z")

</div>

My bad, I overlooked the second part of Brad King answer…

---

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [October 10, 2024, 12:02pm UTC](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389/23 "2024-10-10T12:02:10Z")

</div>

I’ve just see a detail in [Determining the compiler default C++ standard - #12 by brad.king](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389/12). One version must be done before creation target, the other after. Is it meaningful in your case?

---

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [October 10, 2024, 12:03pm UTC](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389/24 "2024-10-10T12:03:31Z")

</div>

missing “after creating the target” (obviously) for second item

[Previous page](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389.md?page=1)
