[CMake] Per-target include dirs that work in both 2.8.7 and

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Thu Feb 28 15:19:48 EST 2013

Hi Magnus,

As already mentioned, the target property INCLUDE_DIRECTORIES has been
introduced in CMake 2.8.8. The following page is useful to find out such
things. See

To get around it, as mentioned by Bill, you could probably create on folder
per target and call include_directories() in each folder.

An other option could be to create a wrapper around the "add_target"
command that would create a directory, write a CMakeLists and then call
add_subdirectory(/path/to/project-build/target target).


On Thu, Feb 28, 2013 at 3:32 AM, Magnus Therning <magnus at therning.org>wrote:

> The other day I was putting together some cmake files and made them
> work on my system, where I have version installed.  After
> giving my work to a colleague he reported that it didn't work.  It
> came down to him using version 2.8.7 (comes with his Linux distro) and
> my use of
> ~~~~
>     ....
>     )
> ~~~~
> In the folder in question there is source for several different
> targets, so I'd really like to use per-target include dirs (i.e.
> include_directories would not be a good match).  Is there a mechanism
> for (easily) getting per-target include dirs that work in both these
> versions?
> /M
> --
> Magnus Therning                      OpenPGP: 0xAB4DFBA4
> email: magnus at therning.org   jabber: magnus at therning.org
> twitter: magthe               http://therning.org/magnus
> --
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130228/da6b8590/attachment.htm>

More information about the CMake mailing list