summaryrefslogtreecommitdiffstats
path: root/Modules/FindPostgreSQL.cmake
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2018-10-31 18:36:27 (GMT)
committerBrad King <brad.king@kitware.com>2018-11-01 17:23:33 (GMT)
commitd2235fd2538eca934f542ff82f21249c3ff314be (patch)
treefa10e7458790d6ce14959140ea04dd8b5f0bd263 /Modules/FindPostgreSQL.cmake
parent7a801b7dfb38c2f9f77fbda0f45ed88b70ca4b87 (diff)
downloadCMake-d2235fd2538eca934f542ff82f21249c3ff314be.zip
CMake-d2235fd2538eca934f542ff82f21249c3ff314be.tar.gz
CMake-d2235fd2538eca934f542ff82f21249c3ff314be.tar.bz2
FindPostgreSQL: add an imported target
Diffstat (limited to 'Modules/FindPostgreSQL.cmake')
-rw-r--r--Modules/FindPostgreSQL.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index d59ba50..6832bbe 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -7,6 +7,12 @@ FindPostgreSQL
Find the PostgreSQL installation.
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``PostgreSQL::PostgreSQL``
+if PostgreSQL has been found.
+
Result Variables
^^^^^^^^^^^^^^^^
@@ -56,6 +62,8 @@ This module will set the following variables in your project:
# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries
# PostgreSQL_LIBRARIES - The PostgreSQL libraries.
#
+# The ``PostgreSQL::PostgreSQL`` imported target is also created.
+#
# ----------------------------------------------------------------------------
# If you have installed PostgreSQL in a non-standard location.
# (Please note that in the following comments, it is assumed that <Your Path>
@@ -187,6 +195,12 @@ set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
# Now try to get the include and library path.
if(PostgreSQL_FOUND)
+ if (NOT TARGET PostgreSQL::PostgreSQL)
+ add_library(PostgreSQL::PostgreSQL UNKNOWN IMPORTED)
+ set_target_properties(PostgreSQL::PostgreSQL PROPERTIES
+ IMPORTED_LOCATION "${PostgreSQL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PostgreSQL_INCLUDE_DIR};${PostgreSQL_TYPE_INCLUDE_DIR}")
+ endif ()
set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} )
set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY})