Commit e9291387 authored by Adriaan de Groot's avatar Adriaan de Groot 💬
Browse files

CMake: handle hunspell-has-no-dictionaries

If there are **no** dictionaries for hunspell, then
the AVAILABLE DICTIONARIES line is followed by no
output (no lines listing dictionaries). Then
the match fails, so CMAKE_MATCH_1 is empty,
and substituting it in the REGEX REPLACE command
triggers a CMake error like this:

CMake Error at cmake/modules/FindHunspell.cmake:54 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

Quote it, so that at least the empty string is passed
in when no dictionaries are available.
parent c6e78aec
......@@ -50,8 +50,9 @@ if (Hunspell_FOUND)
execute_process(COMMAND ${Hunspell_EXECUTABLE} "-D" OUTPUT_VARIABLE Hunspell_OUTPUT ERROR_VARIABLE Hunspell_OUTPUT)
#Remove useless output
string(REGEX MATCH "AVAILABLE DICTIONARIES [^\n]*\n(.*)" Hunspell_DICTIONARIES ${Hunspell_OUTPUT})
#Convert string into list
string(REGEX REPLACE "\n" ";" Hunspell_DICTIONARIES ${CMAKE_MATCH_1})
#Convert string into list - CMAKE_MATCH_1 comes from the REGEX MATCH,
#although the value has **also** been stored as Hunspell_DICTIONARIES
string(REGEX REPLACE "\n" ";" Hunspell_DICTIONARIES "${CMAKE_MATCH_1}")
set(Hunspell_UNIQUE_DICTIONARIES "")
set(Hunspell_unique_dict_names "")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment