What is causing the error - Could NOT find HUNSPELL: Found unsuitable version ""

The actual error message is:

Could NOT find HUNSPELL: Found unsuitable version "", but required is at
  least "1.6" (found /usr/local/lib/libhunspell-1.6.dylib)

From the message, it seems that the library is being found, but that:

  1. Cmake isn’t detecting the version properly
  2. hunspell isn’t reporting the version properly

I can’t tell which (I’m not an expert in either cmake or hunspell). Has anyone seen an empty version string “” before, and if so, what was the fix?

FindHUNSPELL doesn’t seem to come with CMake. Where is the module from?

hunspell is a spell checking library that is being used in the project.

I know what hunspell is, but this error is coming from some file that is not provided by CMake itself. What file is providing the code which is looking for hunspell?

If I understand what you’re asking. I’m compiling FeatherPad (GitHub - tsujan/FeatherPad: Lightweight Qt Plain-Text Editor for Linux)

It has a file FindHUNSPELL.cmake containing:

find_package(PkgConfig)
pkg_check_modules(PKG_HUNSPELL QUIET hunspell)
find_path(HUNSPELL_INCLUDE_DIRS
          NAMES hunspell.hxx
          PATH_SUFFIXES hunspell
          HINTS ${PKG_HUNSPELL_INCLUDE_DIRS})
find_library(HUNSPELL_LIBRARIES
             NAMES ${PKG_HUNSPELL_LIBRARIES} hunspell hunspell-1.8 hunspell-1.7 hunspell-1.6 libhunspell
             HINTS ${PKG_HUNSPELL_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HUNSPELL
                                  REQUIRED_VARS HUNSPELL_LIBRARIES HUNSPELL_INCLUDE_DIRS
                                  VERSION_VAR PKG_HUNSPELL_VERSION)
mark_as_advanced(HUNSPELL_INCLUDE_DIRS HUNSPELL_LIBRARIES)

Hmm. It seems that PKG_HUNSPELL_VERSION is not being extracted properly somehow? Could you provide the output of cmake --trace-expand related to that pkg_check_modules() call? Something isn’t working there it seems.

Trying this again - here’s a link:

Sorry, I wasn’t clear. The flag needs to be added to whatever else you give when configuring, probably just the binary directory.

Hi Ben, I’m not sure what you’re asking. To build this project, generally, I just open CMakeLists.txt in QT Creator and build the project in QT Creator. The gist shows the trace and error in more detail that what QT Creator shows.

It looks like FindPkgConfig is not getting the version from the hunspell package properly. What does the .pc file for it look like?