[CMake] target_link_libraries external library
blinkeye
gentoo at blinkeye.ch
Fri Sep 21 16:45:58 EDT 2007
On 09/21/2007 10:15 PM, Juan Sanchez wrote:
> Hello,
>
> How do you add an externally library for linking into a target? I am
> getting something like this from TARGET_LINK_LIBRARIES?
>
> CMake Error: Attempt to add link library "/bar/linux-x86/opt/foo.a" to
> target "waterlooApps" which is not built by this project.
>
> Thanks,
>
> Juan
>
This happens if you mix the executable names. If your subproject is say
prototype1 the following will return the above error:
ADD_EXECUTABLE( prototype1 prototype1.cpp )
TARGET_LINK_LIBRARIES( prototype3 libfoo )
You have to write
ADD_EXECUTABLE( prototype1 prototype1.cpp )
TARGET_LINK_LIBRARIES( prototype1 libfoo )
More information about the CMake
mailing list