CMake projects & "Show Targets"
René J.V. Bertin
rjvbertin at gmail.com
Tue Jul 5 10:20:41 BST 2016
On Tuesday July 05 2016 01:11:48 Aleix Pol wrote:
>We're basically fetching the targets from
><builddir>/CMakeFiles/TargetDirectories.txt.
Thanks, what am I looking for in that file?
I have an example project that's not too large and for which `make -C builddir help` lists the appropriate targets which do *not* show up in KDevelop's "Show Targets" mode.
That project's TargetDirectories.txt file only contains references to *.dir items and I don't really see how to determine which of those contain a target you'd want to list in "Show Targets".
>We don't have information about what's in the target nowadays (I've
>tried to make cmake offer it, and they took a very complex turn which
>didn't result in much).
>
>Help is welcome, as it is it won't get more features.
Expanding targets to show the files they depend on is useful at times but not crucial. Probably not worth investing a lot of time if the information is (too) hard to obtain. Each CMakeFiles/target.dir should have a build.make file which should contain a target_OBJECTS variable listing the object files on which the target depends, but you surely know that already. In my example project I also see lines like
> qt5/style/CMakeFiles/qtcurve-qt5.dir/requires: qt5/style/CMakeFiles/qtcurve-qt5.dir/prepolish.cpp.o.requires
> qt5/style/CMakeFiles/qtcurve-qt5.dir/requires: qt5/style/CMakeFiles/qtcurve-qt5.dir/qtcurve.cpp.o.requires
Looks like the hard part would be to get the *_OBJECTS variable read in reliably (or construct the equivalent list of object files from those .requires lines) and then map the object files back to source files.
Anyway, I find it more convenient to be able to build just a subdirectory, whether that's because I don't know which of the targets in there to build, or because I want to build all of them. It should be trivial to implement that; just chdir to the selected directory and invoke make, or use the -C option (not sure if this would make sense with ninja). I've already offered once to look into that ... if someone could point me to the appropriate class. I don't think I ever saw a reaction to that.
R.
More information about the KDevelop
mailing list