[CMake] How to link a library?

Peter Kümmel syntheticpp at gmx.net
Wed Feb 2 14:25:15 EST 2011


On 02.02.2011 20:18, Enrique Izaguirre wrote:
> Hello,
>
> I have tried several ways to link an Api library to my project, but
> everything I've done so far is unsuccessful.
>
> I have a .lib file named AdbWinApi.lib in the address
> ${myProject_SOURCE_DIR}/android/development/windows/usb/api
>
> I am trying to link this library to myProject, first I used the following:
>
> find_library(AdbWin_LIBRARY
>       AdbWinApi.lib
>       ${myProject_SOURCE_DIR}/android/development/windows/usb/api
>       )
>

You don't need the .lib ending, it's platform specific and cmake adds it.

Peter

> then I used a simple way to assert it was found:
>
> if (${AdbWin_LIBRARY})
>      message (STATUS "AdbWin library found")
>      target_link_library (myproj ${AdbWin_LIBRARY})
> endif ()
>
> but always it is unsuccessful.
>
> Even though it looks pretty straight forward, I have not been able to link
> it.
>
> Can you help me please?
>
> Thanks
>
> BR
>
> Enrique
>
>
>
>
> _______________________________________________
> 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


More information about the CMake mailing list