From 0aee7c12f3abbe2fdf1432b4bda2552b7dafac72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr> Date: Mon, 2 Mar 2020 15:55:00 +0100 Subject: [PATCH] WRG: silence warning C4251 cause by gdal includes on windows --- .../Adapters/GdalAdapters/include/otbSpatialReference.h | 5 ++++- .../GdalAdapters/src/otbCoordinateTransformation.cxx | 7 +++++++ .../Adapters/GdalAdapters/src/otbOGRGeometryWrapper.cxx | 9 +++++++++ .../Adapters/GdalAdapters/src/otbSpatialReference.cxx | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Modules/Adapters/GdalAdapters/include/otbSpatialReference.h b/Modules/Adapters/GdalAdapters/include/otbSpatialReference.h index 2605ad12f0..37611309fd 100644 --- a/Modules/Adapters/GdalAdapters/include/otbSpatialReference.h +++ b/Modules/Adapters/GdalAdapters/include/otbSpatialReference.h @@ -21,7 +21,6 @@ #define otbSpatialReference_h #include "OTBGdalAdaptersExport.h" -#include "ogr_spatialref.h" #include <memory> #include <string> @@ -34,6 +33,10 @@ // to have dll-interface to be used by clients of class 'otb::SpatialReference' // As long as otb::SpatialReference::m_SR is private no need to export this type. #endif + +// causes warning C4251 on Windows +#include "ogr_spatialref.h" + class OGRSpatialReference; namespace otb diff --git a/Modules/Adapters/GdalAdapters/src/otbCoordinateTransformation.cxx b/Modules/Adapters/GdalAdapters/src/otbCoordinateTransformation.cxx index 393107ac26..574444a7f6 100644 --- a/Modules/Adapters/GdalAdapters/src/otbCoordinateTransformation.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbCoordinateTransformation.cxx @@ -20,7 +20,14 @@ #include "otbCoordinateTransformation.h" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4251) #include "ogr_spatialref.h" +#pragma warning(pop) +#else +#include "ogr_spatialref.h" +#endif #include <sstream> #include <stdexcept> diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRGeometryWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRGeometryWrapper.cxx index 5b6f84386f..06852f3fc5 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRGeometryWrapper.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRGeometryWrapper.cxx @@ -23,7 +23,16 @@ /*===============================[ Includes ]================================*/ /*===========================================================================*/ #include "otbOGRGeometryWrapper.h" + + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4251) #include "ogr_geometry.h" +#pragma warning(pop) +#else +#include "ogr_geometry.h" +#endif #ifdef _MSC_VER // warning conversion int -> bool diff --git a/Modules/Adapters/GdalAdapters/src/otbSpatialReference.cxx b/Modules/Adapters/GdalAdapters/src/otbSpatialReference.cxx index 12b160b7a7..120f8d0ae2 100644 --- a/Modules/Adapters/GdalAdapters/src/otbSpatialReference.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbSpatialReference.cxx @@ -20,7 +20,7 @@ #include "otbSpatialReference.h" -#include "ogr_spatialref.h" + #include "cpl_conv.h" #ifdef __clang__ #pragma clang diagnostic ignored "-Wunused-local-typedefs" -- GitLab