[Dune] [Dune-Commit] dune-common r6651 - branches/cmake/cmake/modules

Christian Engwer christian.engwer at uni-muenster.de
Mon Apr 23 15:56:05 CEST 2012


Hi Bard,

> Just a tangential note: As far as I understand the CXX variable is
> generally considered a user variable in the Autotools and a particular
> build system should treat CXX as equally off-limits as the CXXFLAGS.
> Might it be better to pass the "-std=" option in the AM_CXXFLAGS?  In
> practice, though, this is probably a non-issue.

I think the user is well aware, that changing CXX is dangerous, think
e.g. of g++ vs. clang. The AM_CXXFLAGS on the other hand are sometimes
modified in the Makefile.am, as many people only expect them to hold
information like debug/release flags. If you want to make sure that
the code is compiled without any optimization you might be tempted to
modify AM_CXXFLAGS. That is the reason we have chosen to modify CXX
instead. If you want to use an other compiler you modify CXX, if this
means you drop "-std=" OK... it is similar to switching from g++-4.4
to g++-4.1. Suddenly the compiler supports less features, thus you
have to update the buildsystem accordingly.

Cheers
Christian

> Sincererly,
> -- 
> Bård Skaflestad <Bard.Skaflestad at sintef.no>
> SINTEF ICT, Applied Mathematics
> 
> On Mon, 2012-04-23 at 15:28 +0200, Christian Engwer wrote:
> > Hi Markus,
> > 
> > for the autotools we added -std=c++0x to the definition of the
> > compiler, as the compiler in expected way is only available with the
> > given parameter. Otherwise the user might call "make CXXFLAGS="-foo"
> > and the -std=c++0x is lost. Does cmake prevent such problems?
> > Otherwise I suggest to implement the same behavior as in the current
> > buildsystem.
> > 
> > Christian
> > 
> > On Mon, Apr 23, 2012 at 03:03:15PM +0200, mblatt at dune-project.org wrote:
> > > Author: mblatt
> > > Date: 2012-04-23 15:03:15 +0200 (Mon, 23 Apr 2012)
> > > New Revision: 6651
> > > 
> > > Modified:
> > >    branches/cmake/cmake/modules/FindCXX11Features.cmake
> > > Log:
> > > Do not use set_definitions for the C++11 standard flags, but put them
> > > directly into the various CXX_FLAGS.
> > > This prevents warnings.
> > > 
> > > 
> > > Modified: branches/cmake/cmake/modules/FindCXX11Features.cmake
> > > ===================================================================
> > > --- branches/cmake/cmake/modules/FindCXX11Features.cmake	2012-04-23 13:01:46 UTC (rev 6650)
> > > +++ branches/cmake/cmake/modules/FindCXX11Features.cmake	2012-04-23 13:03:15 UTC (rev 6651)
> > > @@ -7,12 +7,20 @@
> > >  CHECK_CXX_ACCEPTS_FLAG("-std=c++11" CXX_FLAG_CXX11)
> > >  if(CXX_FLAG_CXX11)
> > >    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
> > > -  add_definitions("-std=c++11")
> > > +  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
> > > +  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 ")
> > > +  set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -std=c++11 ")
> > > +  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 ")
> > > +  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -std=c++11 ")
> > >  else()
> > >    CHECK_CXX_ACCEPTS_FLAG("-std=c++0x" CXX_FLAG_CXX0X)
> > >    if(CXX_FLAG_CXX0X)
> > > -    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
> > > -    add_definitions("-std=c++0x")
> > > +    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x" )
> > > +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x ")
> > > +    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++0x ")
> > > +    set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -std=c++0x ")
> > > +    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++0x ")
> > > +    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -std=c++0x ")
> > >    endif(CXX_FLAG_CXX0X)
> > >  endif(CXX_FLAG_CXX11)
> > >  
> > > 
> > > 
> > > _______________________________________________
> > > Dune-Commit mailing list
> > > Dune-Commit at dune-project.org
> > > http://lists.dune-project.org/mailman/listinfo/dune-commit
> > > 
> > 
> > _______________________________________________
> > Dune mailing list
> > Dune at dune-project.org
> > http://lists.dune-project.org/mailman/listinfo/dune
> 
> 
> 
> 




More information about the Dune mailing list