Skip to content

Commit

Permalink
[libpqxx] Fix building libpqxx 7.9.0 with cmake 3.30 (microsoft#39927)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoth authored Jul 15, 2024
1 parent 19bf4c0 commit 17e1889
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
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 <jtvjtv@gmail.com>
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
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4874,7 +4874,7 @@
},
"libpqxx": {
"baseline": "7.9.0",
"port-version": 0
"port-version": 1
},
"libprotobuf-mutator": {
"baseline": "1.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libpqxx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "36fb80efda7137194f2bf679b9e685e9dab60bb5",
"version": "7.9.0",
"port-version": 1
},
{
"git-tree": "c8078815fcddf1da8e7d8fba66100befaa779ec0",
"version": "7.9.0",
Expand Down

0 comments on commit 17e1889

Please sign in to comment.