Skip to content

Ninja: Restore support for compilers not defining a C++ standard level

Lingkai Dong requested to merge LDong-Arm/cmake:fix-cxx20-detection into master

Since !7369 (merged) (commit 386465bf), the Ninja generator checks for C++20 support using logic that requires CMAKE_<LANG>_STANDARD_DEFAULT to be non-empty. On some compilers, such as ARMClang, CMake does not automatically detect and set default language standards, thus causing HaveStandardAvailable to raise an internal error.

To fix this issue, if CMAKE_CXX_STANDARD_DEFAULT is empty, assume all standards to be supported instead of calling HaveStandardAvailable. This is consistent with how CompileFeaturesNode::Evaluate handles this case.

Fixes: #24146 (closed)
Backport: release

Edited by Brad King

Merge request reports