Skip to content

Commit

Permalink
[libpqxx] Fix building with cmake 3.30
Browse files Browse the repository at this point in the history
Fixes microsoft#39694

Upstream issue: jtv/libpqxx#851
  • Loading branch information
sgoth committed Jul 15, 2024
1 parent 7aeffc9 commit dbd9226
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
42 changes: 42 additions & 0 deletions ports/libpqxx/fix_build_cmake_3.30.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From d5bf7cf83d0c86c502b6b30d5f0c8dc3b3049a38 Mon Sep 17 00:00:00 2001
From: Jeroen Vermeulen <[email protected]>
Date: Sun, 23 Jun 2024 21:03:24 +0200
Subject: [PATCH] Fixes https://github.com/jtv/libpqxx/issues/851

Thanks @tt4g.
---
cmake/config.cmake | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cmake/config.cmake b/cmake/config.cmake
index ef2ebf5fc..4d9f7e935 100644
--- a/cmake/config.cmake
+++ b/cmake/config.cmake
@@ -8,10 +8,18 @@ function(detect_code_compiled code macro msg)
endif()
endfunction(detect_code_compiled)

+if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.30.0)
+ include(CMakeDetermineCompilerSupport)
+ cmake_determine_compiler_support(CXX)
+else()
+ # This function changed names in CMake 3.30. :-(
+ include(CMakeDetermineCompileFeatures)
+ cmake_determine_compile_features(CXX)
+endif()
+
include(CheckIncludeFileCXX)
include(CheckFunctionExists)
include(CheckSymbolExists)
-include(CMakeDetermineCompileFeatures)
include(CheckCXXSourceCompiles)
include(CMakeFindDependencyMacro)

@@ -39,7 +47,6 @@ check_function_exists("poll" PQXX_HAVE_POLL)

set(CMAKE_REQUIRED_LIBRARIES pq)

-cmake_determine_compile_features(CXX)
cmake_policy(SET CMP0057 NEW)

# check_cxx_source_compiles requires CMAKE_REQUIRED_DEFINITIONS to specify
1 change: 1 addition & 0 deletions ports/libpqxx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fix_build_with_vs2017.patch
fix_build_cmake_3.30.patch # remove with > 7.9.1, upstream fix: https://github.com/jtv/libpqxx/commit/d5bf7cf83d0c86c502b6b30d5f0c8dc3b3049a38
)

file(COPY "${CMAKE_CURRENT_LIST_DIR}/config-public-compiler.h.in" DESTINATION "${SOURCE_PATH}")
Expand Down
1 change: 1 addition & 0 deletions ports/libpqxx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "libpqxx",
"version": "7.9.0",
"port-version": 1,
"description": "The official C++ client API for PostgreSQL",
"homepage": "https://www.postgresql.org/",
"license": "BSD-3-Clause",
Expand Down

0 comments on commit dbd9226

Please sign in to comment.