I am trying to setup a CMake project for STM32 with FreeRtos and CMSIS. Compiling goes fine but when linking there are some errors, excerpt below:
-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
Somehow the Linker configuration seems based on Windows instead of ARM.
It is not obvious from where those Windows libraries are added. This applies to 'major-image-version' as well (searching only finds it in the build directory, not in the source directory) For this reason it seems CMake adds it.
Any suggestion where this comes from ?
To answer my own question: It built successful using a toolchain file. After this, I tried to find out which of the statements in the toolchain file caused the aforementioned linking behavior to disappear.
set(CMAKE_SYSTEM_NAME Generic)
It was already in my CMakelist.txt file. Moving it to the top of the file solved the issue.