On Thu, Oct 27, 2011 at 7:07 PM, Dan Kegel <d...@kegel.com> wrote: > Oh, man, now I get it. > The idea of http://www.cmake.org/Bug/view.php?id=10395 > is to tell cmake that the external project is generating a library; > you can then hang the dependencies on that library. > Here's an example that seems works for me (tested by inserting a big > sleep into the configure for the external project): > > cmake_minimum_required (VERSION 2.8.4) > include(ExternalProject) > ExternalProject_Add( > Foobar_external > SOURCE_DIR ${CMAKE_SOURCE_DIR}/foobar > INSTALL_DIR ${CMAKE_BINARY_DIR}/prefix > CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/foobar/configure > --prefix=${CMAKE_BINARY_DIR}/prefix > ) > # Tell cmake that the external project generated a library so we can > add dependencies here instead of later > add_library(Foobar UNKNOWN IMPORTED) > set_property(TARGET Foobar PROPERTY IMPORTED_LOCATION > ${CMAKE_BINARY_DIR}/prefix/lib/libfoobar.a ) > add_dependencies(Foobar Foobar_external) > SET(Foobar_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/foobar) > SET(Foobar_LIBRARIES Foobar) > > # Now callers of library Foobar can just do > # target_link_libraries(whatever ${Foobar_LIBRARIES}) > # instead of > # target_link_libraries(whatever ${Foobar_LIBRARIES}) > # add_dependencies(whatever ${Foobar_LIBRARIES}) > > That sound right?
Yes. I think you do get it now. :-) > > I wonder if this couldn't be wrapped up more neatly somehow, but for > now, it's better than what I was doing before. > - Dan > I'm sure it could: sounds like it's time for another article for The Source, or a blog entry, or something. Cheers, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake