[CMake] Support for TARGET_INCLUDE_DIRECTORIES(),
TARGET_LINK_DIRECTORIES and TARGET_ADD_DEFINITIONS()
Brad King
brad.king at kitware.com
Sun Jun 3 12:45:38 EDT 2007
Stephane Rouleau (Consultant) wrote:
> It looks like INCLUDE_DIRECTORIES(), LINK_DIRECTORIES() and
> ADD_DEFINITIONS() are defined globally, which in our setup is not quite
> we were aiming for.
>
> ADD_DEFINITIONS() can be replaced I suppose by setting the compile flags
> directly on the target, since -D is pretty 'portable'. But are -L and
> -I also portable in the same way, and setting them on the LINK_FLAGS /
> COMPILER_FLAGS going to behave appropriately?
>
> If we were to implement those three commands, would there be any
> interest in merging this in the trunk? We would hate to have to
> maintain our own parallel copy of cmake on all the platforms we need to
> support....
There is interest, but don't waste your time working on it all yourself.
We have been slowly changing the implementation over the last few
releases to make everything target-oriented instead of
directory-oriented. We are (currently) implementing features to support
things like you want in the CVS version but are not yet done. When they
are done everything will be target-oriented.
Note that TARGET_LINK_DIRECTORIES should not be needed. Instead all
outside libraries should be linked by passing their full paths to
TARGET_LINK_LIBRARIES. CMake will automatically split it into -L and -l
options and compute a safe order for the link directories to make sure
the proper libraries are found.
For TARGET_ADD_DEFINITIONS you can already work around the problem with
the COMPILE_FLAGS target property as you mentioned. I've also got a
COMPILE_DEFINITIONS target property partially implemented in a working
copy of CMake CVS. A few more important changes that affect it have
delayed my commit though.
For TARGET_INCLUDE_DIRECTORIES a bit of work is needed to get the
implicit dependency scanning right. Some of it can probably be done in
parallel with the other changes I'm developing. If you have time and
are interested in contributing to CMake in a way that will help with
these features (or anything else) send me email off-list.
-Brad
More information about the CMake
mailing list