]> git.lyx.org Git - features.git/commitdiff
cmake: split out FindHunspell.cmake
authorPeter Kümmel <syntheticpp@gmx.net>
Sun, 18 Jul 2010 06:47:01 +0000 (06:47 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Sun, 18 Jul 2010 06:47:01 +0000 (06:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34961 a592a061-630c-0410-9148-cb99ea01b6c8

development/cmake/CMakeLists.txt
development/cmake/config.h.cmake
development/cmake/modules/FindASPELL.cmake
development/cmake/modules/FindHunspell.cmake [new file with mode: 0644]

index 159e7b631c36f3a4c1b08be26bb948e5e47052b3..7bd742d58f47cca8b6072fb2babd484ffdb030c3 100644 (file)
@@ -38,6 +38,7 @@ LYX_OPTION(NLS "Use nls" OFF ALL)
 LYX_OPTION(ASPELL "Require aspell" OFF ALL)
 LYX_OPTION(AIKSAURUS "Require Aiksaurus" OFF ALL)
 LYX_OPTION(ENCHANT "Require Enchant" OFF ALL)
+LYX_OPTION(HUNSPELL "Require Hunspell" OFF ALL)
 LYX_OPTION(DEBUG "Build debug version" OFF ALL)
 LYX_OPTION(RELEASE "Build release version" ON ALL)
 LYX_OPTION(PROFILE "Build profile version" OFF GCC)
@@ -64,6 +65,9 @@ if(LYX_INSTALL)
        set(LYX_NLS ON CACHE BOOL "Nls option" FORCE)
        set(LYX_ASPELL ON CACHE BOOL "Aspell option" FORCE)
        set(LYX_AIKSAURUS ON CACHE BOOL "Aiksaurus option" FORCE)
+       if (WIN32)
+               set(LYX_HUNSPELL ON CACHE BOOL "Hunspell option" FORCE)
+       endif()
        set(LYX_NO_CONSOLE ON CACHE BOOL "No console option" FORCE)
        set(LYX_PACKAGE_SUFFIX ON CACHE BOOL "Package suffix option" FORCE)
        set(LYX_RELEASE ON CACHE BOOL "Release option" FORCE)
@@ -261,6 +265,10 @@ if(LYX_ENCHANT)
        include_directories(${ENCHANT_INCLUDE_DIR})
 endif()
 
+if(LYX_HUNSPELL)
+       find_package(Hunspell REQUIRED)
+       include_directories(${HUNSPELL_INCLUDE_DIR})
+endif()
 
 if(LYX_USE_EXTERNAL_LIBINTL)
        find_package(Libintl REQUIRED)
@@ -268,23 +276,6 @@ if(LYX_USE_EXTERNAL_LIBINTL)
 endif()
 
 
-#TODO move to FindHunstall.cmake
-if(WIN32)
-  find_library(HUNSPELL_LIBRARY "libhunspell")
-else()
-  #find_library(HUNSPELL_LIBRARY NAME "hunspell" PATH "/usr/local/lib" "/usr/lib" NO_DEFAULT_PATH)
-  find_library(HUNSPELL_LIBRARY NAMES "hunspell" "hunspell-1.2" PATHS "/usr/local/lib" "/usr/lib" "/usr/lib64")
-endif()
-if (HUNSPELL_LIBRARY)
-  find_file(HUNSPELL_FOUND "hunspell/hunspell.hxx")
-endif()
-if (HUNSPELL_FOUND)
-  add_definitions(-DUSE_HUNSPELL=1)
-  message(STATUS "Building with USE_HUNSPELL")
-else()
-  message(STATUS "Hunspell not found, building without hunspell support")
-endif()
-
 
 
 if(LYX_NLS)
index f9ae04b39e704ef8905c22bf0335fee576f3503c..8e5768f12a7abd2bc4c51cc796ed8444c41f7cd8 100644 (file)
 #define USE_ENCHANT 1
 #endif
 
+#cmakedefine HUNSPELL_FOUND 1
+#ifdef HUNSPELL_FOUND
+#define USE_HUNSPELL 1
+#endif
 
 
 
index c62a09a9c78b1eeb0232a9ec365945d94203e5a5..3df73f1afdffaf55a395a4446f05d98669f21747 100644 (file)
@@ -105,4 +105,4 @@ else()
        endif()
 endif()
 
-MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARY)
+MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARY ASPELL_LIBRARY_RELEASE ASPELL_LIBRARY_DEBUG)
diff --git a/development/cmake/modules/FindHunspell.cmake b/development/cmake/modules/FindHunspell.cmake
new file mode 100644 (file)
index 0000000..452da83
--- /dev/null
@@ -0,0 +1,21 @@
+
+if(WIN32)
+  find_library(HUNSPELL_LIBRARY "libhunspell")
+else()
+  #find_library(HUNSPELL_LIBRARY NAME "hunspell" PATH "/usr/local/lib" "/usr/lib" NO_DEFAULT_PATH)
+  find_library(HUNSPELL_LIBRARY NAMES "hunspell" "hunspell-1.2" PATHS "/usr/local/lib" "/usr/lib" "/usr/lib64")
+endif()
+
+FIND_PATH(HUNSPELL_INCLUDE_DIR "hunspell/hunspell.hxx")
+
+
+# handle the QUIETLY and REQUIRED arguments and 
+# set HUNSPELL_FOUND to TRUE if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(HUNSPELL DEFAULT_MSG HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIR)
+
+if(HUNSPELL_FIND_REQUIRED AND NOT HUNSPELL_FOUND)
+       message(FATAL_ERROR "Could not find Hunspell library")
+endif()
+
+mark_as_advanced(HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIR)