You can create imported libraries with the add_library command using the IMPORTED option.
I have very quick example at: https://github.com/robertmaynard/Sandbox/blob/master/ImportedLibrary/CMakeLists.txt On Wed, Oct 16, 2013 at 5:00 PM, Magnus Therning <mag...@therning.org> wrote: > When defining a library via add_library() it's possible to link > against it by just putting its name into target_link_libraries(). Is > there some way of wrapping up an external library in a similar way? > > As a concrete example I'm playing around with gtest[1] via > externalproject_add() like this: > > externalproject_add(gtest > SOURCE_DIR ${PROJECT_SOURCE_DIR}/gtest > BINARY_DIR gtest-build > INSTALL_COMMAND "" # omit installation > ) > > Then to link to it I need to use > > target_link_libraries(test > -L${CMAKE_BINARY_DIR}/gtest-build -lgtest -lpthread > ) > > Is there some way to wrap that all up in a target that I can pass > straight to target_link_libraries()? > > Or is my only option to create a variable that expands to those > compiler flags? > > /M > > [1]: https://code.google.com/p/googletest/ > > -- > Magnus Therning OpenPGP: 0xAB4DFBA4 > email: mag...@therning.org jabber: mag...@therning.org > twitter: magthe http://therning.org/magnus > > As we enjoy great advantages from the inventions of others we should > be glad of an opportunity to serve others by any invention of > ours, and this we should do freely and generously. > -- Benjamin Franklin > > -- > > 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 -- 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