[CMake] Dependencies on imported libraries

Alexander Neundorf a.neundorf-work at gmx.net
Sun Aug 1 16:52:26 EDT 2010


On Sunday 01 August 2010, Dennis Schridde wrote:
> 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?

It's this one, right ?
http://public.kitware.com/Bug/view.php?id=10395

Feel free to add a ntoe that you are interested in this bug too.

Alex


More information about the CMake mailing list