mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-06 16:56:40 +08:00
The minimum required cmake version is raised to 3.1, because the exported targets started at that version. The build system creates the exported targets: - The executable uchardet::uchardet - The library uchardet::libuchardet - The static library uchardet::libuchardet_static A downstream project using CMake can find and link the library target directly with cmake (without needing pkg-config) this way: ~~~ project(sample LANGUAGES C) find_package ( uchardet ) if (uchardet_FOUND) add_executable( sample sample.c ) target_link_libraries ( sample PRIVATE uchardet::libuchardet ) endif () ~~~ After installing uchardet in a prefix like "$HOME/uchardet/": cmake -DCMAKE_PREFIX_PATH="$HOME/uchardet/;..." Instead installing, the build directory can be used directly, for instance: cmake -Duchardet_DIR="$HOME/uchardet-0.1.0/build/" ...
20 lines
525 B
CMake
20 lines
525 B
CMake
# This file may optionally do:
|
|
#
|
|
# 1. Check for dependencies of exported targets. Example:
|
|
#
|
|
# include(CMakeFindDependencyMacro)
|
|
# find_dependency(MYDEP REQUIRED)
|
|
#
|
|
# find_dependency() has the same syntax as find_package()
|
|
#
|
|
# 2. Capture values from configuration. Example:
|
|
#
|
|
# set(my-config-var @my-config-var@)
|
|
#
|
|
# 3. Other required setup when importing targets from another project
|
|
#
|
|
# See also:
|
|
# https://cliutils.gitlab.io/modern-cmake/chapters/install.html
|
|
#
|
|
include("${CMAKE_CURRENT_LIST_DIR}/uchardet-targets.cmake")
|