Reputation: 1894
I'm learning OpenGL and trying to make my code as portable as possible. For now I managed to compile a project on Ubuntu Linux 14.04, Windows 7 and MacOS. But I having some problems with FreeBSD (PC-BSD 10.2 if that matters). Here is a code example:
After running make
(see all build steps in README.md) clang complains that it can't find <GL/gl.h>
which is used in ./glfw/include/GLFW/glfw3.h
. But GL/gl.h
is present in /usr/local/include directory.
According to Google this is a well known issue. I tried to manualy edit CMAKE_CXX_FLAGS
in CMakeLists.txt
, modify environment varibales, etc. Nothing works.
Could you help me, please?
Upvotes: 2
Views: 828
Reputation: 34411
You do find_package(OpenGL REQUIRED)
and use ${OPENGL_LIBRARY}
(which should be either ${OPENGL_LIBRARIES}
or ${OPENGL_gl_LIBRARY}
according to documentation), but you don't do include_directories(${OPENGL_INCLUDE_DIR})
.
FreeBSD installs all 3d-party software into /usr/local
prefix, and many developers assume that all headers they need are within /usr
. This is true for Linux just for coincidence. Because of that, if your software uses OpenGL, you should explicitly mention its include and library paths in your build system code and not make assumptions on their location.
Upvotes: 3