compile
[kdegraphics.git] / cmake / modules / FindKSane.cmake
blob4491eb0ff70c58f66e56887b230e1f2fb0fd572e
1 # cmake macro to test if libksane is installed
3 #  KSANE_FOUND - system has KSANE libs
4 #  KSANE_INCLUDE_DIR - the KSANE include directory
5 #  KSANE_LIBRARY - The library needed to use KSANE
7 if (KSANE_INCLUDE_DIR)
8   # Already in cache, be silent
9   set(KSANE_FIND_QUIETLY TRUE)
10 endif (KSANE_INCLUDE_DIR)
12 FIND_FILE(KSANE_LOCAL_FOUND libksane/version.h.cmake ${CMAKE_SOURCE_DIR}/libs/libksane NO_DEFAULT_PATH)
14 if (KSANE_LOCAL_FOUND)
15     set(KSANE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/libs/libksane)
16     set(KSANE_DEFINITIONS -I${KSANE_INCLUDE_DIR})
17     set(KSANE_LIBRARY ksane)
18     message(STATUS "Found KSane library in local sub-folder: ${KSANE_LIBRARY}")
19     set(KSANE_FOUND TRUE)
20     MARK_AS_ADVANCED(KSANE_INCLUDE_DIR KSANE_LIBRARY)
21 else (KSANE_LOCAL_FOUND)
23     FIND_PATH(KSANE_INCLUDE_DIR libksane/ksane.h ${KDE4_INCLUDES})
25     FIND_LIBRARY(KSANE_LIBRARY ksane PATH ${KDE4_LIB_DIR})
27     if (KSANE_INCLUDE_DIR AND KSANE_LIBRARY)
28         set(KSANE_FOUND TRUE)
29     else (KSANE_INCLUDE_DIR AND KSANE_LIBRARY)
30         set(KSANE_FOUND FALSE)
31     endif (KSANE_INCLUDE_DIR AND KSANE_LIBRARY)
33     if (KSANE_FOUND)
34         if (NOT KSane_FIND_QUIETLY)
35             message(STATUS "Found libksane: ${KSANE_LIBRARY}")
36         endif (NOT KSane_FIND_QUIETLY)
37     else (KSANE_FOUND)
38         if (KSane_FIND_REQUIRED)
39             message(FATAL_ERROR "Could not find libksane")
40         endif (KSane_FIND_REQUIRED)
41     endif (KSANE_FOUND)
42 endif (KSANE_LOCAL_FOUND)
44 MARK_AS_ADVANCED(KSANE_INCLUDE_DIR KSANE_LIBRARY)