Browse Source

ENH: honor REQUIRED flag

Alex
Alexander Neundorf 19 years ago
parent
commit
60988dd8a2
1 changed files with 17 additions and 6 deletions
  1. 17 6
      Modules/FindJPEG.cmake

+ 17 - 6
Modules/FindJPEG.cmake

@@ -18,12 +18,23 @@ FIND_LIBRARY(JPEG_LIBRARY
   PATHS /usr/lib /usr/local/lib
   )
 
-IF (JPEG_LIBRARY)
-  IF (JPEG_INCLUDE_DIR)
-    SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
-    SET(JPEG_FOUND "YES")
-  ENDIF (JPEG_INCLUDE_DIR)
-ENDIF (JPEG_LIBRARY)
+IF (JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
+  SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
+  SET(JPEG_FOUND "YES")
+ELSE (JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
+  SET(JPEG_FOUND "NO")
+ENDIF (JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
+
+
+IF (JPEG_FOUND)
+   IF (NOT JPEG_FIND_QUIETLY)
+      MESSAGE(STATUS "Found JPEG: ${JPEG_LIBRARIES}")
+   ENDIF (NOT JPEG_FIND_QUIETLY)
+ELSE (JPEG_FOUND)
+   IF (JPEG_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "Could not find JPEG library")
+   ENDIF (JPEG_FIND_REQUIRED)
+ENDIF (JPEG_FOUND)
 
 # Deprecated declarations.
 SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )