summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@qt.io>2020-08-18 17:06:55 +0200
committerCristian Adam <cristian.adam@qt.io>2020-08-20 14:41:36 +0200
commit73277763c15c6117c14d60ac9c030d7618fa59e8 (patch)
tree8938fbe56fb0d43a2c72d4693ef322c14efc1c2d /cmake/QtBuild.cmake
parentf22ad1afec27d72c21b20a5fef4f67975cdaa46d (diff)
CMake Build: Add QNX 7.1 build support
This commit allows building Qt6's QtBase using QNX 7.1 and a toolchain file which is almost identical to what CMake has in its documentation: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-qnx set(CMAKE_SYSTEM_NAME QNX) set(arch gcc_ntoarmv7le) set(CMAKE_C_COMPILER qcc) set(CMAKE_C_COMPILER_TARGET ${arch}) set(CMAKE_CXX_COMPILER q++) set(CMAKE_CXX_COMPILER_TARGET ${arch}) set(CMAKE_SYSROOT $ENV{QNX_TARGET}) The only difference is the usage of q++ instead of QCC, which is no longer present in QNX 7.1 SDK. Task-number: QTBUG-83202 Change-Id: I51031540721275f2ee83cee9e7df4994a65db0e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r--cmake/QtBuild.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 32277a13cc..c1a14230d6 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -296,6 +296,21 @@ elseif(APPLE)
set(QT_DEFAULT_MKSPEC macx-clang)
elseif(EMSCRIPTEN)
set(QT_DEFAULT_MKSPEC wasm-emscripten)
+elseif(QNX)
+ # Certain POSIX defines are not set if we don't compile with -std=gnuXX
+ set(QT_ENABLE_CXX_EXTENSIONS ON)
+
+ list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS _FORTIFY_SOURCE=2 _REENTRANT)
+
+ set(compiler_aarch64le aarch64le)
+ set(compiler_armle-v7 armv7le)
+ set(compiler_x86-64 x86_64)
+ set(compiler_x86 x86)
+ foreach(arch aarch64le armle-v7 x86-64 x86)
+ if (CMAKE_CXX_COMPILER_TARGET MATCHES "${compiler_${arch}}")
+ set(QT_DEFAULT_MKSPEC qnx-${arch}-qcc)
+ endif()
+ endforeach()
endif()
if(NOT QT_QMAKE_TARGET_MKSPEC)