summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-07-18 13:56:45 -0400
committerAlexander Neundorf <neundorf@kde.org>2007-07-18 13:56:45 -0400
commitb5f656e0de6e39f0fd935203e0ef2b4231af733d (patch)
tree8b58020cca8fef8af4df6ae631fddf49e3230049
parente118a62709fdc84e6c5b5b8d0bb055895d206ec9 (diff)
downloadcmake-b5f656e0de6e39f0fd935203e0ef2b4231af733d.tar.gz
ENH: use the new FIND_PACKAGE_HANDLE_STANDARD_ARGS in some of the FindXXX
modules, remove some of the extra search paths which are also searched by default Alex
-rw-r--r--Modules/FindBZip2.cmake20
-rw-r--r--Modules/FindCups.cmake1
-rw-r--r--Modules/FindJPEG.cmake38
-rw-r--r--Modules/FindJasper.cmake15
-rw-r--r--Modules/FindLibXslt.cmake21
-rw-r--r--Modules/FindOpenAL.cmake38
-rw-r--r--Modules/FindPNG.cmake23
-rw-r--r--Modules/FindPerlLibs.cmake13
-rw-r--r--Modules/FindPythonInterp.cmake10
-rw-r--r--Modules/FindTCL.cmake2
-rw-r--r--Modules/FindTIFF.cmake23
-rw-r--r--Modules/FindZLIB.cmake41
12 files changed, 73 insertions, 172 deletions
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index c8464249be..9c3d9e3438 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -21,22 +21,14 @@ FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 )
-IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
- SET(BZIP2_FOUND TRUE)
- INCLUDE(CheckLibraryExists)
- CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
-ELSE (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
- SET(BZIP2_FOUND FALSE)
-ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
+# handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
IF (BZIP2_FOUND)
- IF (NOT BZip2_FIND_QUIETLY)
- MESSAGE(STATUS "Found BZip2: ${BZIP2_LIBRARIES}")
- ENDIF (NOT BZip2_FIND_QUIETLY)
-ELSE (BZIP2_FOUND)
- IF (BZip2_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could NOT find BZip2")
- ENDIF (BZip2_FIND_REQUIRED)
+ INCLUDE(CheckLibraryExists)
+ CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
ENDIF (BZIP2_FOUND)
MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index 0fd0ae5b87..143cae9802 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -43,5 +43,6 @@ ELSE (CUPS_FOUND)
ENDIF (Cups_FIND_REQUIRED)
ENDIF (CUPS_FOUND)
+
MARK_AS_ADVANCED(CUPS_INCLUDE_DIR CUPS_LIBRARIES)
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 3397817886..2fd5f0ecce 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -7,40 +7,22 @@
# also defined, but not for general use are
# JPEG_LIBRARY, where to find the JPEG library.
-FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h
-/usr/local/include
-/usr/include
-)
+FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h)
SET(JPEG_NAMES ${JPEG_NAMES} jpeg)
-FIND_LIBRARY(JPEG_LIBRARY
- NAMES ${JPEG_NAMES}
- PATHS /usr/lib /usr/local/lib
- )
-
-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)
+FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
+# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG JPEG_LIBRARY 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)
+IF(JPEG_FOUND)
+ SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
+ENDIF(JPEG_FOUND)
# Deprecated declarations.
SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
-MARK_AS_ADVANCED(
- JPEG_LIBRARY
- JPEG_INCLUDE_DIR
- )
+MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR )
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
index ac284c3735..0243ce7e49 100644
--- a/Modules/FindJasper.cmake
+++ b/Modules/FindJasper.cmake
@@ -23,21 +23,16 @@ FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h)
FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper)
IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
- SET(JASPER_FOUND TRUE)
SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
-ELSE (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
- SET(JASPER_FOUND FALSE)
ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
+# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper JASPER_LIBRARY JASPER_INCLUDE_DIR JPEG_LIBRARIES)
IF (JASPER_FOUND)
- IF (NOT Jasper_FIND_QUIETLY)
- MESSAGE(STATUS "Found jasper: ${JASPER_LIBRARIES}")
- ENDIF (NOT Jasper_FIND_QUIETLY)
-ELSE (JASPER_FOUND)
- IF (Jasper_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could NOT find jasper library")
- ENDIF (Jasper_FIND_REQUIRED)
+ SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
ENDIF (JASPER_FOUND)
MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARIES JASPER_LIBRARY)
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
index fcebd0c120..338f87aa64 100644
--- a/Modules/FindLibXslt.cmake
+++ b/Modules/FindLibXslt.cmake
@@ -34,21 +34,12 @@ FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt
${_LibXsltLinkDir}
)
-IF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
- SET(LIBXSLT_FOUND TRUE)
-ELSE (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
- SET(LIBXSLT_FOUND FALSE)
-ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
-
-IF (LIBXSLT_FOUND)
- IF (NOT LibXslt_FIND_QUIETLY)
- MESSAGE(STATUS "Found LibXslt: ${LIBXSLT_LIBRARIES}")
- ENDIF (NOT LibXslt_FIND_QUIETLY)
-ELSE (LIBXSLT_FOUND)
- IF (LibXslt_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could NOT find LibXslt")
- ENDIF (LibXslt_FIND_REQUIRED)
-ENDIF (LIBXSLT_FOUND)
+INCLUDE(FindPackageHandleStandardArgs)
+
+# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR)
+
MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES)
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index 2903b88c9c..a8d5310a7d 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -15,30 +15,15 @@
# Tiger will include OpenAL as part of the System.
# But for now, we have to look around.
# Other (Unix) systems should be able to utilize the non-framework paths.
-FIND_PATH(OPENAL_INCLUDE_DIR al.h
+FIND_PATH(OPENAL_INCLUDE_DIR NAMES al.h
+ PATH_SUFFIXES AL OpenAL
+ PATHS
$ENV{OPENALDIR}/include
~/Library/Frameworks/OpenAL.framework/Headers
/Library/Frameworks/OpenAL.framework/Headers
/System/Library/Frameworks/OpenAL.framework/Headers # Tiger
- /usr/local/include/AL
- /usr/local/include/OpenAL
- /usr/local/include
- /usr/include/AL
- /usr/include/OpenAL
- /usr/include
- /sw/include/AL # Fink
- /sw/include/OpenAL
- /sw/include
- /opt/local/include/AL # DarwinPorts
- /opt/local/include/OpenAL
- /opt/local/include
- /opt/csw/include/AL # Blastwave
- /opt/csw/include/OpenAL
- /opt/csw/include
- /opt/include/AL
- /opt/include/OpenAL
- /opt/include
)
+
# I'm not sure if I should do a special casing for Apple. It is
# unlikely that other Unix systems will find the framework path.
# But if they do ([Next|Open|GNU]Step?),
@@ -67,18 +52,11 @@ ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
PATHS
$ENV{OPENALDIR}/lib
$ENV{OPENALDIR}/libs
- /usr/local/lib
- /usr/lib
- /sw/lib
- /opt/local/lib
- /opt/csw/lib
- /opt/lib
)
ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
-SET(OPENAL_FOUND "NO")
-IF(OPENAL_LIBRARY)
- SET(OPENAL_FOUND "YES")
-ENDIF(OPENAL_LIBRARY)
-
+# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index c082c0192d..3b776e7cf6 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -11,26 +11,18 @@
# PNG depends on Zlib
INCLUDE(FindZLIB)
-SET(PNG_FOUND "NO")
-
IF(ZLIB_FOUND)
FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
- /usr/local/include
- /usr/include
/usr/local/include/libpng # OpenBSD
)
SET(PNG_NAMES ${PNG_NAMES} png libpng)
- FIND_LIBRARY(PNG_LIBRARY
- NAMES ${PNG_NAMES}
- PATHS /usr/lib /usr/local/lib
- )
+ FIND_LIBRARY(PNG_LIBRARY NAMES ${PNG_NAMES} )
IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
# png.h includes zlib.h. Sigh.
SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
- SET(PNG_FOUND "YES")
IF (CYGWIN)
IF(BUILD_SHARED_LIBS)
@@ -44,14 +36,9 @@ IF(ZLIB_FOUND)
ENDIF(ZLIB_FOUND)
-IF (PNG_FOUND)
- IF (NOT PNG_FIND_QUIETLY)
- MESSAGE(STATUS "Found PNG: ${PNG_LIBRARY}")
- ENDIF (NOT PNG_FIND_QUIETLY)
-ELSE (PNG_FOUND)
- IF (PNG_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find PNG library")
- ENDIF (PNG_FIND_REQUIRED)
-ENDIF (PNG_FOUND)
+# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index 1cfe7ef4c0..191ef91410 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -23,12 +23,7 @@ FIND_PATH(PERL_INCLUDE_PATH perl.h
${PERL_POSSIBLE_INCLUDE_PATHS})
-FIND_PROGRAM(PERL_EXECUTABLE
- NAMES perl
- PATHS
- /usr/bin
- /usr/local/bin
- )
+FIND_PROGRAM(PERL_EXECUTABLE perl )
IF(PERL_EXECUTABLE)
EXEC_PROGRAM(${PERL_EXECUTABLE}
@@ -57,6 +52,12 @@ FIND_LIBRARY(PERL_LIBRARY
PATHS ${PERL_POSSIBLE_LIB_PATHS}
)
+# handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PerlLibs PERL_LIBRARY PERL_INCLUDE_PATH)
+
+
MARK_AS_ADVANCED(
PERL_INCLUDE_PATH
PERL_EXECUTABLE
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 44a932d96c..9dc097eb57 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -19,9 +19,7 @@ FIND_PROGRAM(PYTHON_EXECUTABLE
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
)
-SET(PYTHONINTERP_FOUND)
-IF(PYTHON_EXECUTABLE)
- SET(PYTHONINTERP_FOUND ON)
-ENDIF(PYTHON_EXECUTABLE)
-
-
+# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp PYTHON_EXECUTABLE)
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 2099e2711a..b0ee79ba10 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -35,8 +35,6 @@ SET (TCLTK_POSSIBLE_LIB_PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib
- /usr/lib
- /usr/local/lib
)
FIND_LIBRARY(TCL_LIBRARY
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index 111b8d4d85..e2ca1fe084 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -7,21 +7,16 @@
# also defined, but not for general use are
# TIFF_LIBRARY, where to find the TIFF library.
-FIND_PATH(TIFF_INCLUDE_DIR tiff.h
- /usr/local/include
- /usr/include
-)
+FIND_PATH(TIFF_INCLUDE_DIR tiff.h)
SET(TIFF_NAMES ${TIFF_NAMES} tiff)
-FIND_LIBRARY(TIFF_LIBRARY
- NAMES ${TIFF_NAMES}
- PATHS /usr/lib /usr/local/lib
- )
+FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} )
-IF(TIFF_INCLUDE_DIR)
- IF(TIFF_LIBRARY)
- SET( TIFF_FOUND "YES" )
- SET( TIFF_LIBRARIES ${TIFF_LIBRARY} )
- ENDIF(TIFF_LIBRARY)
-ENDIF(TIFF_INCLUDE_DIR)
+# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF TIFF_LIBRARY TIFF_INCLUDE_DIR)
+IF(TIFF_FOUND)
+ SET( TIFF_LIBRARIES ${TIFF_LIBRARY} )
+ENDIF(TIFF_FOUND)
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index b2a1a66b30..fd6798fd49 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -11,37 +11,20 @@ IF (ZLIB_INCLUDE_DIR)
SET(ZLIB_FIND_QUIETLY TRUE)
ENDIF (ZLIB_INCLUDE_DIR)
-FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
- /usr/local/include
- /usr/include
-)
+FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
SET(ZLIB_NAMES z zlib zdll)
-FIND_LIBRARY(ZLIB_LIBRARY
- NAMES ${ZLIB_NAMES}
- PATHS /usr/lib /usr/local/lib
-)
+FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} )
-IF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
- SET(ZLIB_FOUND TRUE)
- SET( ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
-ELSE (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
- SET(ZLIB_FOUND FALSE)
- SET( ZLIB_LIBRARIES )
-ENDIF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
+# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-IF (ZLIB_FOUND)
- IF (NOT ZLIB_FIND_QUIETLY)
- MESSAGE(STATUS "Found ZLIB: ${ZLIB_LIBRARY}")
- ENDIF (NOT ZLIB_FIND_QUIETLY)
-ELSE (ZLIB_FOUND)
- IF (ZLIB_FIND_REQUIRED)
- MESSAGE(STATUS "Looked for Z libraries named ${ZLIBS_NAMES}.")
- MESSAGE(FATAL_ERROR "Could NOT find z library")
- ENDIF (ZLIB_FIND_REQUIRED)
-ENDIF (ZLIB_FOUND)
+IF(ZLIB_FOUND)
+ SET( ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
+ELSE(ZLIB_FOUND)
+ SET( ZLIB_LIBRARIES )
+ENDIF(ZLIB_FOUND)
-MARK_AS_ADVANCED(
- ZLIB_LIBRARY
- ZLIB_INCLUDE_DIR
- )
+MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )