[MacPorts] #49108: CMake Portgroup: use a custom CMAKE_BUILD_TYPE

MacPorts noreply at macports.org
Mon Oct 12 02:16:19 PDT 2015


#49108: CMake Portgroup: use a custom CMAKE_BUILD_TYPE
--------------------------+--------------------------------
  Reporter:  rjvbertin@…  |      Owner:  macports-tickets@…
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:  2.3.4
Resolution:               |   Keywords:  haspatch
      Port:               |
--------------------------+--------------------------------

Comment (by rjvbertin@…):

 Somehow I missed the fact that the CMake portgroup does an explicit
 definition of `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`. That cancels the
 intended effect. Remove those definitions, and my change has the intended
 effect.

 I'm preparing a new diff, but want to take some feedback into account.

 Question: is there a hard reason to use -DNDEBUG?

 One could include `${configure.c*flags}` in that explicit definition, but
 that means the definition gets set at the moment the portgroup is
 included, and can no longer take any tweaking of `CFLAGS`, `CXXFLAGS`
 (etc?) into account that might occur after that moment (which is typically
 at the head of a Portfile).

 Concerning a few comments in the PortGroup file:

 Re: the ObjC equivalents: consensus of the CMake developers appears to be
 that there is no need for CMAKE_OBJC*_FLAGS (and they know best after all,
 don't they ...).

 Re: CPPFLAGS: no development on the cited ticket. There is the possiblity
 to use `-DINCLUDE_DIRECTORIES=?` but that would mean filtering out any
 preprocessor options that aren't `-I` options.

 Maybe one should write a `pre-configure` block in the CMake PortGroup that
 takes the final value of ${CPPFLAGS}, collects the -I options to
 initialise `INCLUDE_DIRECTORIES`, and adds the remaining options to at
 least CFLAGS and CXXFLAGS in `configure.env`?
 It would make life easier if CMake allowed things like
 `-DINCLUDE_DIRECTORIES+=foo` but that appears not to be the case. One can
 only set variables, not append to them (like in CMake files, though there
 at least one can use a variable's current value, which also seems
 impossible on the commandline).

-- 
Ticket URL: <https://trac.macports.org/ticket/49108#comment:3>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list