changeset 148:0ca5a383a830

fix OS X build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Aug 2017 11:06:33 +0200 (2017-08-25)
parents 1149cefd1cee
children df15112ed5a0
files Resources/CMake/PostgreSQLConfiguration.cmake
diffstat 1 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/PostgreSQLConfiguration.cmake	Thu Aug 24 20:26:27 2017 +0200
+++ b/Resources/CMake/PostgreSQLConfiguration.cmake	Fri Aug 25 11:06:33 2017 +0200
@@ -154,20 +154,28 @@
       set(FLEXIBLE_ARRAY_MEMBER "/**/")
     endif()
 
-    file(READ ${CMAKE_SOURCE_DIR}/Resources/Platforms/printf_archetype.c SOURCE)
-    check_c_source_compiles("${SOURCE}" printf_archetype)
-    if (printf_archetype AND
-        NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND
-        NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
-      set(PG_PRINTF_ATTRIBUTE "gnu_printf")
+    if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
+        CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
+        CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+      set(PG_PRINTF_ATTRIBUTE "printf")
     else()
-      set(PG_PRINTF_ATTRIBUTE "printf")
+      file(READ ${CMAKE_SOURCE_DIR}/Resources/Platforms/printf_archetype.c SOURCE)
+      check_c_source_compiles("${SOURCE}" printf_archetype)
+      if (printf_archetype)
+        set(PG_PRINTF_ATTRIBUTE "gnu_printf")
+      else()
+        set(PG_PRINTF_ATTRIBUTE "printf")
+      endif()
     endif()
 
-    check_function_exists("unsetenv" HAVE_UNSETENV)
     check_function_exists("getaddrinfo" HAVE_GETADDRINFO)
     check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY)
+    check_function_exists("snprintf" HAVE_DECL_SNPRINTF)
     check_function_exists("srandom" HAVE_SRANDOM)
+    check_function_exists("strlcat" HAVE_DECL_STRLCAT)
+    check_function_exists("strlcpy" HAVE_DECL_STRLCPY)
+    check_function_exists("unsetenv" HAVE_UNSETENV)
+    check_function_exists("vsnprintf" HAVE_DECL_VSNPRINTF)
 
     check_type_size("struct addrinfo" SIZE_STRUCT_ADDRINFO)
     if (HAVE_SIZE_STRUCT_ADDRINFO)