From Wojciech Lewandowski, "I have restored MSVC disabled warnings in osg/Export. Difference is they are now disabled only when OSG_DISABLE_MSVC_WARNINGS macro is defined. This macro is set through CMake options and autogenerated in osg/Config. Simon suggested that it would be cool if we had more control over selected warnings. I tried to learn how to make selection of individual warning numbers possible, but had to gave up as my cmake skills were not sufficient. The only way I saw this possible would be adding one define for each MSVC warning number. But many definitions seemed too be to much clutter for osg/Config file so I rejected thar idea. For this it would be cool if autogenerated Config entries could more powerful than simple #define/#undef flags. Maybe Cmake gurus know how to do it.

I have not reverted added Compiler options. I assume that one may want to have warnings enabled for the application but may not want to see them while OSG libraries and examples compile.

Modified files:

osg/Export   - now explicitly includes osg/Config to make sure OSG_DISABLE_MSVC_WARNINGS is read
osg/Config.in  - declares OSG_DISABLE_MSVC_WARNINGS flag to be added to autogenerated osg/Config
CMakeLists.txt - declares OSG_DISABLE_MSVC_WARNINGS as option with default ON setting
"
This commit is contained in:
Robert Osfield 2008-11-24 16:32:52 +00:00
parent f92baedf2b
commit 410b90334a
3 changed files with 19 additions and 1 deletions

View File

@ -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) 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) 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) OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
################################################################################ ################################################################################

View File

@ -14,11 +14,24 @@
#ifndef OSG_EXPORT_ #ifndef OSG_EXPORT_
#define OSG_EXPORT_ 1 #define OSG_EXPORT_ 1
#include<osg/Config>
// define USE_DEPRECATED_API is used to include in API which is being fazed out // 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 // if you can compile your apps with this turned off you are
// well placed for compatibility with future versions. // well placed for compatibility with future versions.
#define USE_DEPRECATED_API #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(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
# if defined( OSG_LIBRARY_STATIC ) # if defined( OSG_LIBRARY_STATIC )
# define OSG_EXPORT # define OSG_EXPORT

View File

@ -29,5 +29,7 @@
#cmakedefine OSG_USE_FLOAT_BOUNDINGBOX #cmakedefine OSG_USE_FLOAT_BOUNDINGBOX
#cmakedefine OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION #cmakedefine OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION
#cmakedefine OSG_USE_UTF8_FILENAME #cmakedefine OSG_USE_UTF8_FILENAME
#cmakedefine OSG_DISABLE_MSVC_WARNINGS
#endif #endif