File: FindPQXX.cmake

package info (click to toggle)
sqlsmith 1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 540 kB
  • sloc: cpp: 3,221; sql: 175; makefile: 33; sh: 1
file content (78 lines) | stat: -rw-r--r-- 1,884 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Distributed under the GPL-3.0 as part of SQLSmith.
#[=======================================================================[.rst:
FindPQXX
-------

Finds the libpqxx library.

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

``PQXX::PQXX``
  The libpqxx library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

``PQXX_FOUND``
  True if the system has the libpqxx library.
``PQXX_VERSION``
  The version of the libpqxx library which was found.
``PQXX_INCLUDE_DIRS``
  Include directories needed to use libpqxx.
``PQXX_LIBRARIES``
  Libraries needed to link to libpqxx.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

``PQXX_INCLUDE_DIR``
  The directory containing ``foo.h``.
``PQXX_LIBRARY``
  The path to the Foo library.

#]=======================================================================]

find_package(PkgConfig)
pkg_check_modules(PC_PQXX QUIET libpqxx)

find_path(PQXX_INCLUDE_DIR
        NAMES pqxx
        PATHS ${PC_PQXX_INCLUDE_DIRS}
        )

find_library(PQXX_LIBRARY
        NAMES pqxx
        PATHS ${PC_PQXX_LIBRARY_DIRS}
        )

set(PQXX_VERSION ${PC_PQXX_VERSION})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PQXX
        FOUND_VAR PQXX_FOUND
        REQUIRED_VARS
            PQXX_LIBRARY
            PQXX_INCLUDE_DIR
        VERSION_VAR PQXX_VERSION
        )

if (PQXX_FOUND)
    set(PQXX_LIBRARIES ${PQXX_LIBRARY})
    set(PQXX_INCLUDE_DIRS ${PQXX_INCLUDE_DIR})
    set(PQXX_DEFINITIONS ${PC_PQXX_CFLAGS_OTHER})

    add_library(PQXX::PQXX UNKNOWN IMPORTED)
    set_target_properties(PQXX::PQXX PROPERTIES
            IMPORTED_LOCATION "${PQXX_LIBRARY}"
            INTERFACE_COMPILE_OPTIONS "${PC_PQXX_CFLAGS_OTHER}"
            INTERFACE_INCLUDE_DIRECTORIES "${PQXX_INCLUDE_DIR}"
            )
endif ()