Using CMake to setup OpenGL on OSX Yosemite (10.10)

Hi,

I am kind of new to C++ development on Mac as it has been a while since I was hacking on Linux.

I am not sure if I have found a bug in the latest EAP build:
CLion CL-143.249.8
Build #CL-143.249, built on October 14, 2015
JRE: 1.8.0_40-release-b92 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o


The problem seems to be that CLion generates an incorrect include statement using the automagic feature of "option-return". It generates a: "#include <OpenGL/OpenGL.h>" which is the limited CGL stuff. However, the correct the statement should be "#include <OpenGL/gl.h>".

Is this a bug? Or is there something else I should do in the cmakelists.txt file to fix it?

Thanks.
3 comments
Comment actions Permalink

Hi William.

Sorry for the inconvenience, we have several issues about auto-import feature. For example:
https://youtrack.jetbrains.com/issue/CPP-704
Please upvote.

Could you please send us an example to reproduce your problem with OpenGL? I will create the issue in the tracker or you can add it: https://youtrack.jetbrains.com/issues/CPP.

Also you can turn off auto-import pop ups via Editor | General | Auto-import. The pop-up with include suggestion won’t show up in that case, though you’ll still be able to invoke an auto-import when necessary using an intention action (Alt+Enter).

You can find out more information about this feature in our blog:
http://blog.jetbrains.com/clion/2015/04/clion-1-0-lets-start-the-countdown/
0
Comment actions Permalink

Hi Anna,

I have included the 3 files that make up the simple project.

The Auto-import feature seems to work most of the time. In this case it seems to fixate on the OpenGL.h file rather than the gl.h file. There must be some way to specifiy which one to use in the cmakelists.txt file, otherwise I can understand why CLion would get confused from the ambiquos situation after all they are both in the same include directory so how would it know which one to choose. To me it is obvious because I can inspect both headers and easily see which one is the correct one. Technically they are both opengl header files. I guess CLion would parse the headers to figure out which one to use and this must be where the problem is.

Anyway, thanks for the tip.



Attachment(s):
FindSDL2.cmake.zip
main.cpp.zip
CMakeLists.txt.zip
0
Comment actions Permalink

Hi William.

Thanks for the details! I've found the same issue: https://youtrack.jetbrains.com/issue/OC-11760. Feel free to comment or upvote.

0

Please sign in to leave a comment.