On Saturday, January 5, 2013, Michael J. Spencer  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mspencer<br>
Date: Fri Jan  4 22:16:52 2013<br>
New Revision: 171596<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=171596&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=171596&view=rev</a><br>
Log:<br>
[CMake] Don't add flags this late and don't force libc++. Error if we know the compiler doesn't support c++11.<br>
<br>
Modified:<br>
    lld/trunk/CMakeLists.txt<br>
<br>
Modified: lld/trunk/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/CMakeLists.txt?rev=171596&r1=171595&r2=171596&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/CMakeLists.txt?rev=171596&r1=171595&r2=171596&view=diff</a><br>

==============================================================================<br>
--- lld/trunk/CMakeLists.txt (original)<br>
+++ lld/trunk/CMakeLists.txt Fri Jan  4 22:16:52 2013<br>
@@ -68,29 +68,26 @@<br>
 "`CMakeFiles'. Please delete them.")<br>
 endif()<br>
<br>
-#<br>
-# lld now requires C++11 to build<br>
-#<br>
-# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")<br>
-if (NOT MSVC)<br>
-  include(CheckCXXCompilerFlag)<br>
-  check_cxx_compiler_flag("-std=c++0x" SUPPORTS_CXX11_FLAG)<br>
-  if( SUPPORTS_CXX11_FLAG )<br>
-    message(STATUS "Building with -std=c++0x")<br>
-    set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")<br>
-  else( SUPPORTS_CXX11_FLAG )<br>
-    message(WARNING "-std=c++0x not supported.")<br>
-  endif()<br>
-  check_cxx_compiler_flag("-stdlib=libc++" SUPPORTS_LIBCXX_FLAG)<br>
-  if( SUPPORTS_LIBCXX_FLAG )<br>
-    message(STATUS "Building with -stdlib=libc++")<br>
-    set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")<br>
-  else( SUPPORTS_LIBCXX_FLAG )<br>
-    message(WARNING "-stdlib=libc++ not supported.")<br>
+# lld requires c++11 to build. Make sure that we have a compiler and standard<br>
+# library combination that can do that.<br>
+if (MSVC11)<br>
+  # Do nothing, we're good.<br>
+elseif (NOT MSVC)<br>
+  # gcc and clang require the -std=c++0x or -std=c++11 flag.<br>
+  if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR<br>
+      "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")<br>
+    if (NOT ("${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+0x" OR<br>
+             "${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+11"))<br>
+      message(FATAL_ERROR<br>
+        "lld requires c++11. Clang and gcc require -std=c++0x or -std=c++11 to "<br>
+        "enter this mode. Please set CMAKE_CXX_FLAGS accordingly.")<br>
+    endif()<br>
   endif()</blockquote><div><br></div><div>Else (not gcc or clang) error?<span></span></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+else()<br>
+  message(FATAL_ERROR "The selected compiler does not support c++11 which is "<br>
+          "required to build lld.")<br>
 endif()<br>
<br>
-<br>
 macro(add_lld_library name)<br>
   llvm_process_sources(srcs ${ARGN})<br>
   if (MSVC_IDE OR XCODE)<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', '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>
</blockquote><br><br>-- <br>main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>>*/<br>