Added enchant to cmake

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33167 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Kornel Benko 2010-01-22 18:40:49 +00:00
parent 407b359809
commit e2c93c5f74
2 changed files with 26 additions and 0 deletions

View File

@ -216,6 +216,21 @@ else()
message(STATUS "----- Hunspell not found, building without hunspell support")
endif()
if(WIN32)
find_library(ENCHANT_LIBRARY "libenchant")
find_path(ENCHANT_INCLUDE_DIR "enchant++.h")
else()
find_library(ENCHANT_LIBRARY "enchant" "/usr/local/lib" "/usr/lib")
find_path(ENCHANT_INCLUDE_DIR "enchant++.h" PATHS /usr/local/include /usr/local/include/enchant /usr/include /usr/include/enchant)
endif()
if (ENCHANT_LIBRARY AND ENCHANT_INCLUDE_DIR)
set(ENCHANT_FOUND TRUE)
add_definitions(-DUSE_ENCHANT=1)
message(STATUS "----- Building with USE_ENCHANT")
else()
message(STATUS "----- Enchant not found, building without enchant support")
endif()
message(STATUS "")
if(nls OR all)
set(nls TRUE CACHE TYPE STRING)

View File

@ -23,12 +23,14 @@ file(GLOB lyx_sources ${TOP_SRC_DIR}/src/${LYX_CPP_FILES})
file(GLOB lyx_headers ${TOP_SRC_DIR}/src/${LYX_HPP_FILES})
list(REMOVE_ITEM lyx_sources
${TOP_SRC_DIR}/src/EnchantChecker.cpp
${TOP_SRC_DIR}/src/AspellChecker.cpp
${TOP_SRC_DIR}/src/HunspellChecker.cpp
${TOP_SRC_DIR}/src/Variables.cpp
${TOP_SRC_DIR}/src/Section.cpp)
list(REMOVE_ITEM lyx_headers
${TOP_SRC_DIR}/src/EnchantChecker.h
${TOP_SRC_DIR}/src/AspellChecker.h
${TOP_SRC_DIR}/src/HunspellChecker.h
${TOP_SRC_DIR}/src/Variables.h
@ -45,6 +47,12 @@ if (ASPELL_FOUND)
list(APPEND lyx_headers ${TOP_SRC_DIR}/src/AspellChecker.h)
endif()
if (ENCHANT_FOUND)
include_directories("${ENCHANT_INCLUDE_DIR}")
list(APPEND lyx_sources ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
list(APPEND lyx_headers ${TOP_SRC_DIR}/src/EnchantChecker.h)
endif()
lyx_automoc(${TOP_SRC_DIR}/src/Compare.cpp ${TOP_SRC_DIR}/src/Server.cpp)
include_directories(${CMAKE_CURRENT_BINARY_DIR}
@ -91,6 +99,9 @@ endif()
if (ASPELL_FOUND)
target_link_libraries(${_lyx} ${ASPELL_LIBRARY})
endif()
if (ENCHANT_FOUND)
target_link_libraries(${_lyx} ${ENCHANT_LIBRARY})
endif()
if (APPLE)
target_link_libraries(${_lyx} "-bind_at_load")