summaryrefslogtreecommitdiff
path: root/Modules/FindCups.cmake
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2006-11-30 16:23:23 -0500
committerAlexander Neundorf <neundorf@kde.org>2006-11-30 16:23:23 -0500
commit464e3c137e12557e5174b58829a7bbe5564175f9 (patch)
tree23efbb601c9dfc489239daf8ba676ff6fe0cbaee /Modules/FindCups.cmake
parent4c87d57e71b1bb4aee20e2e44cd431fd68810125 (diff)
downloadcmake-464e3c137e12557e5174b58829a7bbe5564175f9.tar.gz
ENH: add a module to find Cups (#3081), taken from KDE svn
Alex
Diffstat (limited to 'Modules/FindCups.cmake')
-rw-r--r--Modules/FindCups.cmake47
1 files changed, 47 insertions, 0 deletions
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
new file mode 100644
index 0000000000..0fd0ae5b87
--- /dev/null
+++ b/Modules/FindCups.cmake
@@ -0,0 +1,47 @@
+# - Try to find the Cups printing system
+# Once done this will define
+#
+# CUPS_FOUND - system has Cups
+# CUPS_INCLUDE_DIR - the Cups include directory
+# CUPS_LIBRARIES - Libraries needed to use Cups
+# Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which
+# features this function (i.e. at least 1.1.19)
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckLibraryExists)
+
+FIND_PATH(CUPS_INCLUDE_DIR cups/cups.h )
+
+FIND_LIBRARY(CUPS_LIBRARIES NAMES cups )
+
+IF (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
+ SET(CUPS_FOUND TRUE)
+
+ # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
+ CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+ IF (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE AND NOT CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+ SET(CUPS_FOUND FALSE)
+ ENDIF (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE AND NOT CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+
+ELSE (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
+ SET(CUPS_FOUND FALSE)
+ENDIF (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES)
+
+IF (CUPS_FOUND)
+ IF (NOT Cups_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Cups: ${CUPS_LIBRARIES}")
+ ENDIF (NOT Cups_FIND_QUIETLY)
+ELSE (CUPS_FOUND)
+ SET(CUPS_LIBRARIES )
+ IF (Cups_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could NOT find Cups")
+ ENDIF (Cups_FIND_REQUIRED)
+ENDIF (CUPS_FOUND)
+
+MARK_AS_ADVANCED(CUPS_INCLUDE_DIR CUPS_LIBRARIES)
+