From a6651e10ffc1753945faf8de0192cf74effc80d8 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Fri, 12 Apr 2024 08:58:57 -0500 Subject: 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. --- src/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 58954c2ca..b12880c3b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -813,6 +813,10 @@ endif() if(FLTK_USE_GL) fl_add_library(fltk_gl STATIC "${GLCPPFILES};${GL_HEADER_FILES};${GL_DRIVER_HEADER_FILES}") target_link_libraries(fltk_gl PUBLIC ${OPENGL_LIBRARIES} fltk::fltk) + target_include_directories(fltk_gl PUBLIC ${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS}) + if(OPENGL_GLU_INCLUDE_DIR) + target_include_directories(fltk_gl PUBLIC ${OPENGL_GLU_INCLUDE_DIR}) + endif() endif(FLTK_USE_GL) ####################################################################### @@ -879,6 +883,10 @@ if(FLTK_BUILD_SHARED_LIBS AND NOT MSVC) if(FLTK_USE_GL) fl_add_library(fltk_gl SHARED "${GLCPPFILES};${GL_HEADER_FILES};${GL_DRIVER_HEADER_FILES}") target_link_libraries(fltk_gl-shared PUBLIC ${OPENGL_LIBRARIES} fltk::fltk-shared) + target_include_directories(fltk_gl-shared PUBLIC ${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS}) + if(OPENGL_GLU_INCLUDE_DIR) + target_include_directories(fltk_gl-shared PUBLIC ${OPENGL_GLU_INCLUDE_DIR}) + endif() endif(FLTK_USE_GL) endif(FLTK_BUILD_SHARED_LIBS AND NOT MSVC) @@ -918,6 +926,10 @@ if(FLTK_BUILD_SHARED_LIBS AND MSVC) if(OPENGL_FOUND) target_link_libraries(fltk-shared PUBLIC ${OPENGL_LIBRARIES}) + target_include_directories(fltk_gl-shared PUBLIC ${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS}) + if(OPENGL_GLU_INCLUDE_DIR) + target_include_directories(fltk-shared PUBLIC ${OPENGL_GLU_INCLUDE_DIR}) + endif() endif(OPENGL_FOUND) endif(FLTK_BUILD_SHARED_LIBS AND MSVC) -- cgit v1.2.3