# HG changeset patch # User Sebastien Jodogne # Date 1479134628 -3600 # Node ID 91a2274660c42d64df44ebd2af6f8d602f446462 # Parent e7bd83ba0e0c3646f0162149b3205ac44e8c69d2 fix os x build diff -r e7bd83ba0e0c -r 91a2274660c4 Resources/CMake/PostgreSQLConfiguration.cmake --- a/Resources/CMake/PostgreSQLConfiguration.cmake Thu Nov 10 09:57:50 2016 +0100 +++ b/Resources/CMake/PostgreSQLConfiguration.cmake Mon Nov 14 15:43:48 2016 +0100 @@ -29,19 +29,19 @@ "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/postgresql-9.6.1.tar.gz" "${PQ_SOURCES_DIR}") - if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set(PQ_CONFIG_H ${PQ_SOURCES_DIR}/src/include/pg_config.h.win32) if (${MSVC}) configure_file( ${PQ_SOURCES_DIR}/src/include/pg_config.h.win32 ${AUTOGENERATED_DIR}/pg_config.h - COPY_ONLY) + COPYONLY) configure_file( ${PQ_SOURCES_DIR}/src/include/pg_config_ext.h.win32 ${AUTOGENERATED_DIR}/pg_config_ext.h - COPY_ONLY) + COPYONLY) else() if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") @@ -58,9 +58,9 @@ configure_file( ${PQ_SOURCES_DIR}/src/include/port/win32.h ${AUTOGENERATED_DIR}/pg_config_os.h - COPY_ONLY) + COPYONLY) - else() + elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") @@ -78,20 +78,41 @@ configure_file( ${PQ_SOURCES_DIR}/src/include/port/linux.h ${AUTOGENERATED_DIR}/pg_config_os.h - COPY_ONLY) + COPYONLY) + + elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(PQ_CONFIG_H ${CMAKE_SOURCE_DIR}/Resources/Platforms/pg_config-darwin64.h) + else() + message(FATAL_ERROR "Support your platform here") + endif() + + add_definitions( + -D_GNU_SOURCE + -D_THREAD_SAFE + -D_POSIX_PTHREAD_SEMANTICS + ) + + configure_file( + ${PQ_SOURCES_DIR}/src/include/port/darwin.h + ${AUTOGENERATED_DIR}/pg_config_os.h + COPYONLY) + + else() + message(FATAL_ERROR "Support your platform here") endif() configure_file( ${PQ_CONFIG_H} ${AUTOGENERATED_DIR}/pg_config.h - COPY_ONLY + COPYONLY ) configure_file( ${CMAKE_SOURCE_DIR}/Resources/Platforms/pg_config_ext.h ${AUTOGENERATED_DIR}/pg_config_ext.h - COPY_ONLY + COPYONLY ) file(WRITE @@ -136,10 +157,15 @@ ${PQ_SOURCES_DIR}/src/backend/libpq/md5.c ${PQ_SOURCES_DIR}/src/backend/utils/mb/encnames.c ${PQ_SOURCES_DIR}/src/backend/utils/mb/wchar.c - ${PQ_SOURCES_DIR}/src/port/strlcpy.c ) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + LIST(APPEND LIBPQ_SOURCES + ${PQ_SOURCES_DIR}/src/port/strlcpy.c + ) + + elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") include_directories( ${PQ_SOURCES_DIR}/src/include/port/win32 ${PQ_SOURCES_DIR}/src/port @@ -156,6 +182,7 @@ ${PQ_SOURCES_DIR}/src/port/system.c ${PQ_SOURCES_DIR}/src/port/win32setlocale.c ${PQ_SOURCES_DIR}/src/port/getaddrinfo.c + ${PQ_SOURCES_DIR}/src/port/strlcpy.c ) if (CMAKE_COMPILER_IS_GNUCXX OR