Repository: mesos
Updated Branches:
  refs/heads/master cece83f37 -> 0a4a900e5


Windows: Fixed CMake configuration for Ninja.

Only the Visual Studio generator(s) should check the toolset. The
Ninja generator requires the environment to be setup in advance, and
does not have the concept of a toolset, so this warning broke the
Ninja build.

Instead of warning that we're deprecating some arbitrary generator, we
should just say we don't officially support it so the user knows it
may not work as expected.

Fixed the assumption that all generators on Windows are
multi-configuration. Ninja is single-configuration, so the debug CRT
flag must sometimes be set for `CMAKE_CXX_FLAGS` depending on
`CMAKE_BUILD_TYPE`.

Review: https://reviews.apache.org/r/65719


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/82be0643
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/82be0643
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/82be0643

Branch: refs/heads/master
Commit: 82be06436a2a1e2919187695660986651d802343
Parents: cece83f
Author: Andrew Schwartzmeyer <[email protected]>
Authored: Fri Feb 16 15:27:40 2018 -0800
Committer: Andrew Schwartzmeyer <[email protected]>
Committed: Wed Mar 7 13:35:38 2018 -0800

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/82be0643/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 50cddf9..efee36c 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -52,7 +52,7 @@ if (ENABLE_PRECOMPILED_HEADERS)
   set(COTIRE_VERBOSE ${VERBOSE})
 endif ()
 
-if (WIN32)
+if (CMAKE_GENERATOR MATCHES "Visual Studio")
   # In MSVC 1900, there are two bugs in the linker, one that causes linking
   # libmesos to occasionally take hours, and one that causes us to be able to
   # fail to open the `mesos-x.lib` file. These have been confirmed as bugs with
@@ -192,7 +192,7 @@ if (WIN32)
   if (NOT CMAKE_GENERATOR MATCHES ${PREFERRED_GENERATOR})
     message(
       WARNING
-      "Mesos is deprecating support for ${CMAKE_GENERATOR}. "
+      "Mesos does not officially support ${CMAKE_GENERATOR}. "
       "Please use ${PREFERRED_GENERATOR}.")
   endif ()
 
@@ -325,10 +325,17 @@ if (WIN32)
     # NOTE: We do not add CRT here because dependencies will use it 
incorrectly.
     string(APPEND CMAKE_${lang}_FLAGS " /MP -DUNICODE -D_UNICODE")
 
-    # Debug library for debug configuration.
-    string(APPEND CMAKE_${lang}_FLAGS_DEBUG "${CRT}d")
+    # Debug library for debug configuration, release otherwise.
 
-    # All other configurations.
+    # Handle single-configuration generators such as Ninja.
+    if (CMAKE_BUILD_TYPE MATCHES Debug)
+      string(APPEND CMAKE_${lang}_FLAGS "${CRT}d")
+    else ()
+      string(APPEND CMAKE_${lang}_FLAGS ${CRT})
+    endif ()
+
+    # Handle multi-configuration generators such as Visual Studio.
+    string(APPEND CMAKE_${lang}_FLAGS_DEBUG "${CRT}d")
     foreach (config RELEASE RELWITHDEBINFO MINSIZEREL)
       string(APPEND CMAKE_${lang}_FLAGS_${config} ${CRT})
     endforeach ()

Reply via email to