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

Markus Blatt markus at dr-blatt.de
Mon Apr 23 16:00:29 CEST 2012


Hi,

On Mon, Apr 23, 2012 at 03:28:58PM +0200, Christian Engwer wrote:
> 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.
> 

Cmake works different in this regard. Passing flags to make directly
does not work. One has to pass them to cmake configure or change the
cache and then reconfigure. In both cases the -std flags gets added to
the compiler flags in the configure stage.

CMake distinguishes the variables by type. The compiler is a file
path. It seems unnatural to put a flag there. (I think I even tried
that and it did not work.)
> 
> 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
> 

-- 
Do you need more support with DUNE or HPC in general? 

Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany
Tel.: +49 (0) 160 97590858  Fax: +49 (0)322 1108991658 




More information about the Dune mailing list