CMake: Enable wxUSE_SPELLCHECK

Find gspell-1 when using GTK3. Also need to find enchant.h.
This commit is contained in:
Maarten Bent
2021-10-17 13:39:32 +02:00
parent b102afc316
commit d2642b4c07
3 changed files with 54 additions and 0 deletions

View File

@@ -563,6 +563,17 @@ if(wxUSE_GUI)
else()
set(wxUSE_LIBGNOMEVFS OFF)
endif()
if(WXGTK3 AND wxUSE_SPELLCHECK)
find_package(GSPELL)
if(GSPELL_FOUND)
list(APPEND wxTOOLKIT_INCLUDE_DIRS ${GSPELL_INCLUDE_DIRS})
list(APPEND wxTOOLKIT_LIBRARIES ${GSPELL_LIBRARIES})
else()
message(STATUS "gspell-1 not found, spell checking in wxTextCtrl won't be available")
wx_option_force_value(wxUSE_SPELLCHECK OFF)
endif()
endif()
endif()
# test if precompiled headers are supported using the cotire test project

View File

@@ -0,0 +1,42 @@
# - Try to find gspell
# Once done this will define
#
# GSPELL_FOUND - system has gspell
# GSPELL_INCLUDE_DIRS - The include directory to use for the gspell headers
# GSPELL_LIBRARIES - Link these to use gspell
find_package(PkgConfig)
pkg_check_modules(PC_GSPELL QUIET gspell-1)
find_path(GSPELL_INCLUDE_DIRS
NAMES gspell/gspell.h
HINTS ${PC_GSPELL_INCLUDEDIR}
${PC_GSPELL_INCLUDE_DIRS}
)
find_library(GSPELL_LIBRARIES
NAMES gspell-1
HINTS ${PC_GSPELL_LIBDIR}
${PC_GSPELL_LIBRARY_DIRS}
)
pkg_check_modules(PC_ENCHANT QUIET enchant-2 enchant)
find_path(ENCHANT_INCLUDE_DIRS
NAMES enchant.h
HINTS ${PC_ENCHANT_INCLUDEDIR}
${PC_ENCHANT_INCLUDE_DIRS}
PATH_SUFFIXES enchant-2 enchant
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSPELL DEFAULT_MSG GSPELL_INCLUDE_DIRS ENCHANT_INCLUDE_DIRS GSPELL_LIBRARIES)
if(GSPELL_FOUND)
set(GSPELL_INCLUDE_DIRS ${GSPELL_INCLUDE_DIRS} ${ENCHANT_INCLUDE_DIRS})
endif()
mark_as_advanced(
GSPELL_INCLUDE_DIRS
GSPELL_LIBRARIES
ENCHANT_INCLUDE_DIRS
)

View File

@@ -190,6 +190,7 @@ wx_option(wxUSE_PRINTF_POS_PARAMS "use wxVsnprintf() which supports positional p
wx_option(wxUSE_SECRETSTORE "use wxSecretStore class")
wx_option(wxUSE_SNGLINST_CHECKER "use wxSingleInstanceChecker class")
wx_option(wxUSE_SOUND "use wxSound class")
wx_option(wxUSE_SPELLCHECK "enable spellchecking in wxTextCtrl class (MSW and GTK3 only)")
wx_option(wxUSE_STDPATHS "use wxStandardPaths class")
wx_option(wxUSE_STOPWATCH "use wxStopWatch class")
wx_option(wxUSE_STREAMS "use wxStream etc classes")