Closed GoogleCodeExporter closed 9 years ago
I don't completely understand why you need to use IWYU as your CMake C++
compiler, can you explain why this is needed?
Original comment by kim.gras...@gmail.com
on 27 Dec 2012 at 10:16
The suggested make -k CXX=/path/to/whatever doesn't work with cmake generated
makefiles
Original comment by whatmann...@gmail.com
on 27 Dec 2012 at 10:17
I see. It'd be nice if there was a CMake workaround to this (e.g. skip compiler
check), but failing that it should be simple to add an --exit-with switch or
something.
That said, is there no other way to run make to have it traverse all source
files, other than -k, which seems to continue on failure? It seems backwards to
me.
Original comment by kim.gras...@gmail.com
on 27 Dec 2012 at 10:52
I tried making exit code configurable, but I still can't get CMake to accept
IWYU as a compiler. It seems it not only looks at the exit-code of the compiler
invocation, it also requires that the compiler generates an object file:
make.exe[1]: ***
[CMakeFiles/cmTryCompileExec2266767813.dir/testCXXCompiler.cxx.obj] Error 1
I'd forgotten, but there was a discussion on how to marry IWYU and CMake on the
mailing list a while back, it looks like it was figured out with a number of
hacks:
https://groups.google.com/forum/?fromgroups=#!topic/include-what-you-use/N6441qS
N9Og
We'd like to include the compile-commands script from Ryan Pavlik, but haven't
started looking into it yet.
I think we'll have to close this issue as "by design", even if it's pretty
rough. At least I don't see a reasonable way for IWYU to interact directly with
CMake.
Original comment by kim.gras...@gmail.com
on 1 Jan 2013 at 2:23
just wanted to share an updated python script that interacts with
compile_commands.json
http://pastebin.com/cAxuGDQa
it's a generic tool now, no more hardcoded paths.
Run it in your cmake_source_dir, the first argument is the
compile_commands.json file, then all remaining arguments are passed to
include-what-you-use
it also uses multiprocessing, so it's faster (I don't think there is any race
condition in the output, but I'm not too much of a python expert)
Original comment by showard...@gmail.com
on 4 Feb 2015 at 5:43
Nice, thanks! This is a generalization of rpavlik's original script, right?
I could try and incorporate this into IWYU now, if you don't mind. I'll
probably clean up the Python a little bit to make it compatible with both
Python 2 and 3.
Original comment by kim.gras...@gmail.com
on 4 Feb 2015 at 8:30
Yes, just a generalization. You may want to turn off the multiprocessing or
make it a command line switch, please go ahead and use my modifications to the
script however they are helpful (I'm not sure how portable it is)
Original comment by showard...@gmail.com
on 4 Feb 2015 at 9:12
I'm working on this.
Original comment by kim.gras...@gmail.com
on 20 Feb 2015 at 10:05
See attached Python script.
I took rpavlik's and showard's work and adjusted it into a new script that
behaves something like the command-style for a Clang tool. I've tested this on
Windows and FreeBSD, so it should port pretty well.
I skipped the multiprocessing for now, because I think it will jumble output
unless we start piping IWYU outputs into individual files.
This should also fix/support #164.
Original comment by kim.gras...@gmail.com
on 21 Feb 2015 at 9:56
Attachments:
The script works for me, great job. I don't like that IWYU-specific arguments
now go after --, and when IWYU supports compilation DB IWYU-specific arguments
will go before --. But I don't think we can do anything about it.
Feel free to commit the patch. I'm not sure I've considered all the edge cases,
but we can always fix them later.
Original comment by vsap...@gmail.com
on 2 Mar 2015 at 2:43
I intended to mimic the normal Clang tooling style, but I see what you mean.
To have native IWYU support compilation databases, we have to redo its
command-line parsing entirely (to fit into Tooling). At that time it's probably
fine to break some eggs.
I'll try to get this committed now.
Original comment by kim.gras...@gmail.com
on 2 Mar 2015 at 8:14
r607 adds a Python driver that lets IWYU integrate with CMake's compilation
database. I'll set this fixed.
Original comment by kim.gras...@gmail.com
on 2 Mar 2015 at 8:24
Original issue reported on code.google.com by
whatmann...@gmail.com
on 27 Dec 2012 at 9:20