(Ninja generator) Precise control over command line

Hi there,
I’m in the unfortunate position that I need to produce particular build rules given my specific build tools.

I’m using CMake + Ninja Generator in a particular controled version (3.18).
I found out about the (discouraged, yet working) CMAKE_C_COMPILE_OBJECT and CMAKE_C_LINK_EXECUTABLE variables, in order to shuffle the argument groups.

  • I could not find a way to suppress Depfile information with the Ninja generator. I could however remove them in the generated rules.ninja and ninja indeed did not produce depfile arguments. Is there a (maybe undocumented) way to disable depfile tracking for a particular build configuration, so that I do not have to modify the rules.ninja after generating?

  • Or alternatively, is there a way to select between MMD and MD on a gnu toolchain and change the particular order of depfile arguments?

  • I looked for a way to get the Linker-Search-Directories at the front of the linker command line, but CMAKE_C_LINK_EXECUTABLE somehow does not have a dedicated element for it, seemingly. However, inside the generated rules.ninja they do show up as a seperate argument to the rule, so there must be some logic to keep them apart internally. Is there maybe a way to control the placement of linker search directories in CMake?

Thanks in advance
Michael

So I guess digging through the code the options without modifying CMake itself are limited.
I could make this work by modifying the sources at a few spots. I think separating the link libraries from the link directories could potentially be useful anyways or at least be the natural thing to do, given that they are also separate before emitting the build system?
I still need to understand CMake-Sources better to make depfile suppression controllable through configure-variables though.