summaryrefslogtreecommitdiff
path: root/Source/CMakeLists.txt
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2020-11-25 14:49:41 +0000
committerBrad King <brad.king@kitware.com>2020-11-25 10:17:29 -0500
commit34f6d767552b60436d2d6aec35ae2a3d137a8b20 (patch)
tree695a74adcc17f2751ddea560c6423f71b66e7efc /Source/CMakeLists.txt
parent9e83e77129880885d0490d6519e30c1559c5a47c (diff)
downloadcmake-34f6d767552b60436d2d6aec35ae2a3d137a8b20.tar.gz
QNX: Do not disable compiler extensions for CMake itself
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
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r--Source/CMakeLists.txt9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ba378fb292..ca56d3af99 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -2,9 +2,12 @@
# file Copyright.txt or https://cmake.org/licensing for details.
# To ensure maximum portability across various compilers and platforms
-# deactivate any compiler extensions
-set(CMAKE_C_EXTENSIONS FALSE)
-set(CMAKE_CXX_EXTENSIONS FALSE)
+# deactivate any compiler extensions. Skip this for QNX, where additional
+# work is needed to build without compiler extensions.
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "QNX")
+ set(CMAKE_C_EXTENSIONS FALSE)
+ set(CMAKE_CXX_EXTENSIONS FALSE)
+endif()
include(CheckIncludeFile)
# Check if we can build support for ELF parsing.