PortGroup cmake

Joshua Root jmr at macports.org
Mon Nov 5 15:32:50 PST 2012


On 2012-11-6 05:46 , Bradley Giesbrecht wrote:
> Hi,
> 
> 
> Changes in cmake 2.8.10 are causing problems for the cmake PortGroup.

What problems?

> Setting -DCMAKE_OSX_SYSROOT=/ is a problem. I believe cmake expects CMAKE_OSX_SYSROOT to be a path to an sdk.
> cmake-1.0.tcl:
> ...
> pre-configure {
> ...
>     configure.universal_args-append \
>         -DCMAKE_OSX_ARCHITECTURES=\"[join ${configure.universal_archs} \;]\"
>     if {${configure.sdkroot} != ""} {
>         configure.args-append -DCMAKE_OSX_SYSROOT="${configure.sdkroot}"
>     } else {
>         configure.args-append -DCMAKE_OSX_SYSROOT=/
>     }
> }
> ...
> 
> 
> The svn log for r78651 says:
> ...
> cmake portgroup: set sysroot to / when an SDK is not needed (see #29008, #29452)
> ...
> 
> 
> Would something like this be a safe replacement for the default "/":
>     if {[vercmp ${xcodeversion} 4.3] < 0} {
>         set sdks.path ${developer_dir}/SDKs
>     } else {
>         set sdks.path ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs
>     }
>     set os.sdk ""
>     array set os.sdks {
>          8  10.4u
>          9  10.5
>         10  10.6
>         11  10.7
>         12  10.8
>     }
>     foreach {key value} [array get os.sdks]  {
>         if {${key} == ${os.major}} {
>             set os.sdk ${value}
>         }
>     }
>     if {[file exists ${sdks.path}/MacOSX${os.sdk}.sdk]} {
>         configure.args-append -DCMAKE_OSX_SYSROOT:PATH=${sdks.path}/MacOSX${os.sdk}.sdk
>     } else {
>         configure.args-append -DCMAKE_OSX_SYSROOT:PATH=/
>     }

It doesn't do the same thing. The desired outcome is that the SDK
specified in ${configure.sdkroot} is used if there is one, and no SDK is
used if ${configure.sdkroot} is empty. This code always uses an SDK if
one exists, and always uses the one corresponding to the current OS,
ignoring ${configure.sdkroot}.

It also does precisely the thing that you are saying causes problems in
the final else block.

If there's a better way to tell cmake to not use any SDK, then by all
means use it.

- Josh


More information about the macports-dev mailing list