开发者

Issue using CMake : gtk module

开发者 https://www.devze.com 2023-01-18 12:46 出处:网络
I\'m attempting to compile zzogl using CMake and I keep running into issues.My first issue s开发者_如何转开发tated that I needed pkgconfig, so I installed that, for which I also had to install MacPort

I'm attempting to compile zzogl using CMake and I keep running into issues. My first issue s开发者_如何转开发tated that I needed pkgconfig, so I installed that, for which I also had to install MacPorts. Then it said I needed gtk+-2.0 module, so I got that too. After that took forever to install, I still get this error:

checking for module 'gtk+-2.0'
package 'gtk+-2.0' not found
CMake Error at /Applications/CMake 2.8-2.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
A required package was not found
Call Stack (most recent call first):
/Applications/CMake 2.8-2.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
CMakeLists.txt:106 (pkg_check_modules)


CMake Error at cmake/funcs.cmake:32 (message):
gtk not found, aborting...
Call Stack (most recent call first):
cmake/funcs.cmake:23 (reportFound)
CMakeLists.txt:107 (checkFor)


Configuring incomplete, errors occurred!

I'm not really familiar with what I am doin, and it is completely possible I am doing it all wrong. Anyone have any incite into my problem? I am using a mac with snow leopard btw.


Did you install gtk with a command similar to sudo port install gtk2? If yes, then normally gtk should be found by cmake. You can test if gtk is correctly found by pkg-config manually like this:

pkg-config --cflags gtk+-2.0

which should print something like

-pthread -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12

but with different paths, the above is on a Linux system.

If indeed the pkg-config call succeeds, something is wrong with your CMake config. You might then try to install the MacPorts version of cmake like this: sudo port install cmake and use this one.


Okay, I had a look into the FindGTK2.cmake module and I think I see the problem: It doesn't use pkg-config, but does its own way of finding headers and libraries. The _GTK2_FIND_INCLUDE_DIR function doesn't have /opt/local/include/ in its list of directories, which is where MacPorts is probably going to install the headers. Similarly, _GTK2_FIND_LIBRARY doesn't list /opt/local/lib.

This is a known bug, which was apparently fixed in CMake 2.8.3-rc1. I have my doubts, though, because they didn't update the library path. We'll see.

I looked at the documentation for find_path and find_library. It appears that the user can give hints about the search path by specifying -D options to cmake. Try something like:

cmake ../zzogl -DCMAKE_INCLUDE_PATH=/opt/local/include -DCMAKE_LIBRARY_PATH=/opt/local/lib
0

精彩评论

暂无评论...
验证码 换一张
取 消