Skip to content

Commit

Permalink
Enable support CMake variable PostgreSQL_ROOT in find_package(Postgre…
Browse files Browse the repository at this point in the history
…SQL) (#309)
  • Loading branch information
tt4g authored May 2, 2020
1 parent fbf579f commit 5ee153e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ include(CheckCXXSourceCompiles)
include(CMakeFindDependencyMacro)

if(NOT PostgreSQL_FOUND)
if(POLICY CMP0074)
cmake_policy(PUSH)
# CMP0074 is `OLD` by `cmake_minimum_required(VERSION 3.7)`,
# sets `NEW` to enable support CMake variable `PostgreSQL_ROOT`.
cmake_policy(SET CMP0074 NEW)
endif()

find_package(PostgreSQL REQUIRED)

if(POLICY CMP0074)
cmake_policy(POP)
endif()
endif()

check_function_exists("poll" PQXX_HAVE_POLL)
Expand Down
11 changes: 11 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
# Generated from template './src/CMakeLists.txt.template'.
################################################################################
if(NOT PostgreSQL_FOUND)
if(POLICY CMP0074)
cmake_policy(PUSH)
# CMP0074 is `OLD` by `cmake_minimum_required(VERSION 3.7)`,
# sets `NEW` to enable support CMake variable `PostgreSQL_ROOT`.
cmake_policy(SET CMP0074 NEW)
endif()

find_package(PostgreSQL REQUIRED)

if(POLICY CMP0074)
cmake_policy(POP)
endif()
endif()

# When setting up the include paths, mention the binary tree's include
Expand Down
11 changes: 11 additions & 0 deletions src/CMakeLists.txt.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
if(NOT PostgreSQL_FOUND)
if(POLICY CMP0074)
cmake_policy(PUSH)
# CMP0074 is `OLD` by `cmake_minimum_required(VERSION 3.7)`,
# sets `NEW` to enable support CMake variable `PostgreSQL_ROOT`.
cmake_policy(SET CMP0074 NEW)
endif()

find_package(PostgreSQL REQUIRED)

if(POLICY CMP0074)
cmake_policy(POP)
endif()
endif()

# When setting up the include paths, mention the binary tree's include
Expand Down
11 changes: 11 additions & 0 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
# Generated from template './test/unit/CMakeLists.txt.template'.
# ##############################################################################
if(NOT PostgreSQL_FOUND)
if(POLICY CMP0074)
cmake_policy(PUSH)
# CMP0074 is `OLD` by `cmake_minimum_required(VERSION 3.7)`,
# sets `NEW` to enable support CMake variable `PostgreSQL_ROOT`.
cmake_policy(SET CMP0074 NEW)
endif()

find_package(PostgreSQL REQUIRED)

if(POLICY CMP0074)
cmake_policy(POP)
endif()
endif()

file(
Expand Down
11 changes: 11 additions & 0 deletions test/unit/CMakeLists.txt.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
if(NOT PostgreSQL_FOUND)
if(POLICY CMP0074)
cmake_policy(PUSH)
# CMP0074 is `OLD` by `cmake_minimum_required(VERSION 3.7)`,
# sets `NEW` to enable support CMake variable `PostgreSQL_ROOT`.
cmake_policy(SET CMP0074 NEW)
endif()

find_package(PostgreSQL REQUIRED)

if(POLICY CMP0074)
cmake_policy(POP)
endif()
endif()

file(
Expand Down

0 comments on commit 5ee153e

Please sign in to comment.