[CMake] MACOSX_DEPLOYMENT_TARGET

2006-10-10 Thread Axel Roebel
Hi,

in my cmake projects I support mac os x and
I am creating universal binaries by means of
compilation on different (ppc and intel) machines
and later combining the results using lipo.

For maximum backwards compatibility I need to
set the environment variable

 MACOSX_DEPLOYMENT_TARGET=10.3

on the ppc system and to

 MACOSX_DEPLOYMENT_TARGET=10.4

for the intel. In the mac docs I found the following way that the deployment 
target should be selected for individual compiler calls

$>  MACOSX_DEPLOYMENT_TARGET=10.4 gcc  ... compiler args

Up to now I did not find any means to change the compilation environment
during build time using cmake. I am using unix makefiles here
so the compiler call should in fact be preceded by the online 
environment declaration as above.

What I do now is to replace the compiler by a shell script 
that I create during configuration  and that contains
(for ppc)

#! /bin/bash
MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/gcc "$@"

At the same time I patch the 
CMakeCCompiler.cmake file to use this shell script instead 
of the orginal compiler.

While this solution works ok, I don't like it at all and I wonder
whether there is a solution that requires less hacking
of the cmake internals.

Kind regards,

-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] MACOSX_DEPLOYMENT_TARGET

2006-10-10 Thread Sean McBride
On 2006-10-10 21:47, Axel Roebel said:

>I am creating universal binaries by means of
>compilation on different (ppc and intel) machines
>and later combining the results using lipo.
>
>For maximum backwards compatibility I need to
>set the environment variable
>
> MACOSX_DEPLOYMENT_TARGET=10.3
>
>on the ppc system and to
>
> MACOSX_DEPLOYMENT_TARGET=10.4

I'm pretty sure there is no way to specify per-architecture variants of
these things.  I believe this was discussed in bug 2492, which you may
want to read (its long).

I suggest filing a bug.  I also think this would be a good feature for
CMake to have, though personally I don't need it.

I think it comes down to CMake's lack of cross-compilation support.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] MACOSX_DEPLOYMENT_TARGET

2006-10-10 Thread Axel Roebel
On Tuesday 10 October 2006 23:20, Sean McBride wrote:
> On 2006-10-10 21:47, Axel Roebel said:
...
> I'm pretty sure there is no way to specify per-architecture variants of
> these things.  I believe this was discussed in bug 2492, which you may
> want to read (its long).

Thanks, I've read that. But I don't want per architecture variants.
I want to configure my build for the native architecture

> I suggest filing a bug.  I also think this would be a good feature for
> CMake to have, though personally I don't need it.
>
> I think it comes down to CMake's lack of cross-compilation support.

that's not the point. I am happy with compiling natively on each machine
and I create the universal by means of a shell script. This is no cross 
compilation issue, because MACOSX_DEPLOYMENT_TARGET
selects the compiler target system for the architecture of the build system

The problem is that to my knowledge the only way to communicate the 
deployment target to gcc is via environment variables. I admit this is a 
really strange way (probably its save to say silly) to select compiler 
options, but as far as I know, this is the way it is done in Xcode. And it is 
the way it is suggested by apple for makefiles

see (at the very bottom )
http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/Using/chapter_3_section_2.html#//apple_ref/doc/uid/20002000-1114311-BABGCAAB

This means in the makefile the compiler needs to be called
as in

target :
MACOSX_DEPLOYMENT_TARGET=10.3 gcc ...

so the question would be how to achieve this.
I've the strong feeling it is not possible - is it?


-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] MACOSX_DEPLOYMENT_TARGET

2006-10-11 Thread Brad King
Axel Roebel wrote:
> The problem is that to my knowledge the only way to communicate the 
> deployment target to gcc is via environment variables. I admit this is a 
> really strange way (probably its save to say silly) to select compiler 
> options, but as far as I know, this is the way it is done in Xcode. And it is 
> the way it is suggested by apple for makefiles
> 
> see (at the very bottom )
> http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/Using/chapter_3_section_2.html#//apple_ref/doc/uid/20002000-1114311-BABGCAAB
> 
> This means in the makefile the compiler needs to be called
> as in
> 
> target :
>   MACOSX_DEPLOYMENT_TARGET=10.3 gcc ...
> 
> so the question would be how to achieve this.
> I've the strong feeling it is not possible - is it?

Try creating a shell script called "gcc-osx-10.3" containing something like

#!/bin/sh
export MACOSX_DEPLOYMENT_TARGET=10.3
exec gcc "$@"

and then set that as your compiler.

-Brad
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] MACOSX_DEPLOYMENT_TARGET

2006-10-11 Thread Sean McBride
On 2006-10-11 02:20, Axel Roebel said:

>The problem is that to my knowledge the only way to communicate the
>deployment target to gcc is via environment variables. I admit this is a
>really strange way (probably its save to say silly) to select compiler
>options, but as far as I know, this is the way it is done in Xcode. And
it is
>the way it is suggested by apple for makefiles

Oh, I see what you are asking now.  Sorry for the confusion.  So really,
you question is more about Xcode than CMake.

Anyway, I suggest reading through AvailabilityMacros.h and tn2064:


You may be able to get away with #define-ing
MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED yourself.

Otherwise, the xcode list is probably a better place to ask.


--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] MACOSX_DEPLOYMENT_TARGET

2006-10-11 Thread Axel Roebel
On Wednesday 11 October 2006 15:28, you wrote:
> Axel Roebel wrote:
> > The problem is that to my knowledge the only way to communicate the
> > deployment target to gcc is via environment variables. I admit this is a
> > really strange way (probably its save to say silly) to select compiler
> > options, but as far as I know, this is the way it is done in Xcode. And
> > it is the way it is suggested by apple for makefiles
> >
> > see (at the very bottom )
> > http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_
> >development/Using/chapter_3_section_2.html#//apple_ref/doc/uid/20002000-11
> >14311-BABGCAAB
> >
> > This means in the makefile the compiler needs to be called
> > as in
> >
> > target :
> > MACOSX_DEPLOYMENT_TARGET=10.3 gcc ...
> >
> > so the question would be how to achieve this.
> > I've the strong feeling it is not possible - is it?
>
> Try creating a shell script called "gcc-osx-10.3" containing something like

This is exactly what I do currently.
I thought there would may be exist an easier way.
I now see that my main problem is how I replace the compiler:

I patch CMakeFiles/CMakeCCompiler.cmake
from within CMakeLists.txt,
while I probably should simply do

SET(CMAKE_C_COMPILER path/gcc-osx-10.3)

I think when I tried that with an older cmake like 2.2...
this SET would not override the compiler.

With 2.4.3 I still find the original compiler /usr/bin/gcc
in the CMakeCache.txt but at least the build.cmake 
has the script. 

Thanks

> #!/bin/sh
> export MACOSX_DEPLOYMENT_TARGET=10.3
> exec gcc "$@"
>
> and then set that as your compiler.
>
> -Brad

-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] MACOSX_DEPLOYMENT_TARGET

2006-10-11 Thread William A. Hoffman
At 07:19 PM 10/11/2006, Axel Roebel wrote:

>This is exactly what I do currently.
>I thought there would may be exist an easier way.
>I now see that my main problem is how I replace the compiler:
>
>I patch CMakeFiles/CMakeCCompiler.cmake
>from within CMakeLists.txt,
>while I probably should simply do
>
>SET(CMAKE_C_COMPILER path/gcc-osx-10.3)
>
>I think when I tried that with an older cmake like 2.2...
>this SET would not override the compiler.
>
>With 2.4.3 I still find the original compiler /usr/bin/gcc
>in the CMakeCache.txt but at least the build.cmake 
>has the script. 

You need to set the environment variable CC=/path/gcc-osx-10.3 and CXX,
before you run cmake or ccmake.  Also, with a clean directory.


-Bill

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] MACOSX_DEPLOYMENT_TARGET

2006-10-12 Thread Axel Roebel
On Thursday 12 October 2006 02:27, William A. Hoffman wrote:
> At 07:19 PM 10/11/2006, Axel Roebel wrote:
> >This is exactly what I do currently.
> >I thought there would may be exist an easier way.
> >I now see that my main problem is how I replace the compiler:
> >
> >I patch CMakeFiles/CMakeCCompiler.cmake
> >from within CMakeLists.txt,
> >while I probably should simply do
> >
> >SET(CMAKE_C_COMPILER path/gcc-osx-10.3)
> >
> >I think when I tried that with an older cmake like 2.2...
> >this SET would not override the compiler.
> >
> >With 2.4.3 I still find the original compiler /usr/bin/gcc
> >in the CMakeCache.txt but at least the build.cmake
> >has the script.
>
> You need to set the environment variable CC=/path/gcc-osx-10.3 and CXX,
> before you run cmake or ccmake.  Also, with a clean directory.

That is exactly what I want to avoid. If I need to remember
such preparations I will forget it from time to time, 
and I will forget it if it is most important - during a release
compilation. That's why I prefer it to be completely automatic.

I found the  problem I had with setting

SET(CMAKE_C_COMPILER path/gcc-osx-10.3)

All subsequent TRY_COMPILE calls
will ignore it - because the cmake calls
used inside will only look at CMakeCCompiler.cmake
to determine the compiler.
So I'll stay with my 
automatic patch of CMakeCCompiler.cmake 
and co.

Thanks for your comments.

-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake