[CMake] Usage requirements for external project dependencies

Hendrik Sattler post at hendrik-sattler.de
Sun Sep 7 07:04:23 EDT 2014



On 7. September 2014 11:32:31 MESZ, Alexander Lamaison <awl03 at doc.ic.ac.uk> wrote:
>What I would like is to be able to do is:
>
>add_executable(my_exe ${SOURCES})
>find_package(Foo)
>target_link_libraries(my_exe Foo)
>
>and have it Just Work.  Is that possible?

Yes, you just have to create an IMPORTED library target and manually set the INTERFACE_* properties for it. If you name the target with :: in it, then CMake knows that it's a target and not a library file base name.

HS



More information about the CMake mailing list