I suppose you mean OPENGL_INCLUDE_DIR, not OPENGL_INCLUDE_DIRECTORY.
You have a couple of options here. The easiest thing is to add ${OPENGL_INCLUDE_DIR}/GLor ${OPENGL_INCLUDE_DIR}/OpenGLto your search paths and use
#include "gl.h"
in the source code.
Windows, /gl /gl - /gl.
, CMakeLists.txt :
if(APPLE)
include_directories(${OPENGL_INCLUDE_DIR}/OpenGL)
else()
include_directories(${OPENGL_INCLUDE_DIR}/GL)
endif()
, CMake "gl.h" :
find_path(OpenglIncludeSubdir
NAMES gl.h
PATHS ${OPENGL_INCLUDE_DIR}
PATH_SUFFIXES GL OpenGL
NO_DEFAULT_PATH)
include_directories(${OpenglIncludeSubdir})
, :
#include "gl.h"
, (.. ${OPENGL_INCLUDE_DIR}) "gl.h", configure_file #include. , - :
#include "@OpenglSubdir@/gl.h"
configure_file @OpenglSubdir@ .
#include "GL/gl.h"
#include "OpenGL/gl.h"
.
To achieve this, you would do something like:
find_file(OpenglSubdir
NAMES GL OpenGL
PATHS ${OPENGL_INCLUDE_DIR}
NO_DEFAULT_PATH)
get_filename_component(OpenglSubdir ${OpenglSubdir} NAME)
configure_file(${CMAKE_SOURCE_DIR}/my_config.h.in ${CMAKE_SOURCE_DIR}/my_config.h)
source
share