On 9. Aug, 2009, at 23:09, Mike Jackson wrote:
On Sun, Aug 9, 2009 at 3:07 PM, Michael Wild<them...@gmail.com> wrote:
On 9. Aug, 2009, at 18:59, ML wrote:
Michael,
Thank you for this example! It was really informative. Definitely a
missing piece in my knowledge thus far.
One question:
I get an error stating:
CMake Error at CMakeLists.txt:70 (message):
MoreFilesX requires the SDK version to be not newer than 10.4u
(10.6
detected)
this comes from here:
# figure out Mac OSX SDK version (do not care for the u-suffix in
10.4u)
get_filename_component( SDK_VER ${CMAKE_OSX_SYSROOT} NAME )
string( REPLACE ".sdk" "" SDK_VER ${SDK_VER} )
string( REPLACE "MacOSX" "" SDK_VER ${SDK_VER} )
string( REGEX REPLACE "[a-zA-Z]" "" SDK_VER ${SDK_VER} )
# this REALLY needs the 10.4 SDK.
if( ${SDK_VER} VERSION_GREATER 10.4 )
message( SEND_ERROR "MoreFilesX requires the SDK version to be
not newer
than 10.4u (${SDK_VER} detected)" )
endif( ${SDK_VER} VERSION_GREATER 10.4 )
So how do I turn around and set 10.4u if it is not automatically
detected?
It is like this:
CMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk
Best,
-Jason
CMake by default detects the most current SDK. If you want to use a
different one, you have to set it in the cache, by e.g. executing
cmake -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.4 .
in the build tree. Above command also sets
CMAKE_OSX_DEPLOYMENT_TARGET=10.4
for consistency.
Please note that it is supported (and meaningful) to have different
versions
of the SDK and the deployment target (both of them may be newer
than the
other, so "all combinations allowed"). However, this has
implications on
compiling, linking and loading, which I can't remember just off the
top of
my head.
Michael
the CMAKE_OSX_DEPLOYMENT_TARGET setting controls the "Weak Linking"
that OS X does. It basically says what the minimum version of OS X
your program can run on.
the CMAKE_OSX_SYSROOT setting controls the "maximum" version of OS X
that your program can run on. By setting BOTH to 10.4 you are
basically saying that your program can run ONLY on OS X 10.4. Is that
what you want?
If you link against a library that has a function in 10.5 that is not
in 10.4 then your program will likely crash. It is up to you to take
the necessary steps in your code to ensure this does not happen, maybe
by using an alternate function?
If you read bug number 6195 you will get all the detailed explanations
you need plus all the history that will allow you to make an informed
decision about how to set those values:
http://public.kitware.com/Bug/view.php?id=6195
Mike
According to this document
http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
your information is partially wrong: CMAKE_OSX_SYSROOT gives you the
maximum SDK version from which you can USE features at built time. All
newer features will not be available. It doesn't say anything about
run time.
CMAKE_OSX_DEPLOYMENT_TARGET, on the other hand, gives the minimum
version required to run the application. All the symbols that fall in
between these two versions (where CMAKE_OSX_DEPLOYMENT_TARGET has to
be lower or equal to CMAKE_OSX_SYSROOT) are weakly linked, meaning
their address is set to NULL and need to be tested at runtime whether
they are available (described here http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html#/
/apple_ref/doc/uid/20002000-1114537-BABHHJBC and here http://developer.apple.com/technotes/tn2002/tn2064.html)
_______________________________________________
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