[sword-svn] r2665 - in trunk: . cmake

greg.hellings at crosswire.org greg.hellings at crosswire.org
Wed Nov 2 07:53:21 MST 2011


Author: greg.hellings
Date: 2011-11-02 07:53:20 -0700 (Wed, 02 Nov 2011)
New Revision: 2665

Modified:
   trunk/CMakeLists.txt
   trunk/cmake/FindCLucene.cmake
Log:
Adding changes to CLucene detection into CMake toolchain.

Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2011-10-29 15:55:25 UTC (rev 2664)
+++ trunk/CMakeLists.txt	2011-11-02 14:53:20 UTC (rev 2665)
@@ -169,6 +169,10 @@
 	INCLUDE_DIRECTORIES(${CLUCENE_INCLUDE_DIR})
 	SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${CLUCENE_LIBRARY})
 	LINK_DIRECTORIES(${CLUCENE_LIBRARY_DIR})
+	ADD_DEFINITIONS(-DUSELUCENE)
+	IF(CLUCENE2)
+		ADD_DEFINITIONS(-DCLUCENE2)
+	ENDIF(CLUCENE2)
 ENDIF(WITH_CLUCENE)
 IF(WITH_ICU)
 	INCLUDE_DIRECTORIES(${ICU_INCLUDE_DIRS})

Modified: trunk/cmake/FindCLucene.cmake
===================================================================
--- trunk/cmake/FindCLucene.cmake	2011-10-29 15:55:25 UTC (rev 2664)
+++ trunk/cmake/FindCLucene.cmake	2011-11-02 14:53:20 UTC (rev 2665)
@@ -83,19 +83,26 @@
 FIND_PATH(CLUCENE_LIBRARY_DIR
 	NAMES CLucene/clucene-config.h PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
 IF (CLUCENE_LIBRARY_DIR)
+	SET(CLUCENE_INCLUDE_DIR ${CLUCENE_INCLUDE_DIR} ${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" 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}")
+		IF (CLUCENE_VERSION VERSION_LESS "${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.")
+		ENDIF (CLUCENE_VERSION VERSION_LESS "${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_VERSION STREQUAL "0.9.17")
+		IF (CLUCENE_VERSION VERSION_GREATER "2.0")
+			MESSAGE (STATUS "Found CLucene 2, enabling compatibility mode")
+			SET(CLUCENE2 TRUE)
+		ELSE (CLUCENE_VERSION VERSION_GREATER "2.0")
+			SET(CLUCENE2 FALSE)
+		ENDIF (CLUCENE_VERSION VERSION_GREATER "2.0")
 	ENDIF (CLMATCH)
 ELSE (CLUCENE_LIBRARY_DIR)
 	#MESSAGE(STATUS "CLucene library dir not found.")




More information about the sword-cvs mailing list