[cmake-developers] Extracting target metadata, IDE integration

Tobias Hunger tobias.hunger at gmail.com
Sat Sep 20 15:57:25 EDT 2014


Hello!

Sorry for breaking the threading, I only joined this ML just now to
comment on this thread:-) Thanks Stephen for pointing me here!

I am not a regular cmake user (used to be a couple of years ago), but
I im interested in this topic since I work on Qt Creator. While cmake
currently is not our focus, I would personally like to see better
cmake integration into our tool. Unfortunately I do not have the time
to work on this myself:-/

I do want to provide some input to this discussion though.

>From my experience we would need a bit more information than proposed
in http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/10711/focus=1100

This is the structure suggested for each target:

<snip>
  {
    "name": "testc1",
    "type": "STATIC_LIBRARY",
    "directory": "/tmp/COnly-bld",
    "location": "/tmp/COnly-bld//libtestc1.a",
    "exportName": "testc1",
    "backtrace": ["/tmp/COnly-src/CMakeLists.txt:6"],
    "installed": false
  },
<snip>

That information will be valuable.

I would love to see two additional field with information:

The first is should this be run in a terminal or is this a GUI. Not
sure whether cmake has that information.

Secondly the linker flags would be nice to know. That way the
LD_LIBRARY_PATH can be set correctly by the IDE so that all the
libraries are found.

Combined with CMAKE_EXPORT_COMPILE_COMMANDS this should allow for a
pretty good integration into creator. Ideally the exported compile
commands would be a bit more aggregated along the lines of "the
following list of files will be build using these defines/include
paths/flags", just because that would be way shorter and most likely
faster to parse.

With this target description and the compile commands there is just
one piece of the puzzle missing for a great Qt Creator integration: We
need to generate a list of files that are part of the project. I
currently do not know how to extract that list from cmake. This list
must include all the header files that belong to the project, which is
what makes this hard to get this information from cmake -- at least at
the time I stopped working with cmake.

Ideally we could get the list of files that belong to the project in
general and the files that are actually part of the currently
configured built.

The general list can be clutched around by just assuming that all
source files in the current project directory belong to the project.
But how can I know that "something_win.h" will not be used when
building on my Linux box?

Best Regards,
Tobias



More information about the cmake-developers mailing list