1
katetemplate: Template=FindXXX.cmake Group=Other Highlight=CMake
2
katetemplate: Author=Alex Turbov <i.zaufi@gmail.com>
3
katetemplate: Description=CMake finder skeleton wrapper based on pkg-config
4
# - Find ${package_description} using `pkg-config`
5
# Search for %{package_description} and set the following variables:
6
# %{package}_FOUND - is package found
7
# %{package}_VERSION - found package version
8
# %{package}_INCLUDE_DIRS - dir w/ header files
9
# %{package}_DEFINITIONS - other than `-I' compiler flags
10
# %{package}_LIBRARIES - libs for dynamic linkage
14
# Copyright (C) %{year}, %{fullname} <%{email}>
16
# Distributed under the OSI-approved BSD License (the "License");
17
# see accompanying file LICENSE for details.
20
# Check if already in cache
21
# NOTE Feel free to check/change/add any other vars
22
if(NOT %{package}_LIBRARIES)
24
if(%{package}_FIND_QUIETLY)
25
set(_pkg_find_quietly QUIET)
28
set(_pkg_module_name "${pkg_config_module_name}")
29
if(${package}_FIND_VERSION)
30
if(%{package}_FIND_VERSION_EXACT)
31
set(_pkg_module_name "\${_pkg_module_name}=\${%{package}_FIND_VERSION}")
33
set(_pkg_module_name "\${_pkg_module_name}>=\${%{package}_FIND_VERSION}")
37
find_package(PkgConfig \${_pkg_find_quietly})
38
pkg_check_modules(%{package} \${_pkg_module_name} \${_pkg_find_quietly})
40
include(FindPackageHandleStandardArgs)
41
find_package_handle_standard_args(
42
%{package_finder_name}
43
FOUND_VAR %{package}_FOUND
44
REQUIRED_VARS %{package}_LIBRARIES
45
VERSION_VAR %{package}_VERSION
49
# Copy other than `-I' flags to `XXX_DEFINITIONS' variable,
50
# according CMake guide (/usr/share/cmake/Modules/readme.txt)
51
set(%{package}_DEFINITIONS \${%{package}_CFLAGS_OTHER})
52
# Unset non-standard variable
53
unset(%{package}_CFLAGS_OTHER)