On Sat, Oct 19, 2013 at 08:11:52PM +0100, Nick Hutchinson wrote: > 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".
That's very nice indeed :) My complete configuration for the external library is now ~~~~ externalproject_add(gtest-external SOURCE_DIR ${PROJECT_SOURCE_DIR}/gtest BINARY_DIR gtest-build INSTALL_COMMAND "" # omit installation ) add_library(gtest STATIC IMPORTED) set_target_properties(gtest PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/gtest-build/libgtest.a IMPORTED_LINK_INTERFACE_LIBRARIES -lpthread INTERFACE_INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/gtest/include ) ~~~~ And all I need a user of the library to do is ~~~~ target_link_libraries(one_test gtest) ~~~~ Sweet! Thanks for all the help. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus The early bird may get the worm, but the second mouse gets the cheese.
pgp62eZTeKd5C.pgp
Description: PGP signature
-- 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