Skip to content

Commit

Permalink
Specified several PATHS for find_program to help to find pg_config.
Browse files Browse the repository at this point in the history
  • Loading branch information
mloskot committed Nov 10, 2011
1 parent 76f0404 commit 64358c8
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/cmake/modules/FindPostgreSQL.cmake
Expand Up @@ -12,24 +12,30 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

find_program(PG_CONFIG NAMES pg_config DOC "Path to pg_config utility")
find_program(PG_CONFIG NAMES pg_config
PATHS
/usr/bin
/usr/local/bin
$ENV{ProgramFiles}/PostgreSQL/*/bin
$ENV{SystemDrive}/PostgreSQL/*/bin
DOC "Path to pg_config utility")

if(PG_CONFIG)
exec_program(${PG_CONFIG}
ARGS "--version"
OUTPUT_VARIABLE PG_CONFIG_VERSION)
exec_program(${PG_CONFIG}
ARGS "--version"
OUTPUT_VARIABLE PG_CONFIG_VERSION)

if(${PG_CONFIG_VERSION} MATCHES "^[A-Za-z]+[ ](.*)$")
string(REGEX REPLACE "^[A-Za-z]+[ ](.*)$" "\\1" POSTGRESQL_VERSION "${PG_CONFIG_VERSION}")
endif()
if(${PG_CONFIG_VERSION} MATCHES "^[A-Za-z]+[ ](.*)$")
string(REGEX REPLACE "^[A-Za-z]+[ ](.*)$" "\\1" POSTGRESQL_VERSION "${PG_CONFIG_VERSION}")
endif()

exec_program(${PG_CONFIG}
ARGS "--includedir"
OUTPUT_VARIABLE PG_CONFIG_INCLUDEDIR)
exec_program(${PG_CONFIG}
ARGS "--includedir"
OUTPUT_VARIABLE PG_CONFIG_INCLUDEDIR)

exec_program(${PG_CONFIG}
ARGS "--libdir"
OUTPUT_VARIABLE PG_CONFIG_LIBDIR)
exec_program(${PG_CONFIG}
ARGS "--libdir"
OUTPUT_VARIABLE PG_CONFIG_LIBDIR)
else()
set(POSTGRESQL_VERSION "unknown")
endif()
Expand Down

0 comments on commit 64358c8

Please sign in to comment.