Skip to content

Upgrading to XCode 8 on OSX 10.11 breaks cmake #3197

@danpat

Description

@danpat

After upgrading to XCode 8 on my OSX 10.11 box, a fresh cmake .. command gives me this error:

CMake Error at /usr/local/Cellar/cmake/3.5.1/share/cmake/Modules/Platform/Darwin.cmake:76 (message):
  CMAKE_OSX_DEPLOYMENT_TARGET is '10.11' but CMAKE_OSX_SYSROOT:

   ""

  is not set to a MacOSX SDK with a recognized version.  Either set
  CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
  empty.

It appears that XCode 8 comes with the 10.12 SDK. CMake is using the current OS version to find the SDK, and failing.

The build can be made successfully by being explicit about the SDK path and the minimum OS version for building:

cmake -DCMAKE_OSX_SYSROOT=$(xcrun --sdk macosx --show-sdk-path) -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10  ..

This sets the minimum OSX version to 10.10, and uses the current SDK from XCode, whatever it is.

We should bake these fixes into the base CMakeLists.txt file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions