We need to generate a "response file" to pass to the C preprocessor
when we preprocess the linker script, because of path length limitations
on Windows. We set the response file and bind the path to a global
property. The MBED_TARGET being built queries this global property when
it sets the linker script.
We must set this global property before the targets subdirectory is
added to the project. This is required because the MBED_TARGET depends
on the response file. If the path to the response file is not defined
when the target requests it the config definitions will not be passed
to CPP.
Issue https://gitlab.kitware.com/cmake/cmake/-/issues/21093
Until this is fixed, we should disable response files for ARMClang + ninja on Windows.
Other toolchains and host systems should benefit from response files thus not disabling them
completely.
This fixes the issue with not finding includes. It's not trivial to find the root cause, it took me a while to figure out why ARMClang can't find the paths.
I moved the check to Mbed OS main cmake. It should not be in the toolchain file as it is not
related to the toolchain but to generator. We need toolchain properly set up first.
Note, I had to protect setting CMAKE_NINJA_FORCE_RESPONSE_FILE. If I set it to 0, ninja
would still use rsp files so I rather protected it and define that variable only when
required, not always.
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>