changeset 774:923b00f7aa2d

try to fix vs2008 build
author Alain Mazy <am@orthanc.team>
date Fri, 28 Nov 2025 19:01:52 +0100
parents 36f4a9992d11
children ff98fb3cb901
files Resources/CMake/PostgreSQLConfiguration.cmake Resources/PostgreSQL/libpq-18.1-msvc.patch
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/PostgreSQLConfiguration.cmake	Fri Nov 28 15:43:35 2025 +0100
+++ b/Resources/CMake/PostgreSQLConfiguration.cmake	Fri Nov 28 19:01:52 2025 +0100
@@ -97,7 +97,24 @@
 #  endif
 #endif
 ")
+
+  if (MSVC)
+    # Older versions of Microsoft Visual Studio (notably MSVC2008)
+    # don't have inttypes.h.
+    execute_process(
+      COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
+      ${CMAKE_CURRENT_LIST_DIR}/../PostgreSQL/libpq-18.1-msvc.patch
+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+      RESULT_VARIABLE Failure
+      )
+
+    if (Failure)
+      message(FATAL_ERROR "Error while patching a file")
     endif()
+  endif()
+
+
+  endif()
 
   elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
     add_definitions(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/PostgreSQL/libpq-18.1-msvc.patch	Fri Nov 28 19:01:52 2025 +0100
@@ -0,0 +1,11 @@
+diff -ruN postgresql-18.1-orig/src/include/c.h postgresql-18.1/src/include/c.h
+--- postgresql-18.1-orig/src/include/c.h	2025-11-28 18:54:52.627048100 +0100
++++ postgresql-18.1/src/include/c.h	2025-11-28 18:56:22.269355100 +0100
+@@ -59,7 +59,6 @@
+ #include "pg_config_os.h"		/* config from include/port/PORTNAME.h */
+ 
+ /* System header files that should be available everywhere in Postgres */
+-#include <inttypes.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>