[lld] r181822 - [lld] Allow flags other than -std= in CMAKE_CXX_FLAGS. Also simplify the IF conditions.

Rui Ueyama ruiu at google.com
Tue May 14 12:53:41 PDT 2013


Author: ruiu
Date: Tue May 14 14:53:41 2013
New Revision: 181822

URL: http://llvm.org/viewvc/llvm-project?rev=181822&view=rev
Log:
[lld] Allow flags other than -std= in CMAKE_CXX_FLAGS. Also simplify the IF conditions.

Modified:
    lld/trunk/CMakeLists.txt

Modified: lld/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/CMakeLists.txt?rev=181822&r1=181821&r2=181822&view=diff
==============================================================================
--- lld/trunk/CMakeLists.txt (original)
+++ lld/trunk/CMakeLists.txt Tue May 14 14:53:41 2013
@@ -88,16 +88,11 @@ if (MSVC11)
   # Do nothing, we're good.
 elseif (NOT MSVC)
   # gcc and clang require the -std=c++0x or -std=c++11 flag.
-  if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
-      "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
-    if (NOT ("${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+0x" OR
-             "${CMAKE_CXX_FLAGS}" MATCHES "-std=gnu\\+\\+0x" OR
-             "${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+11" OR
-             "${CMAKE_CXX_FLAGS}" MATCHES "-std=gnu\\+\\+11"))
-      message(FATAL_ERROR
-        "lld requires c++11. Clang and gcc require -std=c++0x or -std=c++11 to "
-        "enter this mode. Please set CMAKE_CXX_FLAGS accordingly.")
-    endif()
+  if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang" AND
+      NOT ("${CMAKE_CXX_FLAGS}" MATCHES ".*-std=(c|gnu)\\+\\+(0x|11).*"))
+    message(FATAL_ERROR
+      "lld requires c++11. Clang and gcc require -std=c++0x or -std=c++11 to "
+      "enter this mode. Please set CMAKE_CXX_FLAGS accordingly.")
   endif()
 else()
   message(FATAL_ERROR "The selected compiler does not support c++11 which is "





More information about the llvm-commits mailing list