Thanks Erik, I have merged and checked in your changes.  I think
Ulrich's suggestion of the change APPLE_PLATFORM_SDK_CANONICAL_NAME is
sensible so I'll apply this change next.

On 22 March 2012 23:49, Erik den Dekker <[email protected]> wrote:
> Hi Robert,
>
>
> Currently, OSG determines the version of the selected CMAKE_OSX_SYSROOT by
> comparing its value with a hard-coded path:
>
> IF(${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.7.sdk")
> ...
>
>             ELSEIF(${CMAKE_OSX_SYSROOT} STREQUAL
> "/Developer/SDKs/MacOSX10.5.sdk" OR ${CMAKE_OSX_SYSROOT} STREQUAL
> "/Developer/SDKs/MacOSX10.6.sdk")
>
> ...
>
> ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
> ...
>
>             ELSE()
>
> ...
>
>             ENDIF()
>
>
> Which is fragile because XCode could be installed into another directory
> than /Developer. (In case XCode is not installed into the /Developer
> directory CMake can automatically resolve the path via command line utility
> ${CMAKE_XCODE_SELECT} --print-path)
>
> This issue bites me currently because the latest XCode (Version 4.3.1 -
> 4E1019) installed through the Mac App Store is per default installed in
> "/Applications/Xcode.app/Contents/Developer" and hence the 10.7 SDK in
> "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
>
> Searching the web to find the proper way to determine the version of the
> Platform SDK programmatically, I found no standard way. I came up with 2
> options myself:
>
> 1) Parse the path string to extract the version number
>
> 2) Read a value from the SDKSettings.plist found in the root of each SDK
>  (e.g., "defaults read ${CMAKE_OSX_ROOT}/SDKSettings.plist CanonicalName"
> gives "macosx10.7")
>
> I implemented the last option and verified that at least the following Mac
> OS SDKs (10.3.9, 10.4, 10.5, 10.6, 10.7) support this method. It also looks
> reasonably future proof. An additional benefit of this method is that it
> also seems to be compatible with iOS and iOS Simulator SDKs (at least for
> version 5.1, but I assume this also applies to older versions). This is
> interesting because the CMake infrastructure to build OSG for iOS currently
> still contains similar hard-coded paths and even requires you to manually
> change the cmake file to build for another iOS SDK version. In the near
> future I hope to address these issues, but I haven't been able to try this
> yet.
>
> Based on SVN revision 13041
>
>
>
>
> Cheers,
>
> Erik den Dekker
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to