<div dir="ltr"><div><div><div><div>I aggree.<br><br></div>Here is the updated patch. For now, it does just bring the same functionality as the autotools to cmake.<br><br></div>In a second step, we can change to default to C++11 and add the appropriate checks to both autotools and cmake. This is were the real fun will happen :)<br>
<br><br></div>Cheers,<br>--<br></div>Arnaud<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 22, 2013 at 1:47 AM, NAKAMURA Takumi <span dir="ltr"><<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We should reject C++11-incompatible compiler in near future.<br>
<br>
2013/11/22 Arnaud Allard de Grandmaison <<a href="mailto:arnaud.adegm@gmail.com">arnaud.adegm@gmail.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> The patch was attempting to mimic autoconf's behaviour...<br>
><br>
> I am not sure to follow you Eric : do you mean this should not be an option<br>
> any more, and must always be set in autoconf and cmake ? It would then just<br>
> be a question of using the c++1 features (or not). In this case, I believe a<br>
> should at least check that the compiler supports '-std=c++11' (or a<br>
> different wording for non gcc compatible compilers). This would also be the<br>
> right place to check the compiler is a version recent enough as well to<br>
> build llvm --- in accrodance with c++11 switch huge discussion.<br>
><br>
><br>
> On Fri, Nov 22, 2013 at 12:26 AM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On Thu, Nov 21, 2013 at 2:25 PM, Meador Inge <<a href="mailto:meadori@codesourcery.com">meadori@codesourcery.com</a>><br>
>> wrote:<br>
>> > 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<br>
>> >> built in<br>
>> >> c++11 mode. This patch adds the handling of this option. The default is<br>
>> >> OFF for<br>
>> >> now, but I suspect it will move to ON pretty soon given the discussions<br>
>> >> on the<br>
>> >> move to c++11 for the llvm codebase.<br>
>> ><br>
>> > I am not sure why this is any better than -DCMAKE_CXX_FLAGS=-std=c++11,<br>
>> > but<br>
>> > maybe someone else can argue that point.  Also, if/when we switch it<br>
>> > seems like<br>
>> > the option is no longer useful since disabling means LLVM won't build<br>
>> > after<br>
>> > folks start using C++11 features.<br>
>> ><br>
>><br>
>> *shrug* We can remove the option at that point. I've had one in the<br>
>> autoconf side for the last few years.<br>
>><br>
>> -eric<br>
>><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>
>> >>  option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)<br>
>> >>  option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered."<br>
>> >> OFF)<br>
>> >><br>
>> >> diff --git a/cmake/modules/HandleLLVMOptions.cmake<br>
>> >> 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>
>> ><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>
>> ><br>
>> ><br>
>> > --<br>
>> > Meador Inge<br>
>> > CodeSourcery / Mentor Embedded<br>
>> > _______________________________________________<br>
>> > llvm-commits mailing list<br>
>> > <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
</div></div></blockquote></div><br></div>