[mlpack-git] master: The NewCXX11.cmake file must be included after the mlpack target is defined. (c72f9c3)

gitdub at mlpack.org gitdub at mlpack.org
Wed Oct 5 11:22:55 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/316d4b002e7fb514afab1138e496e2b87e43e52d...c72f9c3224a2381dc8db6da5d83815d3b6465d45

>---------------------------------------------------------------

commit c72f9c3224a2381dc8db6da5d83815d3b6465d45
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed Oct 5 11:22:55 2016 -0400

    The NewCXX11.cmake file must be included after the mlpack target is defined.


>---------------------------------------------------------------

c72f9c3224a2381dc8db6da5d83815d3b6465d45
 CMakeLists.txt            | 6 ++----
 src/mlpack/CMakeLists.txt | 7 +++++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a34771b..58da8cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,11 +35,9 @@ if ((${CMAKE_MAJOR_VERSION} LESS 3 OR
     message(FATAL_ERROR "No C++11 compiler available!")
   endif()
   enable_cxx11()
-elseif (NOT FORCE_CXX11)
-  # Use the newer C++11 checks.
-  include(CMake/NewCXX11.cmake)
 endif ()
-
+# Otherwise, we may have to set the C++11 mode after the mlpack target is
+# defined.
 
 # Include modules in the CMake directory.
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake")
diff --git a/src/mlpack/CMakeLists.txt b/src/mlpack/CMakeLists.txt
index cc9008b..8e32636 100644
--- a/src/mlpack/CMakeLists.txt
+++ b/src/mlpack/CMakeLists.txt
@@ -23,6 +23,13 @@ endif ()
 # are set in the root CMakeLists.txt.
 add_library(mlpack ${MLPACK_SRCS})
 
+# If we are not forcing C++11 support, check that the compiler supports C++11
+# and enable it.
+if (NOT FORCE_CXX11)
+  # Use the newer C++11 checks.
+  include(../../CMake/NewCXX11.cmake)
+endif ()
+
 # Generate export symbols for Windows, instead of adding __declspec(dllimport)
 # and __declspec(dllexport) everywhere.  However, those modifiers are still
 # necessary for global variables (of which there are a few in mlpack).




More information about the mlpack-git mailing list