[Cmake] gtk-config / pkg-config

Mathieu Malaterre Mathieu.Malaterre@creatis.insa-lyon.fr
Mon, 05 May 2003 15:04:21 +0200


Andy,

That sounds excellent !

Anyway GTK is still a particular package as it can be accessible either 
way though gtk-config or pkg-config. So if you could find a way to hide 
this in FindGTK.cmake this would be very nice.

And one feature I would like to see is in FindwxWindow, so that it 
determine which GTK was used (I don't know if this is possible without 
using your CMakeLists for wxWindow).

BTW, when will FindPKGConfig.cmake be available ?

mathieu

Andy Cedilnik wrote:
> Hi Mathieu,
> 
> I am looking for a generic solution for pkg-config since I will need it
> for openssl. I think there should be something like FindPKGConfig.cmake,
> which sets some paths and couple of macros. Then you can use these
> macros in other Find packages. For example:
> 
> IF(HAVE_PKGCONFIG)
>   PKGCONFIG_GET_LIBRARIES(OPENSSL_LIBRARIES openssl)
>   PKGCONFIG_GET_FLAGS(OPENSSL_FLAGS openssl)
> ENDIF(HAVE_PKGCONFIG)
> 
> How does that sound?
> 
> 			Andy
> 
> On Mon, 2003-05-05 at 08:46, Mathieu Malaterre wrote:
> 
>>Hi all,
>>	I needed to test my class wxVTKRenderWindowInteractor:
>>http://www.creatis.insa-lyon.fr/~malaterre/wxVTK/
>>
>>with GTK2 so I rewrote FindGTK.cmake (based on FindwxWindow) like this:
>>
>>#######
>>IF(WIN32)
>>...
>>
>>ELSE(WIN32)
>>
>>   FIND_PROGRAM(CMAKE_PKG_CONFIG pkg-config ../gtk/bin ../../gtk/bin)
>>   IF(CMAKE_PKG_CONFIG)
>>      SET(CMAKE_GTK_CXX_FLAGS "`${CMAKE_PKG_CONFIG} --cflags gtk+-2.0`")
>>      SET(GTK_LIBRARIES "`${CMAKE_PKG_CONFIG} --libs gtk+-2.0`")
>>   ELSE(CMAKE_PKG_CONFIG)
>>      FIND_PROGRAM(CMAKE_GTK_CONFIG gtk-config ../gtk/bin ../../gtk/bin)
>>      SET(CMAKE_GTK_CXX_FLAGS "`${CMAKE_GTK_CONFIG} --cxxflags`")
>>      SET(GTK_LIBRARIES "`${CMAKE_GTK_CONFIG} --libs`")
>>   ENDIF(CMAKE_PKG_CONFIG)
>>ENDIF(WIN32)
>>
>>MARK_AS_ADVANCED(
>>   CMAKE_GTK_CXX_FLAGS
>>   GTK_INCLUDE_DIR
>>)
>>
>>IF(GTK_LIBRARIES)
>>   IF(CMAKE_GTK_CXX_FLAGS)
>>     SET(GTK_FOUND 1)
>>   ENDIF(CMAKE_GTK_CXX_FLAGS)
>>ENDIF(GTK_LIBRARIES)
>>#######
>>
>>This take advantage of pkg-config which should replace *-config tool. See:
>>http://www.freedesktop.org/software/pkgconfig/
>>
>>But I am stuck:
>>- I would like the user to choose either if he wants GTK 1.x or GTK 2.x 
>>but I don't know how to handle this.
>>
>>- Furthermore, the user should not be able to use GTK 2.x if pkg-config 
>>can't be found (only gtk-config was found). There will be also some 
>>problems if pkg-config is not in the path and is specified later...
>>
>>Thanks for your suggestions,
> 
> 
> 


-- 
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www.creatis.insa-lyon.fr/~malaterre/