[CMake] Dependencies on imported libraries

Dennis Schridde devurandom at gmx.net
Sun Aug 1 14:35:25 EDT 2010


Hello!

The binary I am building has a dependency on an external
library.
This library may be present system-wide, otherwise I am building it
in a subdirectory.
Therefore I am calling these
commands:

add_custom_target(BuildMyLib ...)
add_library(MyLib SHARED
IMPORTED)
add_dependencies(MyLib BuildMyLib)
set_property(TARGET MyLib
PROPERTY IMPORTED_LOCATION "${MYLIB_DIR}/build")
target_link_libraries(MyBin
MyLib)

This however does not work:
Apparently imported libraries cannot
have dependencies:
"""add_dependencies Adding dependency to non-existent
target"""

Is there a way to make the imported library a real target, which
can have dependencies? Or, if not, can such a feature be added to
CMake?

Kind regards,
Dennis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100801/38c2272c/attachment.pgp>


More information about the CMake mailing list