[CMake] Faking a library

Nick Hutchinson nshutchinson at gmail.com
Sat Oct 19 15:11:52 EDT 2013


As of 2.8.12, you can set target properties on an imported library to
specify its include directories, compile options etc, and these will be
automatically propagated to any other target that links to it via
target_link_libraries(). No more tedious faffing about with global
variables like GTEST_INCLUDE_DIRS, GTEST_LIBRARIES etc. It's really quite
nice.

Check the 2.8.12 CMake docs for target properties that start with
"INTERFACE".

Nick


On 19 October 2013 08:59, Magnus Therning <magnus at therning.org> 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.
>
> /M
>
> --
> Magnus Therning                      OpenPGP: 0xAB4DFBA4
> email: magnus at therning.org   jabber: magnus at therning.org
> twitter: magthe               http://therning.org/magnus
>
> The British have "the perfect temperament to be hackers--technically
> skilled, slightly disrespectful of authority, and just a touch of
> criminal behavior".
>      -- Mary Ann Davidson, Oracle's Security Chief
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131019/67eafb72/attachment.htm>


More information about the CMake mailing list