Require C++11 based on the compiler identified by CMake.

Change-Id: I4997ebb7a32a59d2cf56181038990e70c0f95d2d
Reviewed-on: https://code-review.googlesource.com/4233
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a056ac8..0212a0b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,11 +11,15 @@
 
 set(EXTRA_TARGET_LINK_LIBRARIES)
 
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+  add_compile_options(-std=c++11)
+endif()
+
 if(WIN32)
   add_definitions(-DUNICODE -D_UNICODE -DSTRICT -DNOMINMAX)
   set(THREADING threadwin)
 else()
-  add_compile_options(-std=c++11 -pthread)
+  add_compile_options(-pthread)
   set(THREADING thread)
   list(APPEND EXTRA_TARGET_LINK_LIBRARIES -pthread)
 endif()