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

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


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
> 




More information about the Dune mailing list