[CMake] how to link with a system library ?

Mike Jackson mike.jackson at bluequartz.net
Sun Sep 21 09:10:31 EDT 2008


include(FindGTK)
add_executable (myexec ${sources} )

target_link_libraries(myexec ${GTK_LIBRARIES} )



Note the order above.

Also, cmake variables are ALWAYS used with braces ${Variable} NOT  
$Variable.

Mike


On Sep 21, 2008, at 5:23 AM, Steven Samuel Cole wrote:

> 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 ?
>
> Kind regards,
>
> Steve
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list