Am Sonntag, 11. Mai 2014 um 18:15:22, schrieb Kornel Benko <kor...@lyx.org>
> Am Sonntag, 11. Mai 2014 um 18:11:44, schrieb Stephan Witt <st.w...@gmx.net>
> > Am 11.05.2014 um 12:38 schrieb Kornel Benko <kor...@lyx.org>:
> > 
> > > Am Sonntag, 11. Mai 2014 um 11:55:38, schrieb Abdelrazak Younes 
> > > <you...@lyx.org>
> > >> On Sun, May 11, 2014 at 11:23 AM, Scott Kostyshak <skost...@lyx.org> 
> > >> wrote:
> > >> 
> > >>> On Sun, May 11, 2014 at 5:16 AM, Abdelrazak Younes <you...@lyx.org> 
> > >>> wrote:
> > >>>> On Sun, May 11, 2014 at 11:09 AM, Kornel Benko <kor...@lyx.org> wrote:
> > >>>>> 
> > >>>>>> Hunspell is installed on my system, why don't we pick that
> > >>>>>> automatically?
> > >>>>> 
> > >>>>> Good question. But which one to select, if also the other are 
> > >>>>> installed?
> > >>>>> There may be a reason why someone does not want a specific lib.
> > >>>> 
> > >>>> 
> > >>>> I would say by order of preference check hunspell, then enchant, then
> > >>>> aspell.
> > >>> 
> > >>> Regardless of the order (e.g. even if Enchant is prioritized), it
> > >>> would be nice to fill in the path in Preferences > Paths so that if
> > >>> the user wants to use Hunspell all he has to do is change the
> > >>> spellchecker.
> > >>> 
> > >> 
> > >> Indeed, AFAIR we can compile concurrent support for all 3 spellers so if
> > >> the development packages are found we should use them.
> > > 
> > > If that is the consent, OK. But what to do, if no spellchecker is found?
> > > * Abort
> > > * Drop a message only
> > > * Silently ignore
> > 
> > Is it possible to abort if no command line switch is given to disable them?
> 
> Sure. Like this
>       message(FATAL_ERROR "You are leaving the moon atmosphere")
> 
> > Many users are asking for spell checker support but don't install any 
> > developer
> > package for spell checking and are baffled later about getting no spell 
> > checker.
> > It would be good to abort then with a helpful error message, IMHO.
> > 
> > Stephan
> 

What about the attached?

        Kornel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe133eb..d68fa2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -540,19 +540,22 @@ endif()
 
 include_directories(${TOP_BINARY_DIR} ${TOP_SRC_DIR}/src)
 
-if(LYX_ASPELL)
-	find_package(ASPELL REQUIRED)
-	include_directories(${ASPELL_INCLUDE_DIR})
-endif()
-
-if(LYX_ENCHANT)
-	find_package(Enchant REQUIRED)
-	include_directories(${ENCHANT_INCLUDE_DIR})
-endif()
+set(Spelling_FOUND OFF)
+foreach(_spell "ASPELL" "Enchant" "Hunspell")
+  string(TOUPPER ${_spell} _upspell)
+  find_package(${_spell})
+  if (${_upspell}_FOUND)
+    include_directories(${${_upspell}_INCLUDE_DIR})
+    set(Spelling_FOUND ON)
+  else()
+    if(LYX_${_upspell})
+      message(FATAL_ERROR "Required ${_spell} devel package not found")
+    endif()
+  endif()
+endforeach()
 
-if(LYX_HUNSPELL)
-	find_package(Hunspell REQUIRED)
-	include_directories(${HUNSPELL_INCLUDE_DIR})
+if(NOT Spelling_FOUND)
+  message(STATUS "No spellcheck libraries found. Lyx will be unable use spellchecking")
 endif()
 
 if(LYX_NLS)

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to