changeset 217:449c816968b9

fix build using mingw
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 18 Apr 2019 16:27:25 +0200
parents 47d52db10369
children 6318db66448e
files Resources/CMake/GdcmConfiguration.cmake
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/GdcmConfiguration.cmake	Fri Mar 22 10:34:11 2019 +0100
+++ b/Resources/CMake/GdcmConfiguration.cmake	Thu Apr 18 16:27:25 2019 +0200
@@ -23,16 +23,23 @@
       ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
     # If using gcc, build GDCM with the "-fPIC" argument to allow its
     # embedding into the shared library containing the Orthanc plugin
-    set(AdditionalFlags "-fPIC")
+    set(AdditionalCFlags "-fPIC")
+    set(AdditionalCxxFlags ${AdditionalCFlags})
+  elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND
+      CMAKE_COMPILER_IS_GNUCXX)
+    # Prevents error: "jump to label ‘err’ crosses initialization" of some variable
+    # within "Source/Common/gdcmCAPICryptographicMessageSyntax.cxx" if using MinGW
+    set(AdditionalCxxFlags "-fpermissive")
   elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
     # This definition is necessary to compile
     # "Source/MediaStorageAndFileFormat/gdcmFileStreamer.cxx"
-    set(AdditionalFlags "-Doff64_t=off_t") 
+    set(AdditionalCFlags "-Doff64_t=off_t") 
+    set(AdditionalCxxFlags ${AdditionalCFlags})
   endif()
   
   set(Flags
-    "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} ${AdditionalFlags}"
-    "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} ${AdditionalFlags}"
+    "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} ${AdditionalCFlags}"
+    "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} ${AdditionalCxxFlags}"
     -DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
     -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}
     -DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}