[cmake-developers] Extracting target metadata, IDE integration

Ben Boeckel ben.boeckel at kitware.com
Wed Mar 11 10:15:07 EDT 2015


On Tue, Mar 10, 2015 at 01:25:16 +0100, Aleix Pol wrote:
> >>            "output" : "/home/kde-devel/tmp/llvm/build/lib/libLLVMPowerPCInfo.a",
> >
> > Can this be a list?
> It's 1 output per target, no?

Not on Windows with .dll and .lib splits.

> >>            "sources" : [ "/list/of/cpp/files, ]
> >
> > Any way to also get the headers? Do you see any option to hint where
> > new sources would need to be added to make them a part of this target?
> I looked into how the CodeBlocks did it to provide the header files.
> It's just brute-forcing to see if the file renamed to *.h/*.hpp/*.hxx
> is present.
> CMake doesn't have this kind of information, so I think it's better
> that the IDE's do the hacky parts than cmake.
> Also we don't really have information about where to put them. You can
> use the minimum common denominator among the sources I guess.

There's the source_group() command which could be changed to affect this
as well.

> > Building the project should be fine with the information provided.
> > Explicitly stating the generators used would help a little bit (even
> > better just giving the command necessary to build, e.g. make or ninja
> > or whatnot. Then we would not need to hard-code the mapping of
> > generators->build tools, which makes it much easier for you to support
> > new things:-)
> >
> > Running/Debugging is a bit tricky again: All the information used for
> > linking the binaries is gone. So there is no way to figure out which
> > LD_LIBRARY_PATH needs to be set or anything. There also seems to be no
> > information where files are going to get installed to. Would it be
> > possible to add that information?
> I ignore it, on the other hand I'm quite a n00b when it comes to cmake
> codebase and internals. I'm sure if somebody knows where to get that
> information, he is reading this mailing list. (hello)

CMake has options for RPATH for the relevant platforms. By default,
binaries have the RPATH set for the build tree. Relevant CMake target
properties (there are variables to set default values as well):

  - BUILD_WITH_INSTALL_RPATH
  - SKIP_BUILD_RPATH

Without SKIP_BUILD_RPATH set, LD_LIBRARY_PATH should not be necessary
for running targets.

--Ben


More information about the cmake-developers mailing list