6

我正在尝试从 Insight Toolkit(ITK,itk.org)制作一个 Xcode 项目。我向终端发出了以下命令:

ccmake -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -DCMAKE_CXX_COMPILER=/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -GXcode /<path to source>

当我尝试生成项目时,它失败并出现以下错误:

CMake Error at /Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):

The C compiler "/Applications/Xcode.app/Contents/Developer/usr/bin/gcc" is not able to compile a simple test program.

It fails with the following output:

Change Dir: /<path to destination folder>/CMakeFiles/CMakeTmp

Run Build Command:/Applications/CMake\ 2.8-7.app/Contents/bin/cmakexbuild -project CMAKE_TRY_COMPILE.xcode build -target cmTryCompileExec -buildstyle Development

xcodebuild: error: option '-buildstyle' is no longer supported

如何配置对 cmakexbuild 的调用?我没有在 CMake 配置菜单中找到相应的条目。

我从其他项目的其他用户那里发现了类似的问题,所以我认为这是 CMake 配置的问题。

我在 Mac OS X Lion 10.7.3 上使用 Xcode 4.3 和 CMake 2.8.7。

谢谢你的帮助,

保罗

4

3 回答 3

5

这是一个 CMake 错误,它似乎已在开发版本中修复:

http://public.kitware.com/Bug/view.php?id=12621

于 2012-03-19T07:42:05.823 回答
2

你可以通过告诉 OSX 你想使用哪个版本的 Xcode 来解决这个问题。如果您安装了 4.3,它会连同所有工具一起移至 Apps 文件夹。以前他们都在/Developer. 执行以下操作,然后重试。

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer

您可能还必须安装命令行工具。我已经安装了这些,所以我不知道没有它们会发生什么。

于 2012-03-19T19:20:45.437 回答
0

cmake 2.8.8 rc1 现已推出。也许尝试一下。我认为它解决了我的问题。:)

于 2012-03-27T01:11:45.127 回答