I'd like to do the following:

  # Build external project A
  ExternalProject_Add(A ...)

  # Import target B, which is exported by A in AConfig.cmake
  ExternalProject_Get_Property(A, BINARY_DIR)
  set(A_DIR ${BINARY_DIR})
  find_package(A)

  # Link with B
  add_library(C ...)
  target_link_libraries(C B)

Of course, this doesn't work because the external project hasn't been
built yet at configure-time, so AConfig.cmake doesn't exist.  Which
leads me to the following:

  # Build external project A
  ExternalProject_Add(A ...)

  # Setup target B, which will be build as part of A
  add_library(B SHARED IMPORTED)
  set_target_properties(B PROPERTIES
    IMPORTED_LOCATION "${BINARY_DIR}/path/to/B.so.x.y"
    IMPORTED_SONAME "B.so.x"
    )

  # Link with B
  add_library(C ...)
  target_link_libraries(C B)

which is dissatisfying, since it means I have to get intimate with the
way project A's libraries are named, whether they're .dlls, .sos,
.dylibs, etc.

I'm wondering if there are any suggestions or best practices on how to
simplify this.

Cheers,
Tim

<<attachment: tshead.vcf>>

_______________________________________________
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

Reply via email to