[Cmake-commits] CMake branch, next, updated. v2.8.7-2287-gaacd52a

Rolf Eike Beer eike at sf-mail.de
Thu Jan 26 16:02:24 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  aacd52a16bbc97b18adcf5fb137b3acf60491af2 (commit)
       via  8e8db31f3395a2295668ab4cc39089e82b5421ef (commit)
      from  5bae348c4b4e8df0ac39746e8559d4db6e2d8b18 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aacd52a16bbc97b18adcf5fb137b3acf60491af2
commit aacd52a16bbc97b18adcf5fb137b3acf60491af2
Merge: 5bae348 8e8db31
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Thu Jan 26 16:02:15 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jan 26 16:02:15 2012 -0500

    Merge topic 'improve-findpostgresql' into next
    
    8e8db31 FindPostgreSQL: support version selection


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e8db31f3395a2295668ab4cc39089e82b5421ef
commit 8e8db31f3395a2295668ab4cc39089e82b5421ef
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Thu Jan 26 19:35:47 2012 +0100
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Thu Jan 26 21:58:34 2012 +0100

    FindPostgreSQL: support version selection

diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 55f95c6..94e5676 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -1,20 +1,11 @@
 # - Find the PostgreSQL installation.
-# Usage:
-# In your CMakeLists.txt file do something like this:
-# ...
-# # PostgreSQL
-# FIND_PACKAGE(PostgreSQL)
-# ...
-# if( PostgreSQL_FOUND )
-#   include_directories(${PostgreSQL_INCLUDE_DIRS})
-# endif( PostgreSQL_FOUND )
-# ...
-# Remember to include ${PostgreSQL_LIBRARIES} in the target_link_libraries() statement.
-#
-#
 # In Windows, we make the assumption that, if the PostgreSQL files are installed, the default directory
 # will be C:\Program Files\PostgreSQL.
 #
+# This module defines
+#  PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking
+#  PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers
+#  PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8)
 
 #=============================================================================
 # Copyright 2004-2009 Kitware, Inc.
@@ -150,11 +141,20 @@ find_library( PostgreSQL_LIBRARY
 )
 get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
 
+if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h")
+  file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str
+       REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+
+  string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+         PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+  unset(pgsql_version_str)
+endif()
+
 # Did we find anything?
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(PostgreSQL DEFAULT_MSG
-                                  PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR)
-
+find_package_handle_standard_args(PostgreSQL
+                                  REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR
+                                  VERSION_VAR PostgreSQL_VERSION_STRING)
 set( PostgreSQL_FOUND  ${POSTGRESQL_FOUND})
 
 # Now try to get the include and library path.

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindPostgreSQL.cmake |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list