diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b49ead73..88cfa6518 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,6 +271,9 @@ MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGBOX) OPTION(OSG_USE_UTF8_FILENAME "Set to ON to use a UTF8 locale for filenames instead of the default locale." OFF) MARK_AS_ADVANCED(OSG_USE_UTF8_FILENAME) +OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC wartnings genertated by OSG headers." ON) +MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS) + OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON) ################################################################################ diff --git a/include/osg/Export b/include/osg/Export index af9af4485..422a7ad00 100644 --- a/include/osg/Export +++ b/include/osg/Export @@ -14,11 +14,24 @@ #ifndef OSG_EXPORT_ #define OSG_EXPORT_ 1 +#include // define USE_DEPRECATED_API is used to include in API which is being fazed out // if you can compile your apps with this turned off you are // well placed for compatibility with future versions. #define USE_DEPRECATED_API +// disable VisualStudio warnings +#if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS) + #pragma warning( disable : 4244 ) + #pragma warning( disable : 4251 ) + #pragma warning( disable : 4267 ) + #pragma warning( disable : 4275 ) + #pragma warning( disable : 4290 ) + #pragma warning( disable : 4786 ) + #pragma warning( disable : 4305 ) + #pragma warning( disable : 4996 ) +#endif + #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__) # if defined( OSG_LIBRARY_STATIC ) # define OSG_EXPORT @@ -29,7 +42,7 @@ # endif #else # define OSG_EXPORT -#endif +#endif // set up define for whether member templates are supported by VisualStudio compilers. #ifdef _MSC_VER diff --git a/src/osg/Config.in b/src/osg/Config.in index d8c13b134..88aa642fa 100644 --- a/src/osg/Config.in +++ b/src/osg/Config.in @@ -29,5 +29,7 @@ #cmakedefine OSG_USE_FLOAT_BOUNDINGBOX #cmakedefine OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION #cmakedefine OSG_USE_UTF8_FILENAME +#cmakedefine OSG_DISABLE_MSVC_WARNINGS + #endif