On Oct 31, 2007, at 1:26 PM, James Bigler wrote:
Sean McBride wrote:
On 10/31/07 9:28 AM, Mike Jackson said:
Would someone have an example of detecting the specific version
of OS X that cmake is running on? I would like add values based
on OS X version.
IF (OS_X_VERSION matches "10.5")
......
ENDIF (OS_X_VERSION matches "10.5")
or something to that effect..
Mike,
I'm curious... in what situation does it matter which version of
the OS
is being run? Wouldn't it be better to check which SDK is being
used? Or the deployment version?
Is there an easy way to determine the deployment version of the
integrated X environment?
OSX 10.5 changed to using Xorg instead of XFree86 and some of the
paths have changed. As well there is some confusion with the
linker when trying to link the X version of libGL. Here's what one
of our developers said about it:
"The main issue is linkpaths, OSX has two GL libraries that seem to
conflict and with the default CMake settings it picks up the wrong
library. Basically CMake does not write out the proper linking
instructions. To fix this for Leopard, a hack is added that adds
the OpenGL libraries to the LINK_FLAGS variables, which circumvents
the parsing of filenames in -Lpath -llibname, the latter will cause
OSX to find the OpenGL version in the frameworks. Currently CMake
does not have an option to include paths directly, hence we hacked
it to make it work."
738··IF·(APPLE_LEOPARD)
739····SET·(GL_LIBRARY·""·CACHE·INTERNAL·"OpenGL·Libs"·FORCE)
740····SET·(GL_LINK·"·/usr/X11R6/lib/libGL.dylib·/usr/X11R6/lib/
libGLU.dylib·-
framework·AGL"·CACHE·INTERNAL·"Link·options·for·OpenGL·libs"·FORCE)
741····SET·(X_LIBRARY·""·CACHE·INTERNAL·"OpenGL·Libs"·FORCE)
742····SET·(X_LINK·"·/usr/X11R6/lib/libX11.dylib·/usr/X11R6/lib/
libXext.dylib·-
framework·Carbon"·CACHE·INTERNAL·"Link·options·for·X11·libs"·FORCE)
743
744··ELSE·(APPLE_LEOPARD)
745····SET·(GL_LIBRARY·/usr/X11R6/lib/libGL.dylib·/usr/X11R6/lib/
libGLU.dylib·"-framework·AGL"·CACHE·INTERNAL·"OpenGL·Libs")
746····SET·
(GL_LINK·""·CACHE·INTERNAL·"Link·options·for·OpenGL·libs"·FORCE)
747····SET·(X_LINK·""·CACHE·INTERNAL·"Link·options·for·X·libs"·FORCE)
748····SET·(SCIRUN_INCLUDE_ADDITIONAL·${SCIRUN_INCLUDE_ADDITIONAL}·$
{GL_INCLUDE})····
749··ENDIF·(APPLE_LEOPARD)
87··IF(APPLE_LEOPARD)
88····SET_TARGET_PROPERTIES(Core_Events·PROPERTIES·LINK_FLAGS··"$
{GL_LINK}·${X_LINK}")
89··ENDIF(APPLE_LEOPARD)
James
I was having the same problem that james was having with ParaView
2.6.1. Here is the solution that I came up with based from a web page;
#-- Put the following in ${ParaView_SOURCE_DIR}/CMake/
OSXLeopardX11OpenGL.cmake
IF ( OSX_LEOPARD_OPENGL_FIX )
IF (APPLE)
IF (VTK_USE_X)
#IF(CMAKE_COMPILER_IS_GNUCXX)
SET (CMAKE_EXE_LINKER_FLAGS "-Wl,-dylib_file,/System/
Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/
System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/
libGL.dylib" )
SET (CMAKE_SHARED_LINKER_FLAGS "-Wl,-dylib_file,/System/
Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/
System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/
libGL.dylib")
# ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF (VTK_USE_X)
ENDIF (APPLE)
ENDIF ( OSX_LEOPARD_OPENGL_FIX )
In the Top Level CmakeLists.txt file insert a new option into the OS
X section:
OPTION(OSX_LEOPARD_OPENGL_FIX "Adds Linker arguments needed to
correctly select the X11 OpenGL Library" TRUE)
# ----------------- End OS X 10.5 X11 Patch
----------------------------------
http://wiki.finkproject.org/index.php/
Fink:Packaging:Preparing_for_10.5#OpenGL_Bug
Also, X11 move to the X.org code base for Leopard and there are LOTS
of problems so far. The XDarwin maintainer has just released a new
binary for Leopard users that starts to fix some of the problems.
http://lists.apple.com/archives/X11-users/2007/Oct/msg00123.html
http://lists.apple.com/archives/X11-users/2007/Oct/msg00201.html
So the reason I want to know is that this work-around may only be
needed for 10.5.0 or certain versions of X11. Certainly do not need
it for 10.4.
I guess I could look for a certain version of X11 on Leopard? But the
real thing is the linker issue so I think this issue may be here to
stay. Just a guess. I know nothing about any of this. I just need
ParaView to work on Leopard.
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology
Services_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake