[Cmake] gtk-config / pkg-config
Andy Cedilnik
andy.cedilnik@kitware.com
05 May 2003 09:02:32 -0400
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,