[CMake] include_directories per target

David.Karr at L-3COM.COM David.Karr at L-3COM.COM
Wed May 13 08:50:14 EDT 2009


Olivier Delannoy <olivier.delannoy at gmail.com> wrote:
> I would like to set include_directories on a per target basis. I
> understand that the INCLUDE_DIRECTORIES property is currently on a per
> folder basis. It is a bit of a problem as I would like to flatten my
> build and have all my targets generated in a single destination
> folder. Is there any way to achieve this currently?

The "per folder" basis refers to the source directories or folders.  You
don't need to flatten the entire source of your project in order to put
the built libraries and executables in one directory.  Instead, direct
the output of each target to the common directory.  For example, I have
a project under CMake that puts all the executable code in files in one
directory, but the source for each target is in a directory completely
separate from any other target's source directory.  (We don't even allow
one target's source to be in a subdirectory of another target.)  This
seems to me to be a sensible way to organize such a project even if you
were not using CMake.

David A. Karr



More information about the CMake mailing list