# C++ standard to build CMake

**URL:** https://discourse.cmake.org/t/c-standard-to-build-cmake/11455
**Category:** Development
**Created:** [August 15, 2024, 4:56pm UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455 "2024-08-15T16:56:09Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![zaufi](https://discourse.cmake.org/user_avatar/discourse.cmake.org/zaufi/32/116_2.png) [@zaufi](https://discourse.cmake.org/u/zaufi)
#### Post date: [August 15, 2024, 4:56pm UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455/1 "2024-08-15T16:56:09Z")

</div>

According to my [chat w/ GPT in 2024](https://chatgpt.com/share/8b5705b6-23cb-4eff-bc40-a7b9ba4a5e11) I guess it’s quite possible to use at least C++14 to build CMake. It’s 10 years already since it was approved and seems most (all?) modern distributions have compilers with full support for it. I’m not a Windows or MAC user… but AFAIK Windows versions that are not EOL nowadays also have VS which is pretty capable of compiling C++14 as well. I guess smth similar for MACs…

So, maybe it’s time to stop limiting yourself to 13y.o. C++ standard and use smth newer?

P.S. Or maybe straight to C++ 17 which is already default in all that compilers mentioned in the table? (OK. maybe 'cept GCC 8.5 in CentOS 8, but it can compile C++17 w/ the corresponding option).

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [August 15, 2024, 5:30pm UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455/2 "2024-08-15T17:30:13Z")

</div>

We’re limited to C++11 in order to support building on older AIX and Solaris platforms whose native tooling may never be updated again.

The [CMake Source Code Guide](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Help/dev/source.rst) documents compatibility wrappers we provide to support C++14, C++17, and C++20 standard library constructs.

---

<div class="post-metadata">

### Author: ![zaufi](https://discourse.cmake.org/user_avatar/discourse.cmake.org/zaufi/32/116_2.png) [@zaufi](https://discourse.cmake.org/u/zaufi)
#### Post date: [August 15, 2024, 5:48pm UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455/3 "2024-08-15T17:48:17Z")

</div>

Except for compatibility wrappers, many other **language** features would be nice to use that can’t be “wrapped” into a compatibility header.

> We’re limited to C++11 in order to support building on older AIX and Solaris platforms whose native tooling may never be updated again.

Sorry, I didn’t get it… Why CMake code should take into account platforms that even vendors don’t care about updating? Why these platforms just can’t use current versions of CMake and need exactly the latest version of CMake???

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [August 15, 2024, 6:36pm UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455/4 "2024-08-15T18:36:22Z")

</div>

End users want to build recent software on their systems regardless of OS, and recent software may require recent CMake features to build. We’re not going to drop support for AIX and Solaris just so we can use newer C++ language features in our implementation.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [August 16, 2024, 10:29am UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455/5 "2024-08-16T10:29:43Z")

</div>

More and more project requires alt least C++17 to build.

So if some end users want to build software for AIX or Solias, the should use also use old cmake binaries!

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [August 17, 2024, 8:39am UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455/6 "2024-08-17T08:39:54Z")

</div>

Supporting “old” platforms and compilers make sense, but why imposing the constraint to be able to compile `CMake` with this environment?  
For example, on `AIX` and `Solaris`, recent versions of `gcc` are available. So maybe it is acceptable to request some recent version of `gcc` to compile `CMake`. And, of course, the produced `CMake` binary will be able to manage standard platform compilers.

With a such approach, it will be easier to update C++ standard needed for `CMake` development.

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [August 20, 2024, 4:36am UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455/7 "2024-08-20T04:36:21Z")

</div>

Also, how are AIX and Solaris users obtaining CMake? If needed, would it be possible for Kitware or volunteers to provide binaries like LLVM does for AIX?

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [August 20, 2024, 4:43am UTC](https://discourse.cmake.org/t/c-standard-to-build-cmake/11455/8 "2024-08-20T04:43:14Z")

</div>

Brad notes CMake already has replacements for necessary standard library parts of c++14 and newer.

Key benefits of upgrading the minimum C++ standard for CMake itself include newer C++ language advancements like if-initializers to constrain variable scope. I.e. that can’t be introduced like the standard library replacements.
