Reputation: 243
I am trying to compile some c++ code that was already written (by someone else) using Cmake in Linux, and I came across the line SET(CMAKE_CXX_LINK_FLAGS "-framework OpenGL")
in CMakeLists.txt
. I've never seen -framework
as a command line option and can't seem to find any mention of it in any posts/websites/cmake documentation. And, of course, I am getting the errors c++: error: OpenGL: No such file or directory
and c++: error: unrecognized command line option '-framework'
.
Does anyone know what -framework does? Cmake was having problems with OpenGL when I was trying to use it to build/configure VTK, but I thought I fixed that since it ended up working. Would it make sense for the VTK build to work and not this? Could the unrecognized -framework option error be a result of the lack of OpenGL? Or are they separate?
Upvotes: 1
Views: 1043
Reputation: 321
The -framework
option is accepted by Apple clang
; frameworks are a way of packaging headers and libraries in a particular directory structure.
A CMake file unconditionally specifying those options is not portable; a better solution that will work cross-platform is to use the find_package
command. You can read more about how to use find_package
here.
Upvotes: 2