Diff of /CMakeModules/FindPANO13.cmake [0f0548] .. [aacb50] Maximize Restore

  Switch to unified view

a/CMakeModules/FindPANO13.cmake b/CMakeModules/FindPANO13.cmake
...
...
30
        ${SOURCE_BASE_DIR}/pano13
30
        ${SOURCE_BASE_DIR}/pano13
31
  )
31
  )
32
32
33
IF(PANO13_INCLUDE_DIR)
33
IF(PANO13_INCLUDE_DIR)
34
  IF(PANO13_LIBRARIES)
34
  IF(PANO13_LIBRARIES)
35
    FILE(STRINGS "${PANO13_INCLUDE_DIR}/pano13/version.h" PANO13_VERSION_H REGEX "#define VERSION")
36
    STRING(REGEX REPLACE ".*#define +VERSION +\"([.0-9]+).*" "\\1" PANO13_VERSION "${PANO13_VERSION_H}")
37
    STRING(REGEX REPLACE "([^.]+)\\.([^.]+)\\.([^.]+)" "\\1" PANO13_VERSION_MAJOR "${PANO13_VERSION}")
38
    STRING(REGEX REPLACE "([^.]+)\\.([^.]+)\\.([^.]+)" "\\2" PANO13_VERSION_MINOR "${PANO13_VERSION}")
39
    STRING(REGEX REPLACE "([^.]+)\\.([^.]+)\\.([^.]+)" "\\3" PANO13_VERSION_PATCH "${PANO13_VERSION}")
40
    # version comparison stuff. Very ugly for multiple reasons:
41
    # + VERSION_GREATER is not available in cmake 2.6.0.
42
    # + cmake does not allow combining AND with OR like in e.g.
43
    #   "if(2 LESS 3 AND (3 LESS 4 OR 5 LESS 6))".
44
    # + At least cmake 2.6.0 does not set PANO13_FIND_VERSION_* to 0 by default.
45
    IF(NOT DEFINED PANO13_FIND_VERSION_MAJOR OR "${PANO13_VERSION_MAJOR}" GREATER "${PANO13_FIND_VERSION_MAJOR}")
35
    SET( PANO13_FOUND "YES" )
46
      SET( PANO13_FOUND "YES" )
36
    FIND_LIBRARY( PANO13_DEBUG_LIBRARIES
47
    ELSEIF("${PANO13_VERSION_MAJOR}" EQUAL "${PANO13_FIND_VERSION_MAJOR}")
37
      NAMES Panotools pano13d pano13
48
      IF(NOT DEFINED PANO13_FIND_VERSION_MINOR OR "${PANO13_VERSION_MINOR}" GREATER "${PANO13_FIND_VERSION_MINOR}")
38
      PATHS /usr/lib /usr/local/lib 
49
        SET( PANO13_FOUND "YES" )
39
            "${PANO13_INCLUDE_DIR}/pano13/Debug LIB CMD"
50
      ELSEIF("${PANO13_VERSION_MINOR}" EQUAL "${PANO13_FIND_VERSION_MINOR}")
40
            "${PANO13_INCLUDE_DIR}/pano13/Debug CMD/Win32"
51
        IF(NOT DEFINED PANO13_FIND_VERSION_PATCH OR NOT "${PANO13_VERSION_PATCH}" LESS "${PANO13_FIND_VERSION_PATCH}")
41
            ${PANO13_INCLUDE_DIR}/pano13/Debug
52
          SET( PANO13_FOUND "YES" )
42
            ${SOURCE_BASE_DIR}/pano13/lib
53
        ENDIF()
43
            ${SOURCE_BASE_DIR}/pano13
54
      ENDIF()
44
    )
55
    ENDIF()
45
  ENDIF(PANO13_LIBRARIES)
56
  ENDIF(PANO13_LIBRARIES)
46
ENDIF(PANO13_INCLUDE_DIR)
57
ENDIF(PANO13_INCLUDE_DIR)
47
58
 
59
IF(PANO13_FOUND)
60
  SET(PANO13_VERSION_COUNT 3)
61
  IF(NOT PANO13_FIND_QUIETLY)
62
    MESSAGE(STATUS "libpano13 version: ${PANO13_VERSION} major ${PANO13_VERSION_MAJOR} minor ${PANO13_VERSION_MINOR} patch ${PANO13_VERSION_PATCH}")
63
  ENDIF(NOT PANO13_FIND_QUIETLY)
64
  FIND_LIBRARY( PANO13_DEBUG_LIBRARIES
65
    NAMES Panotools pano13d pano13
66
    PATHS /usr/lib /usr/local/lib 
67
    "${PANO13_INCLUDE_DIR}/pano13/Debug LIB CMD"
68
    "${PANO13_INCLUDE_DIR}/pano13/Debug CMD/Win32"
69
    ${PANO13_INCLUDE_DIR}/pano13/Debug
70
    ${SOURCE_BASE_DIR}/pano13/lib
71
    ${SOURCE_BASE_DIR}/pano13
72
  )
73
ELSE(PANO13_FOUND)
74
  IF(PANO13_FIND_REQUIRED)
75
    IF(PANO13_VERSION)
76
      MESSAGE(FATAL_ERROR "libpano13 version: ${PANO13_FIND_VERSION} required, ${PANO13_VERSION} found")
77
    ELSE(PANO13_VERSION)
78
      MESSAGE(FATAL_ERROR "libpano13 not found")
79
    ENDIF(PANO13_VERSION)
80
  ELSE(PANO13_FIND_REQUIRED)
81
    IF(PANO13_VERSION)
82
      MESSAGE(STATUS "libpano13 version: ${PANO13_FIND_VERSION} required, ${PANO13_VERSION} found")
83
    ELSE(PANO13_VERSION)
84
      MESSAGE(STATUS "libpano13 not found")
85
    ENDIF(PANO13_VERSION)
86
  ENDIF(PANO13_FIND_REQUIRED)
87
ENDIF(PANO13_FOUND)