[CMake] Faking a library
Alexander Neundorf
a.neundorf-work at gmx.net
Sat Oct 19 15:19:07 EDT 2013
On Saturday 19 October 2013, you wrote:
> On Sat, Oct 19, 2013 at 11:28:53AM +0400, Игорь Пашев wrote:
> > 2013/10/19 Magnus Therning <magnus at therning.org>:
> > > Is it possible to put the include path in some property on the library
> > > as well, to avoid using a separate variable for that?
> >
> > SET_TARGET_PROPERTIES (target PROPERTIES <VARIABLE-NAME>
> > <VARIABLE-VALUE>)
>
> Of course, but then how do I use it conveniently?
>
> Would it be possible, by choosing a good property name, to simply do
>
> target_include_directories(one_test PRIVATE
> target
> )
>
> Or would I have to
>
> get_target_property(INC_DIR target <variable-name>)
> target_include_directories(one_test PRIVATE
> ${INC_DIR}
> )
>
> in which case using a property wouldn't give me very much.
This depends on which version of cmake you are using.
If you require a very recent one, i.e. 2.8.11 or newer, you can set
INTERFACE_INCLUDE_DIRECTORIES, and then you'll get the include dirs
automatically when linking against the target, I think.
Alex
More information about the CMake
mailing list