lyx_mirror/development/cmake/modules/FindENCHANT.cmake
Scott Kostyshak f1694db496 CMake build: find enchant 2.x binary and lib
For example, see the Fedora file lists for the package
enchant2-devel [1] as well as the Debian Sid file lists for the
packages libenchant-2-dev [2] and enchant-2 [3]. The packages for
Ubuntu 20.04 are similar. Our autotools build has had support for
finding enchant 2.x since 71977769.

Searching for enchant-2 first is consistent with what we do for
autotools (see 1ae537c5).

This commit is related to #10986.

[1] https://www.lyx.org/trac/ticket/10986#comment:28
[2] https://packages.debian.org/sid/amd64/libenchant-2-dev/filelist
[3] https://packages.debian.org/sid/amd64/enchant-2/filelist
2020-03-13 10:07:05 -04:00

26 lines
785 B
CMake

if(WIN32)
find_library(ENCHANT_LIBRARY "libenchant")
find_path(ENCHANT_INCLUDE_DIR "enchant++.h")
else()
find_library(ENCHANT_LIBRARY NAMES "enchant-2" "enchant"
"/usr/local/lib"
${SYSTEM_LIB_DIRS}
"/opt/local/lib")
find_path(ENCHANT_INCLUDE_DIR "enchant++.h" PATHS
/usr/local/include/enchant-2
/usr/include/enchant-2
/opt/local/include/enchant-2
/usr/local/include
/usr/local/include/enchant
/usr/include
/usr/include/enchant
/opt/local/include/enchant)
endif()
# handle the QUIETLY and REQUIRED arguments and
# set ENCHANT_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)
mark_as_advanced(ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)