summaryrefslogtreecommitdiff
path: root/examples/OpenGL3-glut-test.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2024-05-01 17:31:17 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2024-05-13 15:19:27 +0200
commitbc63ea7629c8c3c4248a777d1c0325ae800556e0 (patch)
tree257e30371623a35d8b7fb92e9abf83ce7cf8b856 /examples/OpenGL3-glut-test.cxx
parentd1ea57bc7a04ea611dec555ca310d5e572a4b60e (diff)
CMake: improve linking OpenGL3 example programs (#959)
- Remove find_library(LIB_GLEW ...) from 'resources.cmake' - Use the variable FLTK_GLEW_DIR to "find" a user supplied GLEW library for OpenGL3 example programs (examples/OpenGL3*.cxx). Both static and shared libs (DLLs) are supported, but the static library is preferred to avoid DLL dependencies. - Define preprocessor macro 'GLEW_STATIC' by CMake compile definitions if and only if the static glew library (glew32s) was found and linked. The previous code defined 'GLEW_STATIC' unconditionally in the source code which led to undefined references if a shared lib (DLL) was used.
Diffstat (limited to 'examples/OpenGL3-glut-test.cxx')
-rw-r--r--examples/OpenGL3-glut-test.cxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/OpenGL3-glut-test.cxx b/examples/OpenGL3-glut-test.cxx
index 311a02603..8693b3861 100644
--- a/examples/OpenGL3-glut-test.cxx
+++ b/examples/OpenGL3-glut-test.cxx
@@ -19,11 +19,10 @@
# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED 1
# include <OpenGL/gl3.h> // defines OpenGL 3.0+ functions
#else
-# if defined(_WIN32)
-# define GLEW_STATIC 1
-# endif
+// Note: GLEW_STATIC is defined by CMake if the static lib is linked
# include <GL/glew.h>
#endif
+
#include <FL/glut.H>
#include <FL/fl_ask.H>
#include <stdio.h>