FindASPELL¶
Finds the GNU Aspell spell checker library:
find_package(ASPELL [<version>] [COMPONENTS <components>] [...])
Components¶
This module supports optional components which can be specified using the
find_package() command:
find_package(ASPELL [COMPONENTS <components>...])
Supported components include:
ASPELL在 4.1 版被加入.
Finds the Aspell library and its include paths.
Executable在 4.1 版被加入.
Finds the Aspell command-line interactive spell checker executable.
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
ASPELLcomponent is found.ASPELL::Executable在 4.1 版被加入.
Target encapsulating the Aspell command-line spell checker executable. It is available only when the
Executablecomponent is found.
結果變數¶
該模組定義了以下變數:
ASPELL_FOUNDBoolean indicating whether (the requested version of) Aspell and all requested components were found.
ASPELL_VERSION在 4.1 版被加入.
Version string of the found Aspell if any. It may be only determined if the
Executablecomponent 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
ASPELLcomponent is found.The Aspell library may also provide a backward-compatible interface for Pspell via the
pspell.hheader 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
ASPELLcomponent 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_DIRThe directory containing the
aspell.hheader file when using theExecutablecomponent.ASPELL_LIBRARY在 4.1 版被加入.
The path to the Aspell library when using the
ASPELLcomponent.ASPELL_EXECUTABLEThe path to the
aspellcommand-line spell checker program when using theExecutablecomponent.
範例¶
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)