[CMake] Unable to find GTK with cmake on Ubuntu

Philip Lowman philip at yhbt.com
Thu Dec 18 14:03:25 EST 2008


Could you try the following beta FindGTK2 module?

Set CMAKE_MODULE_PATH prior to calling FIND_PACKAGE(GTK2 COMPONENTS gtk)  
See the module for details

...... Original Message .......
On Thu, 18 Dec 2008 16:15:28 +0100 "Pierrick Grasland" 
<pierrick.grasland at gmail.com> wrote:
>Hello all,
>
>I'm testing CMake with a little project, but I encounter a problem with 
GTK.
>
>I have the following architecture with CMake 2.6-patch2 on ubuntu 8.04 :
>
>src/
>  gui/
>  tools/
>target/
>
>My goal is to generate my project in target.
>
>So I created a CMakeLists.txt in src :
>
>cmake_minimum_required(VERSION 2.6)
>project( MyProject )
>
>include_directories( ${MyProject_SOURCE_DIR}/gui )
>link_directories( ${MyProject_SOURCE_DIR}/gui )
>
>include_directories( ${MyProject_SOURCE_DIR}/tools )
>link_directories( ${MyProject_SOURCE_DIR}/tools )
>
>add_subdirectory(gui) 
>add_subdirectory(tools) 
>
>set( MyProject_SRC main.c conf.c )
>add_executable( myproject ${MyProject_SRC})
>
>set( MyProject_LIB tools gui )
>target_link_libraries(myproject ${MyProject_LIB} ) 
>
>and, in src/gui/ the following CMakeLists.txt :
>
>find_package (GTK REQUIRED)
> 
>include_directories (${GTK_INCLUDE_DIR})
>
>set( GUI_SRC gtkCallback.c interface.c widgetUI.c)
>add_library (gui  ${GUI_SRC} ${GTK_LIBRARIES})
>
>But, when I run configure in cmake-gui, I have the following result :
>
>GTK_..._NOTFOUND for all corresponding libraries in GTK.
>
>and when I trying to make my project in target, I can't because gcc 
doesn't know where is GTK
>
>I was building with autotools and pkg_config before, so I know I have 
GTK+-2.0 on my system.
>
>I realized the migration between autotools and Cmake without a specialized 
tools, in order to learn how to use CMake. I'm now stuck with this problem, 
without a single clue (on CMake wiki or google) to correct it. I hope for 
some help here.
>
>Regards,
>
>
>--
>Pierrick Grasland
>
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake
-- 
Philip Lowman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindGTK2.cmake
Type: application/octet-stream
Size: 6994 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081218/b8b138f0/attachment-0001.obj>


More information about the CMake mailing list