[CMake] Listing all the include directories

Saad Khattak saadrustam at gmail.com
Tue Mar 27 22:32:51 EDT 2018


Thanks Robert. Too bad that this something I cannot inspect. A list of
include directories would be useful even with unexpanded generator
expressions.

CMake-server mode sounds like an interesting option.

On Tue, Mar 27, 2018 at 10:47 AM Robert Maynard <robert.maynard at kitware.com>
wrote:

> In general your options are to look at the command line or use
> cmake-server mode to query the code model. The full set of include
> directories is not known while configuring due to generator
> expressions expanding after the configure step.
>
> On Mon, Mar 26, 2018 at 9:45 PM, Saad Khattak <saadrustam at gmail.com>
> wrote:
> > Hi,
> >
> > I have many libraries and packages that are being linked using
> > target_link_libraries(...) where CMake takes care of the include
> > directories. There are cases where I get compile errors because I don't
> know
> > the exact include directories.
> >
> > I thought perhaps I could get the include directories of my target by
> doing
> > the following:
> >
> > get_target_property(INCLUDE_DIRS MyExeThatLinksToManyLibs
> > INCLUDE_DIRECTORIES)
> > message(STATUS ${INCLUDE_DIRS}) # hoped that this would print all the
> > include directories
> >
> > Unfortunately, that did not work as expected. It was missing directories
> > that I know are added to the include directories of the target (because
> the
> > compiler is able to find the headers properly).
> >
> > Apart from sifting through the compile commands, is there a nice way to
> > debug the include directories of a target?
> >
> > Thank you,
> > Saad
> >
> > --
> >
> > Powered by www.kitware.com
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Kitware offers various services to support the CMake community. For more
> > information on each offering, please visit:
> >
> > CMake Support: http://cmake.org/cmake/help/support.html
> > CMake Consulting: http://cmake.org/cmake/help/consulting.html
> > CMake Training Courses: http://cmake.org/cmake/help/training.html
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > https://cmake.org/mailman/listinfo/cmake
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180328/c085a70e/attachment.html>


More information about the CMake mailing list