Add support for building with CMake.#617
Conversation
There was a problem hiding this comment.
-
src/hunspell/CMakeLists.txt:92
# $<$<CXX_COMPILER_ID:Clang>:-Wl,-no-undefined,error>
This setting does not work on Void Linux (Clang, musl). It's not necessary for this toolchain. -
src/hunspell/CMakeLists.txt:101
VERSION 0.0.${PROJECT_VERSION_PATCH} # ${PROJECT_VERSION}
If I set project version to 1.7.2, the patch version would be 2. We will get "libhunspell-1.7.so.0.0.2". Otherwise from the original version setting we got "libhunspell-1.7.so.1.7.0" -
src/hunspell/CMakeLists.txt:161
VERSION 0.0.${PROJECT_VERSION_PATCH} # ${PROJECT_VERSION}
Same as above.
|
pls. merge also this and 704... |
|
@caolanm: please can you merge this? |
|
as version v1.7.2 was released - can you please add this cmake support, so we can improve it? e.g we can remove https://github.com/hunspell/hunspell/tree/master/msvc afterwords...? |
Tested to work on Windows, Linux and macOS.
The following options
HUNSPELL_BUILD_TOOLSandHUNSPELL_BUILD_STATICare provided to selectively build the hunspell tools (including parsers), as well as the static version of libhunspell, respectively.HUNSPELL_TOOLS_OUTPUT_PREFIXcan be used to add a prefix to the built executables output name, resolving the name conflict issue mentioned in PR #605.The latest Visual Studio generators can be used to generate a multi-config solution on Windows. This renderes the project files already present in source tree under
msvc/as unnecessary.The
po/andtest/directories are not included in the current script, though it can be extended to also processpofiles, as CMake provides modules for handlinggettext.There is an issue when building hunspell on Mac, where ncurses cannot be found even when installed correctly using homebrew. This is because the CMake package
FindCursesused to find ncurses fails to find the required libraries and paths. Everything works OK when paths are set manually during configuration. Also worth noting that the latest readline package in homebrew is not compatible with the current code that uses it, due to missing identifiers:rl_delete_text(),rl_done,rl_set_key(). Haven't tried with previous versions of the readline library.The
hunspell.cxxtool source file was slightly modified to keep the Clang compiler on Apple happy.