UNIX Target system internal flag not working when crosscompiling
I am crosscompiling for QNX on Windows and Linux, and noticed that the UNIX flag is not properly set nor detected, and therefore all crosscompiling projects relying on if(UNIX)
checks are silently failing, unless the user notices and forces -DUNIX=ON on their call to cmake.
I have attached a very simple reproduction package including build scripts for Windows and Bash at reproUNIXFlagProblem.zip.
In principle UNIX is set to 1 at Platform/UnixPaths.cmake
, which is called indirectly after adding include(Platform/QNX)
in my toolchain file. I have debugged a bit, and the line set(UNIX 1)
is actually executed, but it is somehow later reverted to its original value before continuing the execution of the main CMakeLists.txt.