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>
bb10
Cristian Adam 2020-08-18 17:06:55 +02:00
parent f22ad1afec
commit 73277763c1
1 changed files with 15 additions and 0 deletions

View File

@ -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)