Skip to content

QNX: Do not disable compiler extensions for CMake itself

Stephen Kelly requested to merge steveire/cmake:enable-extensions-on-qnx into master

The set(CMAKE_CXX_EXTENSIONS FALSE) option has the effect of passing compile option -std=c++NN instead of -std=gnu++NN. On some platforms, the latter form (or the secondary effects that it has, such as setting _XOPEN_SOURCE) is required. This typically affects platforms such as mingw, cygwin and QNX. The GNU-like compiers default to -std=gnu++NN, which means that users can typically build source code on those platforms by default.

While the set(CMAKE_CXX_EXTENSIONS FALSE) option was set here in commit f034b0f6 (CMake compilation: do not use compiler extensions, 2020-03-14), the other changes in that commit added #defines which become required in the absense of use of -std=gnu++NN. However, only platforms regularly tested in the cmake dashboard were ported, as is reasonable. That made CMake fail to compile on QNX and perhaps other platforms which for which no one is submitting regular testing to the cmake dashboard.

Make the set(CMAKE_CXX_EXTENSIONS FALSE) option conditional on non-QNX to restore the QNX build.

Issue: #21503
Backport: release

Edited by Brad King

Merge request reports