[MacPorts] #52699: cmake portgroup version 1.1
MacPorts
noreply at macports.org
Thu Oct 27 00:37:26 CEST 2016
#52699: cmake portgroup version 1.1
--------------------------+----------------------
Reporter: mkae | Owner: mkae
Type: enhancement | Status: accepted
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: cmake |
--------------------------+----------------------
Comment (by RJVB):
>This parsing code is very fragile. There’s almost certainly a better
approach. Can you explain again why it is necessary at all? I am not very
familiar with CMake.
I've been using this code for months now, and never had issues with it.
You're probably right it's fragile but in practice it seems to work well
enough, and it shouldn't drop any options which is probably the most
important part.
You have much of the explanation right in the text you quoted. CMake
defines 4 build types that each come with their own set of compiler
options. Options set in the environment (CFLAGS, CXXFLAGS, etc) are not
ignored, but they are prepended to the options CMake imposes. So if a port
or user wants to build with -O3 but the build type wants -O2, you get `-O3
-O2` which equals -O2. It's tricky to override this, unless you specify a
custom build type which evidently doesn't come with predefined compiler
options. Then you get only the options you set in the environment.
The brunt of the parsing however concerns configure.cppflags. This is done
because CMake doesn't have an equivalent, it only has an option to define
the include path (which has to be done in one go, not in incremental
steps). So to be sure that all specified include paths are known to CMake
this parser rewrites configure.cppflags so that it contains only the
-I/foo and `-I /foo` options. All other options are moved to
configure.*cflags and configure.*cxxflags.
> Note that base augments several options before setting up the
environment variables.
Meaning I should output `$::env(CXXFLAGS)`, or does it not yet have its
final value in the pre-configure?
Not that this is crucial, but it'd be nice to get it right.
--
Ticket URL: <https://trac.macports.org/ticket/52699#comment:20>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list