CMake Xcode generator uses no longer supported options
Asked Answered
T

3

6

I'm trying to make a Xcode project from the Insight Toolkit (ITK, itk.org). I issued the following command into the terminal:

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>

When I try to generate the project it fails with this error:

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

How can I configure the call to cmakexbuild? I haven't found a respective entry in the CMake configuration menu.

I have found similar problems from other users with other projects so I assume it's a problem with the CMake configuration.

I'm using Xcode 4.3 and CMake 2.8.7 on Mac OS X Lion 10.7.3.

Thanks for your help,

Paul

Toolmaker answered 18/3, 2012 at 15:31 Comment(0)
H
5

It's a CMake bug and it seem to be been fixed in development version:

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

Hindenburg answered 19/3, 2012 at 7:42 Comment(2)
We tried to build cmake v2.8.7-860-g32e0b19 and v2.8.7-3470-g19f003f (master and next of git://cmake.org/cmake.git by 2012-04-18), but neither worked, showing exactly that error. And that is XCode 4.2, for which the report shouldn't even apply.Paraffinic
This seems to be fixed in 2.8.10.Torrid
A
2

You can fix this by telling OSX which version of Xcode you want to use. If you installed 4.3, it has moved to the Apps folder, along with all the tools. Previously they were all in /Developer. Do the following and try again.

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

You may also have to install the command-line tools. I already installed these so I don't know what will happen without them.

Ashur answered 19/3, 2012 at 19:20 Comment(3)
xcode-select did set the correct path but its a problem with CMake versions before 2.8.8. Thanks anyway.Toolmaker
Ah ok. I'm just trying to use cmake to generate an iPhone project for Xcode 4.3 and it isn't working. This was one thing I had to fix. All the information on this seems so scattered!Ashur
Another problem I ran into were paths with spaces in them, CMake obviously cannot deal with that and displays misleading error messages.Toolmaker
A
0

cmake 2.8.8 rc1 is out now. Perhaps try that. I think it has solved my problem. :)

Ashur answered 27/3, 2012 at 1:11 Comment(2)
I expect it to solve it, it was already solved in one of the earlier nightly builds as indicated by the first correct answer.Toolmaker
I found it here: cmake.org/files/v2.8 but it fails to install symbolic links so I had to create them manually.Asyndeton

© 2022 - 2024 — McMap. All rights reserved.