changeset 174:77a5d1a5ebfd

fix for msvc
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 Dec 2020 18:09:40 +0100
parents 30d3f68631d2
children 1b67c6f8037c
files Resources/CMake/PostgreSQLConfiguration.cmake
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/PostgreSQLConfiguration.cmake	Fri Dec 11 14:50:51 2020 +0100
+++ b/Resources/CMake/PostgreSQLConfiguration.cmake	Fri Dec 11 18:09:40 2020 +0100
@@ -183,16 +183,23 @@
       "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
     set(PG_PRINTF_ATTRIBUTE "gnu_printf")
     set(pg_restrict "__restrict")
+    set(restrict "__restrict")
   else()
-    set(pg_restrict "")
+    # The empty string below wouldn't work (it would do an #undef)
+    set(pg_restrict " ")
+    set(restrict " ")
   endif()
 
+  if (MSVC)
+    set(inline "__inline")
+  endif()
+  
   if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
     set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h;winsock2.h;ws2tcpip.h")
   else()
     set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h;sys/socket.h;netdb.h")
   endif()
-  
+
   check_type_size("struct addrinfo" HAVE_STRUCT_ADDRINFO)    
   check_type_size("struct sockaddr_storage" HAVE_STRUCT_SOCKADDR_STORAGE)
   check_struct_has_member("struct sockaddr_storage" ss_family