~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to addons/filetemplates/templates/FindXXX.cmake.katetemplate

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
11
#%{cursor}
 
12
 
 
13
#
 
14
# Copyright (C) %{year}, %{fullname} <%{email}>
 
15
#
 
16
# Distributed under the OSI-approved BSD License (the "License");
 
17
# see accompanying file LICENSE for details.
 
18
#
 
19
 
 
20
# Check if already in cache
 
21
# NOTE Feel free to check/change/add any other vars
 
22
if(NOT %{package}_LIBRARIES)
 
23
 
 
24
    if(%{package}_FIND_QUIETLY)
 
25
        set(_pkg_find_quietly QUIET)
 
26
    endif()
 
27
 
 
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}")
 
32
        else()
 
33
            set(_pkg_module_name "\${_pkg_module_name}>=\${%{package}_FIND_VERSION}")
 
34
        endif()
 
35
    endif()
 
36
 
 
37
    find_package(PkgConfig \${_pkg_find_quietly})
 
38
    pkg_check_modules(%{package} \${_pkg_module_name} \${_pkg_find_quietly})
 
39
 
 
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
 
46
      )
 
47
 
 
48
    if(%{package}_FOUND)
 
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)
 
54
    endif()
 
55
endif()
 
56