root/sandbox/sigis/christian.gonzalez/trunk/cmake/FindPostgreSQL.cmake

Revision 179, 1.9 KB (checked in by anton, 2 years ago)

PostgreSQL header files path added for cmake

Line 
1# - Find PostgreSQL
2# Find the PostgreSQL includes and client library
3# This module defines
4#  POSTGRESQL_INCLUDE_DIR, where to find POSTGRESQL.h
5#  POSTGRESQL_LIBRARIES, the libraries needed to use POSTGRESQL.
6#  POSTGRESQL_FOUND, If false, do not try to use PostgreSQL.
7#
8# Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
9#
10# Redistribution and use is allowed according to the terms of the BSD license.
11# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12
13# Add the postgresql and mysql include paths here
14
15if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
16   set(POSTGRESQL_FOUND TRUE)
17
18else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
19
20#  find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h
21
22 FIND_PATH(POSTGRESQL_INCLUDE_DIR postgres.h
23      /usr/include/server
24      /usr/include/pgsql/server
25      /usr/local/include/pgsql/server
26      /usr/include/postgresql/server
27      /usr/include/postgresql/*/server
28      /usr/local/include/postgresql/server
29      /usr/local/include/postgresql/*/server
30      $ENV{ProgramFiles}/PostgreSQL/*/include/server
31      $ENV{SystemDrive}/PostgreSQL/*/include/server
32      )
33
34  find_library(POSTGRESQL_LIBRARIES NAMES pq libpq
35     PATHS
36     /usr/lib
37     /usr/local/lib
38     /usr/lib/postgresql
39     /usr/lib64
40     /usr/local/lib64
41     /usr/lib64/postgresql
42     $ENV{ProgramFiles}/PostgreSQL/*/lib/ms
43     $ENV{SystemDrive}/PostgreSQL/*/lib/ms
44     )
45     
46  if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
47    set(POSTGRESQL_FOUND TRUE)
48    message(STATUS "Found PostgreSQL: ${POSTGRESQL_INCLUDE_DIR}, ${POSTGRESQL_LIBRARIES}")
49    INCLUDE_DIRECTORIES(${POSTGRESQL_INCLUDE_DIR})
50  else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
51    set(POSTGRESQL_FOUND FALSE)
52    message(STATUS "PostgreSQL not found.")
53  endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
54
55  mark_as_advanced(POSTGRESQL_INCLUDE_DIR POSTGRESQL_LIBRARIES)
56
57endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
Note: See TracBrowser for help on using the browser.