QNX_HOST environment variable not set

I am compiling mlpack using QNX.Keep reporting the following errors:
CMake Error at CMakeLists.txt:28 (message):QNX_HOST environment variable not set!!!
I have added the following to CMakeLists.txt:
set (QNX_HOST “/data/QNX/qnx700/host/linux”)
set (QNX_TARGET “/data/QNX/qnx700/target/qnx7”)
But it still reports an error.
Does anyone know what I should do ?

If you want to set an environment variable, you need to use the ENV{...} syntax. See https://cmake.org/cmake/help/latest/command/set.html#set-environment-variable for more details.

I have added the following content to CMakeLists.txt, but still report an error–“error: environment variables QNX_HOST and QNX_TARGET not defined”:

set(QNX_HOST “$ENV{QNX_HOST}”)
set(QNX_TARGET “$ENV{QNX_TARGET}”)
message(STATUS “")
message(STATUS “${QNX_HOST}”)
message(STATUS “${QNX_TARGET}”)
message(STATUS "
”)
#Check environment variables
if ("$ENV{QNX_HOST}" STREQUAL “”)
#message(FATAL_ERROR “QNX_HOST environment variable not set”)
endif()

if ("$ENV{QNX_TARGET}" STREQUAL “”)
#message(FATAL_ERROR “QNX_TARGET environment variable not set”)
endif()

And I also have set “source /etc/bash.bashrc_qnx qnx_aarch64”.

This bug has not been solved yet, which is described in more detail.qnx - QNX_HOST environment variable not set - Stack Overflow

The toolchain must be set up outside of CMake; CMake cannot make environment settings available during the build for every generator, so it doesn’t provide such support. See this thread for more discussion of this.