Qt 5 and OS X Mavericks issues

2019-04-29 04:01发布

问题:

I'm using Cmake to build a QT project on OS X 10.9.

Since Mavericks, the location of the OpenGL headers seems to have changed. The folder /System/Library/Frameworks/OpenGL.framework/Headers is missing now, and cmake says

CMake Error at /Applications/Qt/5.1.1/clang_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:8 (message):
  Failed to find "gl.h" in
  "/System/Library/Frameworks/OpenGL.framework/Headers"
  "/System/Library/Frameworks/AGL.framework/Headers""."

and asks me to provide the correct path in this variable _qt5gui_OPENGL_INCLUDE_DIR, which I tried with the path they apparently moved the headers to in Mavericks:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Headers

But I still get the following cmake error:

CMake Error at /Applications/Qt/5.1.1/clang_64/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:15 (message):
  The imported target "Qt5::Gui" references the file

     "/System/Library/Frameworks/OpenGL.framework/Headers"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/Applications/Qt/5.1.1/clang_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /Applications/Qt/5.1.1/clang_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:57 (_qt5_Gui_check_file_exists)
  /Applications/Qt/5.1.1/clang_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:64 (_qt5gui_find_extra_libs)
  /Applications/Qt/5.1.1/clang_64/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:123 (include)
  CMakeLists.txt:40 (find_package)

Now I don't know what to do about this error, any ideas?

回答1:

You need Qt 5.2 and CMake 2.8.12:

https://codereview.qt-project.org/#change,69605

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1fce189e