[LyX/master] Cmake build: Remove cmake warnings about mismatched values of FindPackageHandleStandardArgs()

Kornel Benko kornel at lyx.org
Mon Jan 27 09:31:23 UTC 2020


commit 9fdc00fe2a2b2db752ca244eac3d14e708d5caba
Author: Kornel Benko <kornel at lyx.org>
Date:   Mon Jan 27 10:44:14 2020 +0100

    Cmake build: Remove cmake warnings about mismatched values of FindPackageHandleStandardArgs()
---
 CMakeLists.txt                               |    2 +-
 development/cmake/modules/FindENCHANT.cmake  |   22 ++++++++++++++++++++++
 development/cmake/modules/FindHUNSPELL.cmake |   21 +++++++++++++++++++++
 3 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6976776..a1a8cac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -782,7 +782,7 @@ if(NOT LYX_EXTERNAL_HUNSPELL)
     message(STATUS "     - library: ${HUNSPELL_LIBRARY}")
 endif()
 
-foreach(_spell "ASPELL" "Enchant" "Hunspell")
+foreach(_spell "ASPELL" "ENCHANT" "HUNSPELL")
   string(TOUPPER ${_spell} _upspell)
   if (NOT ${_upspell}_FOUND)
     find_package(${_spell})
diff --git a/development/cmake/modules/FindENCHANT.cmake b/development/cmake/modules/FindENCHANT.cmake
new file mode 100644
index 0000000..d7548a8
--- /dev/null
+++ b/development/cmake/modules/FindENCHANT.cmake
@@ -0,0 +1,22 @@
+if(WIN32)
+	find_library(ENCHANT_LIBRARY "libenchant")
+	find_path(ENCHANT_INCLUDE_DIR "enchant++.h")
+else()
+  find_library(ENCHANT_LIBRARY "enchant"  
+	"/usr/local/lib" 
+	${SYSTEM_LIB_DIRS}
+	"/opt/local/lib")
+  find_path(ENCHANT_INCLUDE_DIR "enchant++.h" PATHS 
+		/usr/local/include
+		/usr/local/include/enchant
+		/usr/include
+		/usr/include/enchant
+		/opt/local/include/enchant)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and
+# set ENCHANT_FOUND to TRUE if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)
+
+mark_as_advanced(ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)
diff --git a/development/cmake/modules/FindHUNSPELL.cmake b/development/cmake/modules/FindHUNSPELL.cmake
new file mode 100644
index 0000000..ad08ad6
--- /dev/null
+++ b/development/cmake/modules/FindHUNSPELL.cmake
@@ -0,0 +1,21 @@
+
+if(WIN32)
+  find_library(HUNSPELL_LIBRARY "libhunspell")
+else()
+  find_library(HUNSPELL_LIBRARY NAMES "hunspell" "hunspell-1.2" PATHS "/usr/local/lib" ${SYSTEM_LIB_DIRS} "/usr/lib64")
+endif()
+
+FIND_PATH(HUNSPELL_INCLUDE_DIR "hunspell.hxx")
+if (NOT HUNSPELL_INCLUDE_DIR)
+  FIND_PATH(HUNSPELL_INCLUDE_DIR "hunspell/hunspell.hxx")
+  if (HUNSPELL_INCLUDE_DIR)
+    set(HUNSPELL_INCLUDE_DIR "${HUNSPELL_INCLUDE_DIR}/hunspell")
+  endif()
+endif()
+
+# 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)
+
+mark_as_advanced(HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIR)


More information about the lyx-cvs mailing list