Skip to content

Draft: RFC: Hackily fix compile_commands.json generation for c++20 modules

Nathan Lanza requested to merge lanza/cmake:wip into master

Just grepped for what looked like was right and stitched a few things together. This works on a simple little example project with two files but not a more realistic project.

I'm clearly missing a few more args, but figured I'd stop to ask if this is the right approach first. Here's what ninja invokes:

-MD
-MT
unittest/CMakeFiles/TestForwardList.dir/TestForwardList.cpp.o
-MF
unittest/CMakeFiles/TestForwardList.dir/TestForwardList.cpp.o.d
@unittest/CMakeFiles/TestForwardList.dir/TestForwardList.cpp.o.modmap

and here's what I'm generating with this small change:

@unittest/CMakeFiles/TestForwardList.dir/TestForwardList.cpp.o.modmap

So is just cleaning this up a bit but then still just appending hardcoded -MD -MT <objfilepath> -MF <dunnowhatthisiscalled> <objBuild.OrderOnlyDeps[2]> "correct"?

Issue: #24618 (closed)
Topic-rename: cxxmodules-compile-commands

Edited by Brad King

Merge request reports