From 044ccedb3df4f40ae1d8d7488d4dbc3b0c09484f Mon Sep 17 00:00:00 2001 From: Helio Castro Date: Tue, 11 Nov 2008 20:25:04 +0000 Subject: - Made changes requested by Alex svn path=/trunk/KDE/kdelibs/; revision=882988 --- modules/FindKdcraw.cmake | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'modules/FindKdcraw.cmake') diff --git a/modules/FindKdcraw.cmake b/modules/FindKdcraw.cmake index 4e265ce6..5527a5f4 100644 --- a/modules/FindKdcraw.cmake +++ b/modules/FindKdcraw.cmake @@ -1,23 +1,41 @@ -# - Try to find the Kdcraw library using cmake pkg_check_modules +# - Try to find the Kdcraw library using cmake pkg_check_modulesi otherwise fallback to standard search +# Once done this will define: +# +# KDCRAW_FOUND - system has libkdcraw +# KDCRAW_INCLUDEDIR - the libkdcraw include directory +# KDCRAW_LIBRARIES - Link these to use libkdcraw +# KDCRAW_DEFINITIONS - Compiler switches required for using libkdcraw + if (KDCRAW_INCLUDEDIR AND KDCRAW_LIBRARIES) # in cache already SET(KDCRAW_FOUND TRUE) else (KDCRAW_INCLUDEDIR AND KDCRAW_LIBRARIES) if(NOT WIN32) - find_package(PkgConfig REQUIRED) - if (Kdcraw_FIND_REQUIRED) - pkg_check_modules(KDCRAW REQUIRED libkdcraw>=0.2.0) - else (Kdcraw_FIND_REQUIRED) + find_package(PkgConfig) + if(PKG_CONFIG_EXECUTABLE) pkg_check_modules(KDCRAW libkdcraw>=0.2.0) - endif (Kdcraw_FIND_REQUIRED) - else(NOT WIN32) - set(KDCRAW_FOUND TRUE) + endif(PKG_CONFIG_EXECUTABLE) endif(NOT WIN32) + + if(NOT KDCRAW_FOUND) + find_path(KDCRAW_INCLUDEDIR libkdcraw/version.h) + find_library(KDCRAW_LIBRARIES NAMES kdcraw) + if (KDCRAW_INCLUDEDIR AND KDCRAW_LIBRARIES) + set(KDCRAW_FOUND TRUE) + endif (KDCRAW_INCLUDEDIR AND KDCRAW_LIBRARIES) + endif(NOT KDCRAW_FOUND) + if(KDCRAW_FOUND) set(KDCRAW_DEFINITIONS ${KDCRAW_CFLAGS}) if (NOT Kdcraw_FIND_QUIETLY) message(STATUS "Found libkdcraw: ${KDCRAW_LIBRARIES}") endif (NOT Kdcraw_FIND_QUIETLY) + set(KDCRAW_INCLUDE_DIR ${KDCRAW_INCLUDEDIR}) + mark_as_advanced( KDCRAW_INCLUDE_DIR ) + else(KDCRAW_FOUND) + if (Kdcraw_FIND_REQUIRED) + message(FATAL_ERROR "Not found required libkdcraw") + endif (Kdcraw_FIND_REQUIRED) endif (KDCRAW_FOUND) endif (KDCRAW_INCLUDEDIR AND KDCRAW_LIBRARIES) -- cgit v1.2.1