Use CMAKE_CXX_STANDARD now that we can.
Change-Id: Iab38f1a19286b4c45399d635332e5120dabc6a46
Reviewed-on: https://code-review.googlesource.com/c/re2/+/56776
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c980f0..44a4772 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,6 +13,11 @@
include(CTest)
include(GNUInstallDirs)
+if(NOT CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+endif()
+
option(BUILD_SHARED_LIBS "build shared libraries" OFF)
option(USEPCRE "use PCRE in tests and benchmarks" OFF)
@@ -36,11 +41,6 @@
# Without a byte order mark (BOM), Visual Studio assumes that the source
# file is encoded using the current user code page, so we specify UTF-8.
add_compile_options(/utf-8)
-elseif(CYGWIN OR MINGW)
- # See https://stackoverflow.com/questions/38139631 for details.
- add_compile_options(-std=gnu++11)
-elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
- add_compile_options(-std=c++11)
endif()
if(WIN32)