From 17a8372217adadeb1dc51da529b1aa4fa4815801 Mon Sep 17 00:00:00 2001 From: dcnieho Date: Sun, 27 Jan 2013 12:38:28 +0000 Subject: [PATCH] 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 --- freeglut/freeglut/CMakeLists.txt | 6 ++++++ freeglut/freeglut/config.h.in | 4 ++++ freeglut/freeglut/src/fg_main.c | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/freeglut/freeglut/CMakeLists.txt b/freeglut/freeglut/CMakeLists.txt index 37d61aa..26b03a6 100644 --- a/freeglut/freeglut/CMakeLists.txt +++ b/freeglut/freeglut/CMakeLists.txt @@ -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) diff --git a/freeglut/freeglut/config.h.in b/freeglut/freeglut/config.h.in index 823ff07..11af946 100644 --- a/freeglut/freeglut/config.h.in +++ b/freeglut/freeglut/config.h.in @@ -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@ diff --git a/freeglut/freeglut/src/fg_main.c b/freeglut/freeglut/src/fg_main.c index c3bccdc..0a096f4 100644 --- a/freeglut/freeglut/src/fg_main.c +++ b/freeglut/freeglut/src/fg_main.c @@ -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 } }