ENH: fix advanced bug
[cmake.git] / Modules / FindCups.cmake
blob143cae98024b8147079369c1cb8b60c7d9382fb0
1 # - Try to find the Cups printing system
2 # Once done this will define
4 #  CUPS_FOUND - system has Cups
5 #  CUPS_INCLUDE_DIR - the Cups include directory
6 #  CUPS_LIBRARIES - Libraries needed to use Cups
7 #  Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which 
8 #  features this function (i.e. at least 1.1.19)
10 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
12 # Redistribution and use is allowed according to the terms of the BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
16 INCLUDE(CheckLibraryExists)
18 FIND_PATH(CUPS_INCLUDE_DIR cups/cups.h )
20 FIND_LIBRARY(CUPS_LIBRARIES NAMES cups )
22 IF (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
23    SET(CUPS_FOUND TRUE)
25    # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
26    CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
27    IF (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE AND NOT CUPS_HAS_IPP_DELETE_ATTRIBUTE)
28       SET(CUPS_FOUND FALSE)
29    ENDIF (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE AND NOT CUPS_HAS_IPP_DELETE_ATTRIBUTE)
31 ELSE  (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
32    SET(CUPS_FOUND FALSE)
33 ENDIF (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
35 IF (CUPS_FOUND)
36    IF (NOT Cups_FIND_QUIETLY)
37       MESSAGE(STATUS "Found Cups: ${CUPS_LIBRARIES}")
38    ENDIF (NOT Cups_FIND_QUIETLY)
39 ELSE (CUPS_FOUND)
40    SET(CUPS_LIBRARIES )
41    IF (Cups_FIND_REQUIRED)
42       MESSAGE(FATAL_ERROR "Could NOT find Cups")
43    ENDIF (Cups_FIND_REQUIRED)
44 ENDIF (CUPS_FOUND)
45   
46   
47 MARK_AS_ADVANCED(CUPS_INCLUDE_DIR CUPS_LIBRARIES)
48