@@ -40,13 +40,20 @@ set(CMAKE_CXX_COMPILER_TARGET ${QNX_QCC_VARIANT})
4040# $QNX_TARGET/aarch64le
4141# $QNX_TARGET/armle-v7
4242# $QNX_TARGET/x86_64
43- set (CMAKE_SYSROOT "$ENV{QNX_TARGET} /${QNX_SYSROOT_SUFFIX} " )
43+ set (CMAKE_SYSROOT "$ENV{QNX_TARGET} " )
44+ set (CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT } " CACHE PATH "" )
45+ set (CMAKE_PREFIX_PATH ${CMAKE_SYSROOT } /${QNX_SYSROOT_SUFFIX} ; ${CMAKE_SYSROOT } /${QNX_SYSROOT_SUFFIX} /usr)
4446
45- # Make sure CMake finds things in the QNX sysroot first
46- set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
47- set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
48- set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
49- set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
47+ # Host tools only (executables used during configure/build)
48+ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
49+
50+ # Target artifacts only (resolved via sysroot / root path)
51+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
52+ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
53+ set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
54+
55+ # Avoid try_run / executable checks during configuration on a cross build.
56+ set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
5057
5158# Optional: if some projects try to use GNU ar/ranlib/nm directly, point to QNX tools
5259# But usually qcc/q++ + -V variant is enough.
@@ -57,9 +64,3 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
5764# QNX doesn’t use glibc; some ports may need feature tests or POSIX settings.
5865add_compile_definitions (_QNX_SOURCE )
5966add_compile_definitions (__GNU__ )
60-
61- # Set fPIC flag
62- set (CMAKE_POSITION_INDEPENDENT_CODE ON )
63-
64- # Do not treat include directories from the interfaces of consumed Imported Targets as system directories.
65- set (CMAKE_NO_SYSTEM_FROM_IMPORTED ON )
0 commit comments