In the toolchain I am trying to set the compile setting to set(CMAKE_CXX_COMPILE_OPTIONS_PIE "-fpie") small fpie.
But it has no effect when set in the toolchain.
Only when I set it in the project itself.
You will see the verbose output the flag “-fPIE”, instead in the toolchain file I set it to: “-fpie”
In the project you can uncomment “# set(CMAKE_CXX_COMPILE_OPTIONS_PIE “-fpie”)”
then it will work.
Is this a bug?
Enable the trace output and see what sets it. I doubt that setting this is valid in a toolchain file. The project() calls evaluates the compiler afterwards and then this is set to the correct value by compiler.
According to gcc documentation, -fPIE always works while -fpie may not work on some architectures. Why do you want the latter?
Wen enable the trace output, I only see the toolchain.cmake(1): set(CMAKE_CXX_COMPILE_OPTIONS_PIE -fpie )
We are using some QNX compiler which uses some other flags, when compiled in safety mode.
What is so special about the project() call? I mean I expect that I can via toolchain all compiler settings and flags, right?