[cmake-developers] why can target_include_directories() not be applied to custom targets?
Drew Parsons
dparsons at debian.org
Mon Jul 9 10:32:42 EDT 2018
On Mon, 2018-07-09 at 16:02 +0300, Attila Krasznahorkay wrote:
> Hi,
>
> Just to say that setting INCLUDE_DIRECTORIES on a custom target is
> indeed a bit of an obscure thing, but we do use it. You can find the
> full reasoning in:
>
> https://gitlab.kitware.com/cmake/cmake/issues/16830
>
> Because of that, I understood that CMake will provide this
> functionality in the future as well, so we can rely on this build
> setup.
>
> Cheers,
> Attila
>
> > On 8 Jul 2018, at 12:16, Petr Kmoch <petr.kmoch at gmail.com> wrote:
> >
> > Hi Drew,
> >
> > a custom target can do literally anything, it's just a buildsystem
> > wrapper for running arbitrary executables; or often not even that,
> > and is just a collection of custom commands. There is nothing CMake
> > automatically does with the properties
> > [INTERFACE_]INCLUDE_DIRECTORIES set on a custom command.
Thanks for the explanation Petr, and Attila.
Looks like
set_property(TARGET mylib PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
does what I have in mind, it can stand in place of
target_include_directories() for custom targets.
Drew
More information about the cmake-developers
mailing list