我努力地尝试在Mac上通过命令行将glew链接到cmake。这可能有帮助,但我不确定 :) 我将一步一步地向您展示我所做的事情。
我从web安装了Cmake源码。
然后我在终端中进入了cmake文件夹并输入了以下内容:
./bootstrap && make && make install
(这将在我们的操作系统平台上安装CMake命令行工具)
我有一些练习文件。我希望CMake为我生成所有这些练习文件(例如triangles.cpp,shader.cpp等)的Xcode文件,因此我在练习文件夹内创建了一个目录。
$ mkdir xcode
$ cd xcode
$ cmake -G "Xcode" ..
此时,Cmake应该安装所有包含正确库的Xcode文件。但是出现了错误:
$ cmake -G "Xcode" ..
CMake Warning (dev) at CMakeLists.txt:3 (cmake_minimum_required):
Compatibility with CMake < 2.4 is not supported by CMake >= 3.0.
This warning is for project developers. Use -Wno-dev to suppress it.
system name is: Darwin-14.1.0
system processor is: x86_64
-- Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Using Cocoa for window creation
-- Using NSGL for context creation
-- Building GLFW only for the native architecture
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GLEW_LIBRARY
linked by target "TextureLoader" in directory /Users/Mydir/Desktop/Exercise/Exercise Files
-- Configuring incomplete, errors occurred!
为了确保我已经正确安装了GLEW及其所有库,我运行了以下命令:
$brew install glew
是的,我已经安装了glew,但它还没有被链接。请看下面的警告:
Warning: glew-1.12.0 already installed, it's just not linked
然后我运行了以下命令:
$ brew unlink glew
$ brew link glew
我已经解决了错误。所以请确保你已经链接了glew。希望这能有所帮助。
编程愉快 :)