diff options
| author | 2009-02-09 20:44:11 +0100 | |
|---|---|---|
| committer | 2009-02-09 21:03:02 +0100 | |
| commit | 4278fced578920c4b9c1ffe0862e94d90430b227 (patch) | |
| tree | 35569f0770f65982854ed81a0e0740f7a751b829 /cmake/modules/FindGLIB2.cmake | |
| parent | fa4a22dde897c0e2a8cc89b7479f0513c9455d37 (diff) | |
| download | libplist-4278fced578920c4b9c1ffe0862e94d90430b227.tar.gz libplist-4278fced578920c4b9c1ffe0862e94d90430b227.tar.bz2 | |
Add a cmake build system.
Diffstat (limited to 'cmake/modules/FindGLIB2.cmake')
| -rw-r--r-- | cmake/modules/FindGLIB2.cmake | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake new file mode 100644 index 0000000..226d551 --- /dev/null +++ b/cmake/modules/FindGLIB2.cmake | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | # - Try to find the GLIB2 libraries | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # GLIB2_FOUND - system has glib2 | ||
| 5 | # GLIB2_INCLUDE_DIR - the glib2 include directory | ||
| 6 | # GLIB2_LIBRARIES - glib2 library | ||
| 7 | |||
| 8 | # Copyright (c) 2008 Laurent Montel, <montel@kde.org> | ||
| 9 | # | ||
| 10 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
| 11 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
| 12 | |||
| 13 | |||
| 14 | if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) | ||
| 15 | # Already in cache, be silent | ||
| 16 | set(GLIB2_FIND_QUIETLY TRUE) | ||
| 17 | endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) | ||
| 18 | |||
| 19 | if (NOT WIN32) | ||
| 20 | FIND_PACKAGE(PkgConfig) | ||
| 21 | PKG_CHECK_MODULES(PC_GLIB2 glib-2.0) | ||
| 22 | SET(GLIB2_DEFINITIONS ${PC_GLIB2_CFLAGS_OTHER}) | ||
| 23 | endif(NOT WIN32) | ||
| 24 | |||
| 25 | find_path(GLIB2_MAIN_INCLUDE_DIR glib.h | ||
| 26 | PATH_SUFFIXES glib-2.0 | ||
| 27 | PATHS ${_LibGLIB2IncDir} ) | ||
| 28 | |||
| 29 | # search the glibconfig.h include dir under the same root where the library is found | ||
| 30 | find_library(GLIB2_LIBRARIES | ||
| 31 | NAMES glib-2.0 | ||
| 32 | PATHS ${_LibGLIB2LinkDir} ) | ||
| 33 | |||
| 34 | get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH) | ||
| 35 | |||
| 36 | find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h | ||
| 37 | PATH_SUFFIXES glib-2.0/include | ||
| 38 | PATHS ${_LibGLIB2IncDir} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) | ||
| 39 | |||
| 40 | set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}") | ||
| 41 | |||
| 42 | # not sure if this include dir is optional or required | ||
| 43 | # for now it is optional | ||
| 44 | if(GLIB2_INTERNAL_INCLUDE_DIR) | ||
| 45 | set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}") | ||
| 46 | endif(GLIB2_INTERNAL_INCLUDE_DIR) | ||
| 47 | |||
| 48 | include(FindPackageHandleStandardArgs) | ||
| 49 | find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR) | ||
| 50 | |||
| 51 | mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES) \ No newline at end of file | ||
