[CMake] how to link with a system library ?

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sun Sep 21 07:52:33 EDT 2008


Steven Samuel Cole schrieb:
> Eric Noulard schrieb:
>> 2008/9/21 Steven Samuel Cole <steven.samuel.cole at gmail.com>:
>>> I would like to link a system library into an executable, GTK in this 
>>> case.
>>> What I'm trying to do is
>>>
>>> include(FindGTK)
>>>
>>> target_link_libraries(myexec $GTK_LIBRARIES)
>>>
>>> add_executable (myexec sources)
>>>
>>> Result:
>>>
>>> CMake Error: Attempt to add link library "GTK_LIBRARIES" to target 
>>> "myexec"
>>> which is not built by this project.
>>>
>>> What am I doing wrong ?
>>
>> You may be missing curly brace around variable could you try:
>>
>>
>> target_link_libraries(myexec ${GTK_LIBRARIES})
>>
> 
> Thanks for your help! :-)
> 
> ${GTK_LIBRARIES} instead of $GTK_LIBRARIES fixes the CMake Error 
> problem, but I still get GTK link errors. Also, even though I do 
> include_directories(${GTK_INCLUDE_DIR}), I still get
> gtk/gtk.h: No such file or directory.
> 
> Has anyone ever seen this working ?
Are you sure you have set GTK_INCLUDE_DIR at all?

-> cmake documentation FIND_PACKAGE() should help here



Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080921/8da445a2/attachment.pgp>


More information about the CMake mailing list