Fix CXX11 option to be available on MinGW & CygWin, but not MSVC.
- Previously we were disabling the CXX11 option when WIN32 was defined,
which it can be on both MinGW & CygWin, even though the compilers
there can support the -std=c++11 option.
- Now we disable the CXX11 option only when the compiler used is MSVC.
Change-Id: I68ebcf0a4241afe93892a3c6f79cdd98887e785a
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d25fdf..96ae6d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,7 +104,7 @@
# under the MPL.
OPTION(EIGENSPARSE
"Enable Eigen as a sparse linear algebra library, WARNING: results in an LGPL licensed Ceres." OFF)
-if (NOT WIN32)
+if (NOT MSVC)
# Ceres does not use C++11 internally, however it does use shared_ptr
# (required) and unordered_map (if available), both of which were present in
# previous iterations of what became C++11. GCC & Clang can have both TR1 &
@@ -115,10 +115,12 @@
# Enabling this option forces the use of the C++11 versions (& -std=c++11) if
# available.
#
- # This option is not available on Windows, as there, any new (C++11 etc)
- # features available are on by default and there is no analogue to -std=c++11.
+ # This option is not available on Windows when using MSVC, as there, any new
+ # (C++11 etc) features available are on by default and there is no analogue to
+ # -std=c++11. It will however be available for MinGW & CygWin, which can
+ # support -std=c++11.
option(CXX11 "Enable use of C++11 headers if available (requires client code use C++11)." OFF)
-endif(NOT WIN32)
+endif(NOT MSVC)
option(EXPORT_BUILD_DIR
"Export build directory using CMake (enables external use without install)." OFF)
option(BUILD_TESTING "Enable tests" ON)
diff --git a/docs/source/building.rst b/docs/source/building.rst
index f7d30d5..af5c30a 100644
--- a/docs/source/building.rst
+++ b/docs/source/building.rst
@@ -546,7 +546,7 @@
multi-threading with ``OpenMP`` is not supported. Turn this ``OFF``
to disable multi-threading.
-#. ``CXX11 [Default: OFF]`` *Non-Windows platforms only*.
+#. ``CXX11 [Default: OFF]`` *Non-MSVC compilers only*.
Although Ceres does not currently use C++11, it does use ``shared_ptr``
(required) and ``unordered_map`` (if available); both of which existed in the
@@ -554,7 +554,7 @@
Ceres can compile on pre-C++11 compilers, using the TR1/C++0x versions of
``shared_ptr`` & ``unordered_map``.
- Note that on Linux (GCC & Clang), compiling against the TR1/C++0x versions:
+ Note that when using GCC & Clang, compiling against the TR1/C++0x versions:
``CXX11=OFF`` (the default) *does not* require ``-std=c++11`` when compiling
Ceres, *nor* does it require that any client code using Ceres use
``-std=c++11``. However, this will cause compile errors if any client code
@@ -587,9 +587,10 @@
OS X 10.9+ ON std **Yes**
=================== ========== ================ ======================================
- The ``CXX11`` option does does not exist for Windows, as there any new C++
- features available are enabled by default, and there is no analogue of
- ``-std=c++11``.
+ The ``CXX11`` option does does not exist when using MSVC, as there any new
+ C++ features available are enabled by default, and there is no analogue of
+ ``-std=c++11``. It will however be available on MinGW & CygWin, which can
+ support ``-std=c++11``.
#. ``BUILD_SHARED_LIBS [Default: OFF]``: By default Ceres is built as
a static library, turn this ``ON`` to instead build Ceres as a