aboutsummaryrefslogtreecommitdiff
path: root/modules/FindKipi.cmake
blob: 0c6c33d76413ae845c7b13bfad9c5e936b49bd17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# - Try to find the Kipi library using cmake pkg_check_modulesi otherwise fallback to standard search
# Once done this will define:
#
#  KIPI_FOUND - system has libkipi
#  KIPI_INCLUDEDIR - the libkipi include directory
#  KIPI_LIBRARIES - Link these to use libkipi
#  KIPI_DEFINITIONS - Compiler switches required for using libkipi


if (KIPI_INCLUDEDIR AND KIPI_LIBRARIES)
    # in cache already
    SET(KIPI_FOUND TRUE)
else (KIPI_INCLUDEDIR AND KIPI_LIBRARIES)
    if(NOT WIN32)
        find_package(PkgConfig)
        if(PKG_CONFIG_EXECUTABLE)
            pkg_check_modules(KIPI libkipi>=0.2.0)
        endif(PKG_CONFIG_EXECUTABLE)
    endif(NOT WIN32)

    if(NOT KIPI_FOUND)
        find_path(KIPI_INCLUDEDIR libkipi/version.h)
        find_library(KIPI_LIBRARIES NAMES kipi)
        if (KIPI_INCLUDEDIR AND KIPI_LIBRARIES)
            set(KIPI_FOUND TRUE)
        endif (KIPI_INCLUDEDIR AND KIPI_LIBRARIES)
    endif(NOT KIPI_FOUND)
    
    if(KIPI_FOUND)
        set(KIPI_DEFINITIONS ${KIPI_CFLAGS})
        if (NOT Kipi_FIND_QUIETLY)
            message(STATUS "Found libkipi: ${KIPI_LIBRARIES}")
        endif (NOT Kipi_FIND_QUIETLY)
        set(KIPI_INCLUDE_DIR ${KIPI_INCLUDEDIR})
        mark_as_advanced( KIPI_INCLUDE_DIR )
    else(KIPI_FOUND)
        if (Kipi_FIND_REQUIRED)
            message(FATAL_ERROR "Not found required libkipi")
        endif (Kipi_FIND_REQUIRED)
    endif (KIPI_FOUND)
endif (KIPI_INCLUDEDIR AND KIPI_LIBRARIES)