Opened 8 years ago

Closed 5 years ago

Last modified 5 years ago

#52205 closed enhancement (wontfix)

CMake PortGroup: set compiler explicitly

Reported by: RJVB (René Bertin) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: mojca (Mojca Miklavec)
Port: cmake

Description

A recent CMake update changed the way the compiler choice is cached in the cmake build directory. Before it was possible to force a compiler change during an incremental build simply by removing CMakeCache.txt from build.dir; this would cause CMake to heed any changed changes in the CC and CXX env. variables.

To achieve the same thing it is now required to add something like the following to the PortGroup:

    # force newer CMake versions to take a change in compiler choice into account
    # even if it is invoked in a build.dir that was configured before.
    if {${configure.cc} ne ""} {
        configure.args-append \
                    -DCMAKE_C_COMPILER=${configure.cc}
    }
    if {${configure.cxx} ne ""} {
        configure.args-append \
                    -DCMAKE_CXX_COMPILER=${configure.cxx}
    }

I'm attaching the complete diff of the stock cmake PortGroup vs. mine.

Attachments (1)

cmake-1.0.diff (7.7 KB) - added by RJVB (René Bertin) 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by RJVB (René Bertin)

Attachment: cmake-1.0.diff added

comment:1 Changed 8 years ago by mf2k (Frank Schima)

Cc: michaelld@… removed
Owner: changed from macports-tickets@… to michaelld@…

comment:2 in reply to:  description Changed 8 years ago by larryv (Lawrence Velázquez)

Might as well just set them unconditionally. I don’t think configure.cc and configure.cxx should ever be empty.

configure.args-append -DCMAKE_C_COMPILER="${configure.cc}" \
                      -DCMAKE_CXX_COMPILER="${configure.cxx}"

comment:3 Changed 8 years ago by RJVB (René Bertin)

Agreed they shouldn't ever be empty, but aren't they?

I have a recollection encountering a related variable (cflags?) that shouldn't be assumed to bet set. I can't seem to find the example right now :-/

comment:4 Changed 7 years ago by mojca (Mojca Miklavec)

Cc: mojca added

comment:5 Changed 5 years ago by mf2k (Frank Schima)

Resolution: wontfix
Status: newclosed

We have moved on to the cmake 1.1 portgroup which already has all or most of these changes.

Last edited 5 years ago by mf2k (Frank Schima) (previous) (diff)
Note: See TracTickets for help on using tickets.