[MacPorts] #42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS

MacPorts noreply at macports.org
Sun Mar 16 05:17:14 PDT 2014


#42872: cmake PortGroup: don't add -I${prefix}/include to CXXFLAGS
---------------------+--------------------------------
 Reporter:  mojca@…  |      Owner:  macports-tickets@…
     Type:  defect   |     Status:  new
 Priority:  Normal   |  Milestone:
Component:  ports    |    Version:
 Keywords:           |       Port:  clhep cmake
---------------------+--------------------------------
 CMake is automatically fed with too many (too early) includes of
 `$prefix/include`:

 {{{
 CPPFLAGS='-I/opt/local/include'
 CFLAGS='-pipe -Os -I/opt/local/include -arch x86_64'
 CXXFLAGS='-pipe -Os -I/opt/local/include -arch x86_64'
 }}}
 with the following explanation in the `PortGroup`:
 {{{
 # The environment variable CPPFLAGS is not considered by CMake.
 # (CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS"
 # <http://www.cmake.org/Bug/view.php?id=12928>).
 # Thus, we have to add them manually to the CFLAGS and CXXFLAGS in the
 # pre-configure phase.
 if {${configure.cppflags} ne ""} {
     configure.cflags-append ${configure.cppflags}
     configure.cxxflags-append ${configure.cppflags}
 }
 }}}

 As a consequence the CMake-based installations have problems when function
 definitions change in an upgrade. I don't know if I should blame the
 developers for that or not. (In case of CLHEP, the `./configure`-based
 installation puts `-I.` in front of `CPPFLAGS`, so headers from sources
 are found first, but in CMake-based installation `-I.` comes later.)

 We should check whether we could use
 [http://www.cmake.org/Wiki/CMake_Useful_Variables CMAKE_INCLUDE_PATH]
 (`-DCMAKE_INCLUDE_PATH=${prefix}/include`) instead of `configure.cxxflags-
 append ${configure.cppflags}` for example.

 See also:
   * https://savannah.cern.ch/bugs/index.php?103664 (and ticket #42613)
   * http://www.cmake.org/Wiki/CMake_Useful_Variables

-- 
Ticket URL: <https://trac.macports.org/ticket/42872>
MacPorts <http://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list