# Moving from CMake 3.21.2 to 4.0.1 and now CXX\_STANDARD only seems to partially work?

**URL:** https://discourse.cmake.org/t/moving-from-cmake-3-21-2-to-4-0-1-and-now-cxx-standard-only-seems-to-partially-work/13930
**Category:** Usage
**Created:** [April 14, 2025, 6:26pm UTC](https://discourse.cmake.org/t/moving-from-cmake-3-21-2-to-4-0-1-and-now-cxx-standard-only-seems-to-partially-work/13930 "2025-04-14T18:26:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Gazoo101](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gazoo101/32/5505_2.png) [@Gazoo101](https://discourse.cmake.org/u/Gazoo101)
#### Post date: [April 14, 2025, 6:26pm UTC](https://discourse.cmake.org/t/moving-from-cmake-3-21-2-to-4-0-1-and-now-cxx-standard-only-seems-to-partially-work/13930/1 "2025-04-14T18:26:38Z")

</div>

Hello Y’all,

I’m moving my MSVC based project from my old PC to a new one. In the process I’m upgrading some build software alongside it, such as CMake which on my old machine is `3.21.2` and on the new one `4.0.1`.

I used to set the C++ standard on 3 different projects in my solution, but now, only the very last target appears to actually take/listen to CMake’s `CXX_STANDARD`. I’ve had to update boost and change some other parts, but nothing I’d imagine should affect the standard being set.

No matter what I’ve tried, the C++ standard remains C++17 on the first 2 targets, but the last one to be set will happily switch to C++20 or even C++23.

Anyone else run into this issue?

Cheers,  
gazoo

---

<div class="post-metadata">

### Author: ![LegalizeAdulthood](https://discourse.cmake.org/user_avatar/discourse.cmake.org/legalizeadulthood/32/5282_2.png) [@LegalizeAdulthood](https://discourse.cmake.org/u/LegalizeAdulthood)
#### Post date: [April 14, 2025, 11:28pm UTC](https://discourse.cmake.org/t/moving-from-cmake-3-21-2-to-4-0-1-and-now-cxx-standard-only-seems-to-partially-work/13930/2 "2025-04-14T23:28:55Z")

</div>

See if you can produce a minimal reproducer and post a link to godbolt or a github gist or somethign.

---

<div class="post-metadata">

### Author: ![Gazoo101](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gazoo101/32/5505_2.png) [@Gazoo101](https://discourse.cmake.org/u/Gazoo101)
#### Post date: [April 18, 2025, 2:55pm UTC](https://discourse.cmake.org/t/moving-from-cmake-3-21-2-to-4-0-1-and-now-cxx-standard-only-seems-to-partially-work/13930/3 "2025-04-18T14:55:11Z")

</div>

Turns out the culprit was a library I’m linking with had set `INTERFACE_COMPILE_OPTIONS` to `/std:c++17`, which ultimately was inherited overriding/preventing the `CXX_STANDARD` property from having any influence on the target I wanted it to impact.

I think the older CMake is more lax here either not setting that flag on the `INTERFACE_COMPILE_OPTIONS` or perhaps just letting `CXX_STANDARD` interfere/override the setting.

Cheers,  
Gazoo
