I have the following problem:
I'm using CMake to make a build configuration for my embedded project. To do this, I'm utilizing a CMakeLists.txt file together with a flags.cmake and armgcc.cmake toolchain file where I configure the usage of the arm-none-eabi-gcc compiler.
I invoke cmake with the following command:
cmake -DCMAKE_TOOLCHAIN_FILE="armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug
But when I try to run this I get the error message:
-- Check for working C compiler: .../10 2021.10/bin/arm-none-eabi-gcc.exe - broken
CMake Error at .../CMake/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
".../10 2021.10/bin/arm-none-eabi-gcc.exe"
is not able to compile a simple test program.
In the official documentation regarding cross compilation, it says that I have to add
set(CMAKE_SYSTEM_NAME Generic)
to enable cross compilation.
I added this command on top of the armgcc.cmake file as well as the CMakeLists file but get the same error.
Only when I add
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)
to my armgcc.cmake file, the test is skipped and everything configures and builds fine.
Can someone tell me if I misunderstood something or am doing something wrong? Why is the official CMAKE_SYSTEM_NAME approach not working for me? The documentation states that the forced approach should not be used for versions newer than 3.6. but without it I am not able to get it running.
Thanks in advance :) Best regards Evox