bibletime /tags/rel-1-7-alpha3/bibletime/cmake/FindCLucene.cmake

Language CMake Lines 81
MD5 Hash daed103e2df5e3610e8c09ac173112ab
Repository https://bibletime.svn.sourceforge.net/svnroot/bibletime View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
SET(CLUCENE_REQUIRED_VERSION "0.9.16a")

# This module looks for clucene (http://clucene.sf.net) support
# It will define the following values
#
# CLUCENE_INCLUDE_DIR  = where CLucene/StdHeader.h can be found
# CLUCENE_LIBRARY_DIR  = where CLucene/clucene-config.h can be found
# CLUCENE_LIBRARY      = the library to link against CLucene
# CLucene_FOUND        = set to 1 if clucene is found
#
 INCLUDE(CheckSymbolExists)

IF(EXISTS ${PROJECT_CMAKE}/CLuceneConfig.cmake)
  INCLUDE(${PROJECT_CMAKE}/CLuceneConfig.cmake)
ENDIF(EXISTS ${PROJECT_CMAKE}/CLuceneConfig.cmake)

  SET(TRIAL_LIBRARY_PATHS
    $ENV{CLUCENE_HOME}/lib${LIB_SUFFIX}
    ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
    /usr/lib${LIB_SUFFIX}
    /usr/local/lib${LIB_SUFFIX}
    /sw/lib${LIB_SUFFIX}
  ) 
  SET(TRIAL_INCLUDE_PATHS
    $ENV{CLUCENE_HOME}/include
    ${CMAKE_INSTALL_PREFIX}/include
    /sw/include
  ) 

  FIND_LIBRARY(CLUCENE_LIBRARY clucene
      NAMES clucene-core
      PATHS ${TRIAL_LIBRARY_PATHS})
  IF (CLUCENE_LIBRARY)
    MESSAGE(STATUS "Found CLucene library: ${CLUCENE_LIBRARY}")
  ENDIF (CLUCENE_LIBRARY)
  FIND_PATH(CLUCENE_INCLUDE_DIR
      NAMES CLucene.h
      PATHS ${TRIAL_INCLUDE_PATHS})

  IF (CLUCENE_INCLUDE_DIR)
    MESSAGE(STATUS "Found CLucene include dir: ${CLUCENE_INCLUDE_DIR}")
  ENDIF (CLUCENE_INCLUDE_DIR)
  
  IF(NOT MSVC)
    FIND_PATH(CLUCENE_LIBRARY_DIR
        NAMES CLucene/clucene-config.h PATHS ${TRIAL_LIBRARY_PATHS})
    IF (CLUCENE_LIBRARY_DIR)
      MESSAGE(STATUS "Found CLucene library dir: ${CLUCENE_LIBRARY_DIR}")
      FILE(READ ${CLUCENE_LIBRARY_DIR}/CLucene/clucene-config.h CLCONTENT)
      STRING(REGEX MATCH "_CL_VERSION +\".*\"" CLMATCH ${CLCONTENT})
      IF (CLMATCH)
        STRING(REGEX REPLACE "_CL_VERSION +\"(.*)\"" "\\1" CLVERSION ${CLMATCH})
      ENDIF (CLMATCH)
      IF (CLVERSION STRLESS ${CLUCENE_REQUIRED_VERSION})
        MESSAGE(FATAL_ERROR "CLucene version is less than ${CLUCENE_REQUIRED_VERSION}")
      ENDIF (CLVERSION STRLESS ${CLUCENE_REQUIRED_VERSION})
    ENDIF (CLUCENE_LIBRARY_DIR)
  ELSE(NOT MSVC)
    #msvc doesnt use a config file
    SET(CLUCENE_LIBRARY_DIR ${CLUCENE_INCLUDE_DIR})
  ENDIF(NOT MSVC)


IF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR)
  SET(CLucene_FOUND 1)
  IF(NOT CLucene_FIND_QUIETLY)
    MESSAGE(STATUS "Found CLucene: ${CLUCENE_LIBRARY}")
  ENDIF(NOT CLucene_FIND_QUIETLY)
ELSE(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR)
  SET(CLucene_FOUND 0)
  IF(CLucene_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could not find CLucene. Please install CLucene = 0.9.16a (http://clucene.sf.net)")
  ENDIF(CLucene_FIND_REQUIRED)
ENDIF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR)

MARK_AS_ADVANCED(
  CLUCENE_INCLUDE_DIR 
  CLUCENE_LIBRARY_DIR 
  CLUCENE_LIBRARY 
)
Back to Top