nobe4
nobe4

Reputation: 2842

CMAKE_OSX_DEPLOYMENT_TARGET automatically set to '10.10' on Yosemite

I am trying to compile the VRPN library on my OS X 10.10.5.

I set up the cmake configuration with : ccmake ../vrpn. And when I try to configure the project I get the following error :

CMake Error at /usr/local/Cellar/cmake/3.4.0/share/cmake/Modules/Platform/Darwin.cmake:76 (message):
   CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' 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.
Call Stack (most recent call first):
   /usr/local/Cellar/cmake/3.4.0/share/cmake/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
   CMakeLists.txt:3 (project)

CMake Error: Internal CMake error, TryCompile configure of cmake failed

nal CMake error, TryCompile configure of cmake failed

And I see in the configuration the variable :

CMAKE_OSX_DEPLOYMENT_TARGET      10.10

When trying to configure the project again, I get the following message along with the previous error :

CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' but the matching SDK does not exist
   at:
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk"

Instead using SDK:
 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk".

Obviously, the problem is that the default cmake configuration sets the wrong SDK version.

I change the version to 10.11 :

CMAKE_OSX_DEPLOYMENT_TARGET      10.11

And I set the CMAKE_OSX_SYSROOT as required :

CMAKE_OSX_SYSROOT    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

The configuration is fine but then I get the following error :

Could NOT find Threads (missing: Threads_FOUND)

What surprises me is that on another CMakeLists.txt I try to fetch the Threads library and the cmake execution is fine :

cmake_minimum_required (VERSION 3.4) 
find_package(Threads REQUIRED)

I supposed that the problem is that the custom CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET make the Threads package not findable. But each time I try and remove the CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT from the ccmake configuration, I get the first error message and the CMAKE_OSX_DEPLOYMENT_TARGET is reset to 10.10.

Do you have any information/tests that I can try to solve this ?

Upvotes: 1

Views: 2839

Answers (1)

Daniel Georgiev
Daniel Georgiev

Reputation: 1340

Updating Xcode to 8.1 and Installing Command line tools solved it for me

xcode-select --install

Upvotes: 1

Related Questions