FindASPELL¶
Finds the GNU Aspell spell checker library.
Components¶
This module supports the following components:
ASPELL
在 4.1 版被加入.
Finds the Aspell library and its include paths.
Executable
在 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.
Imported Targets¶
This module provides the following Imported Targets when
CMAKE_ROLE
is PROJECT
:
ASPELL::ASPELL
在 4.1 版被加入.
Target encapsulating the Aspell library usage requirements. It is available only when the
ASPELL
component is found.ASPELL::Executable
在 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_FOUND
Boolean indicating whether the requested Aspell components have been found.
ASPELL_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_DIRS
在 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_LIBRARIES
Libraries needed to link to Aspell. They are available when the
ASPELL
component is found.在 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_DIR
The directory containing the
aspell.h
header file when using theExecutable
component.ASPELL_LIBRARY
在 4.1 版被加入.
The path to the Aspell library when using the
ASPELL
component.ASPELL_EXECUTABLE
The path to the
aspell
command-line spell checker program when using theExecutable
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)