CMake: Forcing OS X SDK version in find_library()

1.6k views Asked by At

I have this:

if ( DARWIN )

   message( "target:    ${CMAKE_OSX_DEPLOYMENT_TARGET}, ${CMAKE_OSX_SYSROOT}" )
   find_library( COREFOUNDATION_FRAMEWORK NAMES CoreFoundation
       NO_DEFAULT_PATH
       NO_CMAKE_ENVIRONMENT_PATH
       NO_CMAKE_PATH
       NO_SYSTEM_ENVIRONMENT_PATH
       NO_CMAKE_SYSTEM_PATH
       PATHS "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/"
   )
   message( "framework: ${COREFOUNDATION_FRAMEWORK}" )

   ...

This prints:

target:    10.7, /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
framework: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreFoundation.framework

In other words: my CMAKE_OSX_DEPLOYMENT_TARGET is set to 10.7, my CMAKE_OSX_SYSROOT is correctly set and additionally I am forcing find_library() to only use that very SYSROOT to search the resp. framework.

So why does it find the 10.9 one, not the 10.7 one? What am I missing here?

0

There are 0 answers