diff options
author | Gilles Caulier <caulier.gilles@gmail.com> | 2011-01-03 12:18:33 +0000 |
---|---|---|
committer | Gilles Caulier <caulier.gilles@gmail.com> | 2011-01-03 12:18:33 +0000 |
commit | ee5546713bb2999bdf7a992b8052414124fd7286 (patch) | |
tree | 1faaa4b11cb34c8cb86bfd4de455d609c65586f2 /modules/FindKipi.cmake | |
parent | 25efeac03b05b1ec701a8b7f6803f8e79cbbb6b9 (diff) | |
download | extra-cmake-modules-ee5546713bb2999bdf7a992b8052414124fd7286.tar.gz extra-cmake-modules-ee5546713bb2999bdf7a992b8052414124fd7286.tar.bz2 |
support local dir for digiKam 2.0.0
svn path=/trunk/KDE/kdelibs/; revision=1211248
Diffstat (limited to 'modules/FindKipi.cmake')
-rw-r--r-- | modules/FindKipi.cmake | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/modules/FindKipi.cmake b/modules/FindKipi.cmake index ccb699f1..13521e55 100644 --- a/modules/FindKipi.cmake +++ b/modules/FindKipi.cmake @@ -1,4 +1,8 @@ # - Try to find the Kipi library +# +# If you have put a local version of libkipi into your source tree, +# set KIPI_LOCAL_DIR to the relative path to the local directory. +# # Once done this will define # # KIPI_FOUND - system has libkipi @@ -12,65 +16,75 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -if (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES) +if (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS) message(STATUS "Found Kipi library in cache: ${KIPI_LIBRARIES}") # in cache already - SET(KIPI_FOUND TRUE) + set(KIPI_FOUND TRUE) -else (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES) +else (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS) message(STATUS "Check Kipi library in local sub-folder...") # Check if library is not in local sub-folder - find_file (KIPI_LOCAL_FOUND libkipi/version.h.cmake ${CMAKE_SOURCE_DIR}/libkipi ${CMAKE_SOURCE_DIR}/libs/libkipi NO_DEFAULT_PATH) + if (KIPI_LOCAL_DIR) + set (KIPI_LOCAL_FOUND TRUE) + else (KIPI_LOCAL_DIR) + find_file(KIPI_LOCAL_FOUND libkipi/kipi.h ${CMAKE_SOURCE_DIR}/libkipi ${CMAKE_SOURCE_DIR}/libs/libkipi NO_DEFAULT_PATH) + + if (KIPI_LOCAL_FOUND) + # Was it found in libkdcraw/ or in libs/libkdcraw? + find_file(KIPI_LOCAL_FOUND_IN_LIBS libkipi/kipi.h ${CMAKE_SOURCE_DIR}/libs/libkipi NO_DEFAULT_PATH) + if (KIPI_LOCAL_FOUND_IN_LIBS) + set(KIPI_LOCAL_DIR libs/libkipi) + else (KIPI_LOCAL_FOUND_IN_LIBS) + set(KIPI_LOCAL_DIR libkipi) + endif (KIPI_LOCAL_FOUND_IN_LIBS) + endif (KIPI_LOCAL_FOUND) + endif (KIPI_LOCAL_DIR) if (KIPI_LOCAL_FOUND) - - find_file (KIPI_LOCAL_FOUND_IN_LIBS libkipi/version.h.cmake ${CMAKE_SOURCE_DIR}/libs/libkipi NO_DEFAULT_PATH) - if (KIPI_LOCAL_FOUND_IN_LIBS) - set(KIPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/libs/libkipi) - else (KIPI_LOCAL_FOUND_IN_LIBS) - set(KIPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/libkipi) - endif (KIPI_LOCAL_FOUND_IN_LIBS) - set(KIPI_DEFINITIONS -I${KIPI_INCLUDE_DIR}) + # we need two include directories: because the version.h file is put into the build directory + # TODO KIPI_INCLUDE_DIR sounds like it should contain only one directory... + set(KIPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR} ${CMAKE_BINARY_DIR}/${KIPI_LOCAL_DIR}) + set(KIPI_DEFINITIONS "-I${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR}" "-I${CMAKE_BINARY_DIR}/${KIPI_LOCAL_DIR}") set(KIPI_LIBRARIES kipi) - message(STATUS "Found Kipi library in local sub-folder: ${KIPI_INCLUDE_DIR}") + message(STATUS "Found Kipi library in local sub-folder: ${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR}") set(KIPI_FOUND TRUE) - mark_as_advanced(KIPI_INCLUDE_DIR KIPI_LIBRARIES) + mark_as_advanced(KIPI_INCLUDE_DIR KIPI_LIBRARIES KIPI_DEFINITIONS) - else(KIPI_LOCAL_FOUND) + else (KIPI_LOCAL_FOUND) - if(NOT WIN32) + if (NOT WIN32) message(STATUS "Check Kipi library using pkg-config...") # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls - INCLUDE(UsePkgConfig) + include(UsePkgConfig) PKGCONFIG(libkipi _KIPIIncDir _KIPILinkDir _KIPILinkFlags _KIPICflags) - if(_KIPILinkFlags) + if (_KIPILinkFlags) # query pkg-config asking for a libkipi >= 0.2.0 exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=0.2.0 libkipi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull ) - if(_return_VALUE STREQUAL "0") + if (_return_VALUE STREQUAL "0") message(STATUS "Found libkipi release >= 0.2.0") set(KIPI_VERSION_GOOD_FOUND TRUE) - else(_return_VALUE STREQUAL "0") + else (_return_VALUE STREQUAL "0") message(STATUS "Found libkipi release < 0.2.0, too old") set(KIPI_VERSION_GOOD_FOUND FALSE) set(KIPI_FOUND FALSE) - endif(_return_VALUE STREQUAL "0") - else(_KIPILinkFlags) + endif (_return_VALUE STREQUAL "0") + else (_KIPILinkFlags) set(KIPI_VERSION_GOOD_FOUND FALSE) set(KIPI_FOUND FALSE) - endif(_KIPILinkFlags) - else(NOT WIN32) + endif (_KIPILinkFlags) + else (NOT WIN32) set(KIPI_VERSION_GOOD_FOUND TRUE) - endif(NOT WIN32) - if(KIPI_VERSION_GOOD_FOUND) + endif (NOT WIN32) + if (KIPI_VERSION_GOOD_FOUND) set(KIPI_DEFINITIONS ${_KIPICflags}) find_path(KIPI_INCLUDE_DIR NAMES libkipi/version.h PATHS ${KDE4_INCLUDE_DIR} ${_KIPIIncDir}) @@ -79,7 +93,7 @@ else (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES) if (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES) set(KIPI_FOUND TRUE) endif (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES) - endif(KIPI_VERSION_GOOD_FOUND) + endif (KIPI_VERSION_GOOD_FOUND) if (KIPI_FOUND) if (NOT Kipi_FIND_QUIETLY) message(STATUS "Found libkipi: ${KIPI_LIBRARIES}") @@ -94,9 +108,9 @@ else (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES) endif (NOT KIPI_LIBRARIES) endif (Kipi_FIND_REQUIRED) endif (KIPI_FOUND) - - MARK_AS_ADVANCED(KIPI_INCLUDE_DIR KIPI_LIBRARIES) - endif(KIPI_LOCAL_FOUND) + mark_as_advanced(KIPI_INCLUDE_DIR KIPI_LIBRARIES KIPI_DEFINITIONS) + + endif (KIPI_LOCAL_FOUND) -endif (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES) +endif (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS) |