From bc63ea7629c8c3c4248a777d1c0325ae800556e0 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 1 May 2024 17:31:17 +0200 Subject: 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. --- examples/OpenGL3test.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'examples/OpenGL3test.cxx') diff --git a/examples/OpenGL3test.cxx b/examples/OpenGL3test.cxx index deaf2ec8f..c9f0d59e5 100644 --- a/examples/OpenGL3test.cxx +++ b/examples/OpenGL3test.cxx @@ -25,9 +25,7 @@ #if defined(__APPLE__) # include // 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 #endif #include // for gl_texture_reset() -- cgit v1.2.3