[CMake] tried to use pkgcpnfig to compile my project

David Boesner david.boesner at googlemail.com
Wed Oct 19 07:46:18 EDT 2011


Hi

I've tried to use pgkconfig to compile my project.
I used this as an example:
http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries
chapter 4.1

I get the following Errormessage:

fatal error: /gtk/gtk.h: Datei oder Verzeichnis nicht gefunden

German: Datei oder Verzeichnis nicht gefunden
English: File or directory not found


Please help me

Regard

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111019/32197010/attachment-0001.htm>
-------------- next part --------------
cmake_minimum_required (VERSION 2.6)
project (GUI)

# - Try to find ImageMagick++
# Once done, this will define
#
#  Magick++_FOUND - system has Magick++
#  Magick++_INCLUDE_DIRS - the Magick++ include directories
#  Magick++_LIBRARIES - link these to use Magick++

include(LibFindMacros.cmake)

set(GTK+-3.0_INCLUDE_DIR /gtk-3.0/)

add_executable(TEST test.c)

# Dependencies
libfind_package(/pkgconfig/GTK+-3.0 GTK)


# Use pkg-config to get hints about paths
libfind_pkg_check_modules(GTK+-3.0_PKGCONF gtk+-3.0)

# Include dir
find_path(GTK+-3.0_INCLUDE_DIR
  NAMES gtk.h
  PATHS ${GTK+-3.0_PKGCONF_INCLUDE_DIRS}
)
MESSAGE("path" ${GTK+-3.0_PKGCONF_INCLUDE_DIRS})


include_directories(${GTK+-3.0_INCLUDE_DIR})

# Finally the library itself
find_library(GTK+-3.0_LIBRARY
  NAMES GTK+-3.0
  PATHS ${GTK+-3.0_PKGCONF_LIBRARY_DIRS}
)

target_link_libraries(TEST GTK+-3.0_LIBRARY)

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(GTK+-3.0_PROCESS_INCLUDES GTK+-3.0_INCLUDE_DIR GTK_INCLUDE_DIRS)
set(GTK+-3.0_PROCESS_LIBS GTK+-3.0_LIBRARY GTK_LIBRARIES)
libfind_process(GTK+-3.0)

# add the install targets
install (TARGETS TEST DESTINATION ${PROJECT_BINARY_DIR})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LibFindMacros.cmake
Type: text/x-cmake
Size: 4129 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111019/32197010/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 5505 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111019/32197010/attachment-0001.c>


More information about the CMake mailing list