[CMake] Combine GTK with a Cmake Project

Andreas Pakulat apaku at gmx.de
Tue Oct 18 08:01:07 EDT 2011


On 18.10.11 13:40:55, David Boesner wrote:
> Hi,
> 
> I've tried to combine CMake with GTK. Unfortunately this didn't
> work. Can you help me?

What is the error? Did you look at the FindGTK2.cmake module to get
inspiration for a GTK3 module? Is there a particular reason to call the
module libgtk-3-dev instead of just GTK3?

Looking at the cmake file, I bet the problem is in
target_link_libraries. You don't seem to understand how the find_package
command works or the target_link_libraries, please consult the manual
and other cmake-based projects. In particular target_link_libraries
expects either a target-name from a add_executable/add_library call or
linker-flags. You're just giving it some "random" string which won't
tell the linker what the library is. You probably want to pass
${libgtk-dev_LIBRARIES} there.

Andreas



More information about the CMake mailing list