Subversion Repositories Scribus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
10818 craig 1
#
2
# This file was copied from CMake 2.5. It's used to permit CMake 2.4
3
# to use the CMake 2.5-derived find scripts here.
4
#
5
IF (NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
6
  # Use the original from cmake 2.5 if possible
7
  INCLUDE(FindPackageHandleStandardArgs)
8
ELSE(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
9
  # or define our own...
10
 
11
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
12
#    This macro is intended to be used in FindXXX.cmake modules files.
13
#    It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
14
#    it also sets the <UPPERCASED_NAME>_FOUND variable.
15
#    The package is found if all variables listed are TRUE.
16
#    Example:
17
#
18
#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
19
#
20
#    LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and
21
#    LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
22
#    If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
23
#    independent whether QUIET was used or not.
24
#    If it is found, the location is reported using the VAR1 argument, so
25
#    here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
26
#    If the second argument is DEFAULT_MSG, the message in the failure case will
27
#    be "Could NOT find LibXml2", if you don't like this message you can specify
28
#    your own custom failure message there.
29
 
30
MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
31
 
32
  IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
33
    SET(_FAIL_MESSAGE "Could NOT find ${_NAME}")
34
  ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
35
    SET(_FAIL_MESSAGE "${_FAIL_MSG}")
36
  ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
37
 
38
  STRING(TOUPPER ${_NAME} _NAME_UPPER)
39
 
40
  SET(${_NAME_UPPER}_FOUND TRUE)
41
  IF(NOT ${_VAR1})
42
    SET(${_NAME_UPPER}_FOUND FALSE)
43
  ENDIF(NOT ${_VAR1})
44
 
45
  FOREACH(_CURRENT_VAR ${ARGN})
46
    IF(NOT ${_CURRENT_VAR})
47
      SET(${_NAME_UPPER}_FOUND FALSE)
48
    ENDIF(NOT ${_CURRENT_VAR})
49
  ENDFOREACH(_CURRENT_VAR)
50
 
51
  IF (${_NAME_UPPER}_FOUND)
52
    IF (NOT ${_NAME}_FIND_QUIETLY)
53
        MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}")
54
    ENDIF (NOT ${_NAME}_FIND_QUIETLY)
55
  ELSE (${_NAME_UPPER}_FOUND)
56
    IF (${_NAME}_FIND_REQUIRED)
57
        MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}")
58
    ELSE (${_NAME}_FIND_REQUIRED)
59
      IF (NOT ${_NAME}_FIND_QUIETLY)
60
        MESSAGE(STATUS "${_FAIL_MESSAGE}")
61
      ENDIF (NOT ${_NAME}_FIND_QUIETLY)
62
    ENDIF (${_NAME}_FIND_REQUIRED)
63
  ENDIF (${_NAME_UPPER}_FOUND)
64
ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
65
 
66
ENDIF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)