1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-17 22:38:33 +01:00

Make CMake actually read the CLucene version, make it find both needed

libraries, and for the love of God make it link already.
This commit is contained in:
Jeff Mitchell 2011-03-09 18:25:17 -05:00
parent 35e26db33d
commit b57e9fbf54
2 changed files with 32 additions and 25 deletions

View File

@ -4,7 +4,7 @@
#
# 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_LIBRARIES = the libraries to link against CLucene
# CLUCENE_VERSION = The CLucene version string
# CLucene_FOUND = set to 1 if clucene is found
#
@ -20,8 +20,6 @@ IF(EXISTS ${PROJECT_CMAKE}/CLuceneConfig.cmake)
INCLUDE(${PROJECT_CMAKE}/CLuceneConfig.cmake)
ENDIF(EXISTS ${PROJECT_CMAKE}/CLuceneConfig.cmake)
MESSAGE(STATUS "LIB_SUFFIX is ${LIB_SUFFIX}")
SET(TRIAL_LIBRARY_PATHS
$ENV{CLUCENE_HOME}/lib${LIB_SUFFIX}
${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
@ -39,13 +37,25 @@ SET(TRIAL_INCLUDE_PATHS
/sw/include
/usr/pkg/include
)
FIND_LIBRARY_WITH_DEBUG(CLUCENE_LIBRARY
FIND_LIBRARY_WITH_DEBUG(CLUCENE_CORE_LIBRARY
WIN32_DEBUG_POSTFIX d
NAMES clucene-shared clucene-core
NAMES clucene-core
PATHS ${TRIAL_LIBRARY_PATHS})
IF (CLUCENE_LIBRARY)
MESSAGE(STATUS "Found CLucene library: ${CLUCENE_LIBRARY}")
ENDIF (CLUCENE_LIBRARY)
IF (CLUCENE_CORE_LIBRARY)
MESSAGE(STATUS "Found CLucene core library: ${CLUCENE_CORE_LIBRARY}")
ENDIF (CLUCENE_CORE_LIBRARY)
FIND_LIBRARY_WITH_DEBUG(CLUCENE_SHARED_LIBRARY
WIN32_DEBUG_POSTFIX d
NAMES clucene-shared
PATHS ${TRIAL_LIBRARY_PATHS})
IF (CLUCENE_SHARED_LIBRARY)
MESSAGE(STATUS "Found CLucene shared library: ${CLUCENE_SHARED_LIBRARY}")
ENDIF (CLUCENE_SHARED_LIBRARY)
IF(CLUCENE_CORE_LIBRARY AND CLUCENE_SHARED_LIBRARY)
SET(CLUCENE_LIBRARIES ${CLUCENE_CORE_LIBRARY} ${CLUCENE_SHARED_LIBRARY})
ENDIF(CLUCENE_CORE_LIBRARY AND CLUCENE_SHARED_LIBRARY)
FIND_PATH(CLUCENE_INCLUDE_DIR
NAMES CLucene.h
PATHS ${TRIAL_INCLUDE_PATHS})
@ -65,28 +75,24 @@ FIND_PATH(CLUCENE_LIBRARY_DIR
PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
IF (CLUCENE_LIBRARY_DIR)
MESSAGE(STATUS "Found CLucene library dir: ${CLUCENE_LIBRARY_DIR}")
FILE(READ ${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake CLCONTENT)
STRING(REGEX MATCH "_CL_VERSION +\".*\"" CLMATCH ${CLCONTENT})
IF (CLMATCH)
STRING(REGEX REPLACE "_CL_VERSION +\"(.*)\"" "\\1" CLUCENE_VERSION ${CLMATCH})
IF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
SET(CLUCENE_GOOD_VERSION FALSE)
ENDIF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
IF (CLUCENE_VERSION STREQUAL "0.9.17")
MESSAGE(ERROR "CLucene version 0.9.17 is not supported.")
SET(CLUCENE_GOOD_VERSION FALSE)
ENDIF (CLUCENE_VERSION STREQUAL "0.9.17")
ENDIF (CLMATCH)
INCLUDE(${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
IF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
SET(CLUCENE_GOOD_VERSION FALSE)
ENDIF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
IF (CLUCENE_VERSION STREQUAL "0.9.17")
MESSAGE(ERROR "CLucene version 0.9.17 is not supported.")
SET(CLUCENE_GOOD_VERSION FALSE)
ENDIF (CLUCENE_VERSION STREQUAL "0.9.17")
ENDIF (CLUCENE_LIBRARY_DIR)
IF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
IF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARIES AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
SET(CLucene_FOUND TRUE)
ENDIF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
ENDIF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARIES AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
IF(CLucene_FOUND)
IF(NOT CLucene_FIND_QUIETLY)
MESSAGE(STATUS "Found CLucene: ${CLUCENE_LIBRARY} version ${CLUCENE_VERSION}")
MESSAGE(STATUS "Found CLucene: ${CLUCENE_LIBRARIES} version ${CLUCENE_VERSION}")
ENDIF(NOT CLucene_FIND_QUIETLY)
ELSE(CLucene_FOUND)
IF(CLucene_FIND_REQUIRED)
@ -97,5 +103,5 @@ ENDIF(CLucene_FOUND)
MARK_AS_ADVANCED(
CLUCENE_INCLUDE_DIR
CLUCENE_LIBRARY_DIR
CLUCENE_LIBRARY
CLUCENE_LIBRARIES
)

View File

@ -219,6 +219,7 @@ TARGET_LINK_LIBRARIES( tomahawk
${QJSON_LIBRARIES}
${TAGLIB_LIBRARIES}
${QTWEETLIB_LIBRARIES}
${CLUCENE_LIBRARIES}
)