]> git.lyx.org Git - features.git/commitdiff
Cmake build: Use find_package_handle_standard_args() consistently
authorKornel Benko <kornel@lyx.org>
Tue, 13 May 2014 10:30:20 +0000 (12:30 +0200)
committerKornel Benko <kornel@lyx.org>
Tue, 13 May 2014 10:30:20 +0000 (12:30 +0200)
development/cmake/modules/FindASPELL.cmake
development/cmake/modules/FindEnchant.cmake
development/cmake/modules/FindHunspell.cmake

index 6054d6adfe2ab6939c6743481b9f579b07ba2f23..0900b4c3679ea7720b0de85e4b303fb6f282fde7 100644 (file)
@@ -81,27 +81,23 @@ else()
        set(ASPELL_LIBRARY ${ASPELL_LIBRARY_RELEASE} CACHE STRING "Aspell library" FORCE)
 endif()
 
-if(ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY)
-        set(ASPELL_FOUND TRUE)
-endif()
+# handle the QUIETLY and REQUIRED arguments and DEFAULT_MSG
+# set ASPELL_FOUND to TRUE if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ASPELL DEFAULT_MSG ASPELL_LIBRARY ASPELL_INCLUDE_DIR)
 
-if(ASPELL_FOUND)
-       if (NOT ASPELL_FIND_QUIETLY)
-       message(STATUS "Found ASPELL: ${ASPELL_LIBRARY}")
-       endif()
-else()
-       if (ASPELL_FIND_REQUIRED)
-       message("aspell header      : ${ASPELL_INCLUDE_DIR}")
-       message("aspell lib release : ${ASPELL_LIBRARY_RELEASE}")
-       message("aspell lib debug   : ${ASPELL_LIBRARY_DEBUG}") 
-       if(MSVC_IDE)
-               # the ide needs the debug and release version
-               if(NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE)
-                        message(FATAL_ERROR "\nCould NOT find the debug AND release version of the aspell library.\nYou need to have both to use MSVC projects.\nPlease build and install both kdelibs/win/ libraries first.\n")
-               endif()
-       endif()
-       message(FATAL_ERROR "Could NOT find ASPELL")
-       endif()
+if(NOT ASPELL_FOUND)
+  if (ASPELL_FIND_REQUIRED)
+    message("aspell header      : ${ASPELL_INCLUDE_DIR}")
+    message("aspell lib release : ${ASPELL_LIBRARY_RELEASE}")
+    message("aspell lib debug   : ${ASPELL_LIBRARY_DEBUG}")
+    if(MSVC_IDE)
+      # the ide needs  the debug and release version
+      if(NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE)
+       message(FATAL_ERROR "\nCould NOT find the debug AND release version of the aspell library.\nYou need to have both to use MSVC projects.\nPlease build and install both kdelibs/win/ libraries first.\n")
+      endif()
+    endif()
+  endif()
 endif()
 
 MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARY ASPELL_LIBRARY_RELEASE ASPELL_LIBRARY_DEBUG)
index d4164b6ffcff23f8441894e074f9e4f4f577e61a..d7548a84fc68bb5728c12dd2df0758f38cc8e4cd 100644 (file)
@@ -14,21 +14,9 @@ else()
                /opt/local/include/enchant)
 endif()
 
-if (ENCHANT_LIBRARY AND ENCHANT_INCLUDE_DIR)
-       set(ENCHANT_FOUND TRUE)
-       message(STATUS "Building with USE_ENCHANT")
-else()
-       message(STATUS "Enchant not found, building without enchant support")
-endif()
-
-
-# handle the QUIETLY and REQUIRED arguments and 
+# 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)
 
-if(Enchant_FIND_REQUIRED AND NOT ENCHANT_FOUND)
-       message(FATAL_ERROR "Could not find Enchant library")
-endif()
-
 mark_as_advanced(ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)
index 36a7c68a5744144cc2a1c0150c728d6d03ddd3ea..ae63f49f780c16a827c99c1957f38c9e018ff7b7 100644 (file)
@@ -7,14 +7,9 @@ endif()
 
 FIND_PATH(HUNSPELL_INCLUDE_DIR "hunspell/hunspell.hxx")
 
-
-# handle the QUIETLY and REQUIRED arguments and 
+# 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)