2012-03-18 66 views
6

我試圖從Insight Toolkit(ITK,itk.org)製作一個Xcode項目。我發出以下命令到終端:CMake 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。

感謝您的幫助,

保羅

回答

5

這是一個CMake的錯誤,它似乎被固定在開發版:

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

+0

我們嘗試構建cmake v2.8.7-860-g32e0b19和v2.8.7-3470-g19f003f(在2012-04-18之前,git://cmake.org/cmake.git的主控和旁邊),但沒有工作,顯示確切的錯誤。那就是XCode 4.2,報告甚至不適用。 – 2012-04-18 14:08:12

+0

這似乎是在2.8.10中修復的。 – kjw0188 2013-03-14 22:44:59

2

,你可以告訴OSX修正這個,你想使用的Xcode版本。如果你安裝了4.3,它已經移到了Apps文件夾以及所有工具。以前他們都在/Developer。執行以下操作並重試。

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

您可能還需要安裝命令行工具。我已經安裝了這些,所以我不知道沒有它們會發生什麼。

+0

xcode-select確實設置了正確的路徑,但它在2.8.8之前的CMake版本中遇到了問題。不管怎麼說,還是要謝謝你。 – Paul 2012-03-19 22:06:53

+0

好的。我只是想用cmake爲Xcode 4.3生成一個iPhone項目,但它不工作。這是我必須解決的一件事。所有關於這個的信息看起來很分散! – Nick 2012-03-20 19:33:58

+0

我遇到的另一個問題是其中包含空格的路徑,CMake顯然無法處理該問題並顯示誤導性的錯誤消息。 – Paul 2012-03-22 12:09:16

0

cmake 2.8.8 rc1現在不在。也許嘗試一下。我認爲它已經解決了我的問題。 :)

+0

我希望它可以解決它,它已經在早期的一個夜間版本中得到解決,正如第一個正確的答案所表明的那樣。 – Paul 2012-03-27 07:53:22

+0

我在這裏找到它:http://www.cmake.org/files/v2.8/但它無法安裝符號鏈接,所以我不得不手動創建它們。 – Dmitriy 2012-04-04 20:28:59