Finds the GNU Aspell spell checker library.
This module supports the following components:
ASPELLAdded in version 4.1.
Finds the Aspell library and its include paths.
ExecutableAdded in version 4.1.
Finds the Aspell command-line interactive spell checker executable.
Components can be specified using the standard CMake syntax:
find_package(ASPELL [COMPONENTS <components>...])
If no COMPONENTS are specified, the module searches for both the ASPELL
and Executable components by default.
This module provides the following Imported Targets when
CMAKE_ROLE is PROJECT:
ASPELL::ASPELLAdded in version 4.1.
Target encapsulating the Aspell library usage requirements. It is available
only when the ASPELL component is found.
ASPELL::ExecutableAdded in version 4.1.
Target encapsulating the Aspell command-line spell checker executable. It is
available only when the Executable component is found.
This module defines the following variables:
ASPELL_FOUNDBoolean indicating whether the requested Aspell components have been found.
ASPELL_VERSIONAdded in version 4.1.
Version string of the found Aspell if any. It may be only determined if the
Executable component is found. If version isn't determined, version value
is not set.
ASPELL_INCLUDE_DIRSAdded in version 4.1.
Include directories needed to use Aspell. They are available when the
ASPELL component is found.
The Aspell library may also provide a backward-compatible interface for Pspell
via the pspell.h header file. If such an interface is found, it is also
added to the list of include directories.
ASPELL_LIBRARIESLibraries needed to link to Aspell. They are available when the ASPELL
component is found.
Changed in version 4.1: This variable is now set as a regular result variable instead of being a cache variable.
The following cache variables may also be set:
ASPELL_INCLUDE_DIRThe directory containing the aspell.h header file when using the
Executable component.
ASPELL_LIBRARYAdded in version 4.1.
The path to the Aspell library when using the ASPELL component.
ASPELL_EXECUTABLEThe path to the aspell command-line spell checker program when using the
Executable component.
Finding the Aspell library with CMake 4.1 or later and linking it to a project target:
find_package(ASPELL COMPONENTS ASPELL)
target_link_libraries(project_target PRIVATE ASPELL::ASPELL)
When writing backward-compatible code that supports CMake 4.0 and earlier, a local imported target can be defined directly in the project:
find_package(ASPELL COMPONENTS ASPELL)
if(ASPELL_FOUND AND NOT TARGET ASPELL::ASPELL)
add_library(ASPELL::ASPELL INTERFACE IMPORTED)
set_target_properties(
ASPELL::ASPELL
PROPERTIES
INTERFACE_LINK_LIBRARIES "${ASPELL_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${ASPELL_INCLUDE_DIR}"
)
endif()
target_link_libraries(project_target PRIVATE ASPELL::ASPELL)
Example, how to execute the aspell command-line spell checker in a project:
find_package(ASPELL COMPONENTS Executable)
execute_process(COMMAND ${ASPELL_EXECUTABLE} --help)