Hi all
while trying to compile some program which links agains the Python
libraries on my Mac OS X 10.6 box for 10.5, I noticed that there's
something wrong with both CMakeFindFrameworks.cmake and
FindPythonLibs.cmake.
CMakeFindFrameworks.cmake does not search the SDK root in
CMAKE_OS_SYSROOT, it should be patched as follows:
--- Modules/CMakeFindFrameworks.cmake.orig 2009-10-26
12:58:16.000000000 +0100
+++ Modules/CMakeFindFrameworks.cmake 2009-10-26 12:58:24.000000000
+0100
@@ -21,6 +21,8 @@
FOREACH(dir
~/Library/Frameworks/${fwk}.framework
/Library/Frameworks/${fwk}.framework
+ ${CMAKE_OSX_SYSROOT}/Library/Frameworks/${fwk}.framework
+ ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/$
{fwk}.framework
/System/Library/Frameworks/${fwk}.framework
/Network/Library/Frameworks/${fwk}.framework)
IF(EXISTS ${dir})
FindPythonLibs.cmake is trickier. The problem is, that it does the
following (in pseudo-code)
foreach version in [2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5]
foreach dir in ${framework_dirs}
include_dir = "${dir}/Versions/${version}/Headers"
if exists(include_dir)
break
endif
endforeach
endforeach
Now, what happens is the following:
- CMakeFindFrameworks.cmake finds
* /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/
Python.framework
* /System/Library/Frameworks/Python.framework
- For each of those frameworks, FindPythonLibs.cmake cycles through
the various Python version numbers and checks whether the sub-
directory Versions/${version}/Headers exists. If such a directory
exists in any of the found Python frameworks, the search is stopped.
Unfortunately, Python-2.6 is present on OS X 10.6, but NOT in the 10.5
SDK. Since the search starts with version 2.6, it will find it in /
System/Library/Frameworks, and not in the SDK which only contains the
2.5 version as the newest Python library. This then results in an
include path which is not consistent with the framework version that
will be linked.
So, I think the search loops should be turned inside-out (in pseudo-
code):
foreach dir in ${framework_dirs}
foreach version in [2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5]
include_dir = "${dir}/Versions/${version}/Headers"
if exists(include_dir)
break
endif
endforeach
endforeach
IMHO this can't be done with the current structure of the find-module
and probably needs to be split into two sections conditional on APPLE.
Do you agree with this assessment?
Michael
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake