summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorJordan Williams <jordan@jwillikers.com>2024-04-12 08:58:57 -0500
committerGitHub <noreply@github.com>2024-04-12 15:58:57 +0200
commita6651e10ffc1753945faf8de0192cf74effc80d8 (patch)
tree591b96610879f3d44705864d243751592108c749 /CMake
parent5de880ae810f7790d888d52a1accbafb0607bf0f (diff)
CMake: Improve detection of the GLU library and GL/glu.h header file (#953)
* CMake: Improve detection of the GLU library and GL/glu.h header file Locate the GLU library and header independent of the GL library and header locations. Add the GLU header location to necessary target_include_directory calls. * CMake: Locate and use the GL include directory Find the GL include directory and use it in target_include_directories calls.
Diffstat (limited to 'CMake')
-rw-r--r--CMake/options.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/CMake/options.cmake b/CMake/options.cmake
index d04431ba7..fb7ce5653 100644
--- a/CMake/options.cmake
+++ b/CMake/options.cmake
@@ -613,9 +613,12 @@ if(FLTK_BUILD_GL)
set(OPENGL_FOUND TRUE)
find_library(OPENGL_LIB GL)
get_filename_component(PATH_TO_GLLIB ${OPENGL_LIB} DIRECTORY)
+ find_library(GLU_LIB GLU)
+ get_filename_component(PATH_TO_GLULIB ${GLU_LIB} DIRECTORY)
# FIXME: we should find a better way to resolve this issue:
# with GL, must use XQuartz libX11 else "Insufficient GL support"
- set(OPENGL_LIBRARIES -L${PATH_TO_GLLIB} -lX11 -lGLU -lGL)
+ set(OPENGL_LIBRARIES -L${PATH_TO_GLULIB} -L${PATH_TO_GLLIB} -lX11 -lGLU -lGL)
+ find_path(OPENGL_INCLUDE_DIR NAMES GL/gl.h OpenGL/gl.h HINTS ${X11_INCLUDE_DIR})
unset(HAVE_GL_GLU_H CACHE)
find_file(HAVE_GL_GLU_H GL/glu.h PATHS ${X11_INCLUDE_DIR})
else()
@@ -638,7 +641,8 @@ mark_as_advanced(OPENGL_LIB) # internal cache variable, not relevant for users
mark_as_advanced(HAVE_GL_GLU_H)
if(OPENGL_FOUND)
- set(CMAKE_REQUIRED_INCLUDES ${OPENGL_INCLUDE_DIR}/GL)
+ find_path(OPENGL_GLU_INCLUDE_DIR NAMES GL/glu.h OpenGL/glu.h HINTS ${OPENGL_INCLUDE_DIR} ${X11_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_INCLUDES ${OPENGL_INCLUDE_DIR}/GL ${OPENGL_GLU_INCLUDE_DIR})
# Set GLLIBS (used in fltk-config).
# We should probably deduct this from OPENGL_LIBRARIES but it turned