can now configure build such that runtime warnings and/or errors occuring in lib are not printed to stderr (thanks Nigel Steward)

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1501 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-01-27 12:38:28 +00:00
parent f79dae9865
commit 17a8372217
3 changed files with 14 additions and 2 deletions

View File

@ -25,6 +25,12 @@ set(VERSION_PATCH 0)
OPTION(BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
OPTION(BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
# option for whether warnings and errors should be printed
OPTION(FREEGLUT_ERRORS "Lib prints errors to stderr" ON)
#MARK_AS_ADVANCED(FREEGLUT_ERRORS)
OPTION(FREEGLUT_WARNINGS "Lib prints warnings to stderr" ON)
#MARK_AS_ADVANCED(FREEGLUT_WARNINGS)
# option to also copy .pdb files to install directory when executing
# INSTALL target
IF(MSVC)

View File

@ -23,3 +23,7 @@
#define VERSION_MAJOR @VERSION_MAJOR@
#define VERSION_MINOR @VERSION_MINOR@
#define VERSION_PATCH @VERSION_PATCH@
/* warning and errors printed? */
#define FREEGLUT_WARNINGS @FREEGLUT_WARNINGS@
#define FREEGLUT_ERRORS @FREEGLUT_ERRORS@

View File

@ -261,7 +261,7 @@ void fgError( const char *fmt, ... )
va_end( ap );
} else {
#if FREEGLUT_ERRORS
va_start( ap, fmt );
fprintf( stderr, "freeglut ");
@ -271,6 +271,7 @@ void fgError( const char *fmt, ... )
fprintf( stderr, "\n" );
va_end( ap );
#endif
if ( fgState.Initialised )
fgDeinitialize ();
@ -293,7 +294,7 @@ void fgWarning( const char *fmt, ... )
va_end( ap );
} else {
#if FREEGLUT_WARNINGS
va_start( ap, fmt );
fprintf( stderr, "freeglut ");
@ -303,6 +304,7 @@ void fgWarning( const char *fmt, ... )
fprintf( stderr, "\n" );
va_end( ap );
#endif
}
}