<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 21, 2013 at 11:25 PM, Meador Inge <span dir="ltr"><<a href="mailto:meadori@codesourcery.com" target="_blank">meadori@codesourcery.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 11/21/2013 04:04 PM, Arnaud Allard de Grandmaison wrote:<br>
<br>
> In some cases, like when building llvm+lldb with cmake, llvm has to be built in<br>
> c++11 mode. This patch adds the handling of this option. The default is OFF for<br>
> now, but I suspect it will move to ON pretty soon given the discussions on the<br>
> move to c++11 for the llvm codebase.<br>
<br>
</div>I am not sure why this is any better than -DCMAKE_CXX_FLAGS=-std=c++11, but<br>
maybe someone else can argue that point.  Also, if/when we switch it seems like<br>
the option is no longer useful since disabling means LLVM won't build after<br>
folks start using C++11 features.<br></blockquote><div><br></div><div>Well, in this case it is appended, so it plays nicely with the other options.</div><div><br></div><div>I believe having this as an option will be good at least the beginning of the transition, but it will soon enough change to be either on by default, or even better, move to a check that the compiler does indeed support c++11 or bails otherwise.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> diff --git a/CMakeLists.txt b/CMakeLists.txt<br>
> index f43204f..40cc7b6 100644<br>
> --- a/CMakeLists.txt<br>
> +++ b/CMakeLists.txt<br>
> @@ -179,6 +179,7 @@ else( MSVC )<br>
>    option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)<br>
>  endif()<br>
><br>
> +option(LLVM_ENABLE_CXX11 "Compile with C++11 enabled." OFF)<br>
<br>
Should this be documented: <a href="http://llvm.org/docs/CMake.html" target="_blank">http://llvm.org/docs/CMake.html</a> ?<br>
<br></blockquote><div><br></div><div>Yep. Will add.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
>  option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)<br>
>  option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)<br>
><br>
> diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake<br>
> index bb41a58..71a5d25 100644<br>
> --- a/cmake/modules/HandleLLVMOptions.cmake<br>
> +++ b/cmake/modules/HandleLLVMOptions.cmake<br>
> @@ -246,6 +246,10 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )<br>
>    if (LLVM_ENABLE_WERROR)<br>
>      add_llvm_definitions( -Werror )<br>
>    endif (LLVM_ENABLE_WERROR)<br>
> +  if (LLVM_ENABLE_CXX11)<br>
> +    check_cxx_compiler_flag("-Werror -std=c++11" CXX_SUPPORTS_CXX11)<br>
<br>
Why do you need to check for "-Werror" too?<br></blockquote><div><br></div><div>Copy / Paste from lines above. Will remove it.</div><div><br></div><div>Thanks for the comments.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
> +    append_if(CXX_SUPPORTS_CXX11 "-std=c++11" CMAKE_CXX_FLAGS)<br>
> +  endif (LLVM_ENABLE_CXX11)<br>
>  endif( MSVC )<br>
><br>
>  macro(append_common_sanitizer_flags)<br>
> -- 1.8.3.2<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Meador Inge<br>
CodeSourcery / Mentor Embedded<br>
</font></span></blockquote></div><br></div></div>