-
Notifications
You must be signed in to change notification settings - Fork 0
/
POSTGRESConfig.cmake
62 lines (55 loc) · 2.1 KB
/
POSTGRESConfig.cmake
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
# Find POSTGRESQL library and header file
# Sets
# POSTGRES_FOUND to 0 or 1 depending on the result
# POSTGRES_INCLUDE_DIRECTORIES to directories required for using libpq
# POSTGRES_LIBRARIES to libpq and any dependent libraries
# If POSTGRES_REQUIRED is defined, then a fatal error message will be generated if libpq is not found
if ( NOT POSTGRES_INCLUDE_DIRECTORIES OR NOT POSTGRES_LIBRARIES OR NOT POSTGRES_FOUND )
if ( $ENV{POSTGRES_DIR} )
file( TO_CMAKE_PATH "$ENV{POSTGRES_DIR}" _POSTGRES_DIR )
endif ( $ENV{POSTGRES_DIR} )
find_library( POSTGRES_LIBRARIES
NAMES pq libpq
PATHS
${_POSTGRES_DIR}/lib/${CMAKE_LIBRARY_ARCHITECTURE}
${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/local/pgsql/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
${_POSTGRES_DIR}/lib64
${CMAKE_INSTALL_PREFIX}/lib64
/usr/local/pgsql/lib64
/usr/local/lib64
/usr/lib64
${_POSTGRES_DIR}
${_POSTGRES_DIR}/lib
${CMAKE_INSTALL_PREFIX}/bin
${CMAKE_INSTALL_PREFIX}/lib
/usr/local/pgsql/lib
/usr/local/lib
/usr/lib
NO_DEFAULT_PATH
)
find_path( POSTGRES_INCLUDE_DIRECTORIES
NAMES libpq-fe.h
PATHS
${_POSTGRES_DIR}
${_POSTGRES_DIR}/include
${CMAKE_INSTALL_PREFIX}/include
/usr/local/pgsql/include
/usr/local/include
/usr/include
/usr/include/postgresql
NO_DEFAULT_PATH
)
if ( NOT POSTGRES_INCLUDE_DIRECTORIES OR NOT POSTGRES_LIBRARIES )
if ( POSTGRES_REQUIRED )
message( FATAL_ERROR "POSTGRES is required. Set POSTGRES_DIR" )
endif ( POSTGRES_REQUIRED )
else ( NOT POSTGRES_INCLUDE_DIRECTORIES OR NOT POSTGRES_LIBRARIES )
set( POSTGRES_FOUND 1 )
mark_as_advanced( POSTGRES_FOUND )
endif ( NOT POSTGRES_INCLUDE_DIRECTORIES OR NOT POSTGRES_LIBRARIES )
endif ( NOT POSTGRES_INCLUDE_DIRECTORIES OR NOT POSTGRES_LIBRARIES OR NOT POSTGRES_FOUND )
mark_as_advanced( FORCE POSTGRES_INCLUDE_DIRECTORIES )
mark_as_advanced( FORCE POSTGRES_LIBRARIES )