endforeach()\r
endif()\r
\r
+# The Ninja generator doesn't de-dup the exception mode flag, so remove the\r
+# default flag so that MSVC doesn't warn about it on every single file.\r
+if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")\r
+ foreach(flag_var\r
+ CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE\r
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO\r
+ CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE\r
+ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)\r
+ if (${flag_var} MATCHES "/EHsc")\r
+ string(REGEX REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}")\r
+ endif()\r
+ endforeach()\r
+endif()\r
+\r
# In order for /Zc:inline, which speeds up the build significantly, to work\r
# we need to remove the /Ob0 parameter that CMake adds by default, because that\r
# would normally disable all inlining.\r
\r
_STL_EXTRA_DISABLED_WARNINGS=4774\ 4987\r
\r
- $<$<BOOL:${MSVC_ENABLE_CPP_LATEST}>:"_HAS_AUTO_PTR_ETC=1"> # We're building in C++ 17 or greater mode, but certain dependencies (Boost) still have dependencies on unary_function and binary_function, so we have to make sure not to remove them.\r
- $<$<BOOL:${MSVC_ENABLE_LEAN_AND_MEAN_WINDOWS}>:"WIN32_LEAN_AND_MEAN"> # Don't include most of Windows.h\r
+ $<$<BOOL:${MSVC_ENABLE_CPP_LATEST}>:_HAS_AUTO_PTR_ETC=1> # We're building in C++ 17 or greater mode, but certain dependencies (Boost) still have dependencies on unary_function and binary_function, so we have to make sure not to remove them.\r
+ $<$<BOOL:${MSVC_ENABLE_LEAN_AND_MEAN_WINDOWS}>:WIN32_LEAN_AND_MEAN> # Don't include most of Windows.h\r
)\r
\r
# Ignore a warning about an object file not defining any symbols,\r
elseif ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 14 2015 Win64")
set(CMAKE_GENERATOR_TOOLSET "v140</PlatformToolset></PropertyGroup><ItemDefinitionGroup Condition=\"'$(ProjectName)'=='folly'\"><ProjectReference><LinkLibraryDependencies>true</LinkLibraryDependencies></ProjectReference></ItemDefinitionGroup><PropertyGroup><PlatformToolset>v140")
set(MSVC_IS_2017 OFF)
+elseif ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
+ message("Folly is being built with Ninja, so assuming VS 2017 is being used.")
+ set(MSVC_IS_2017 ON)
else()
message(FATAL_ERROR "This build script only supports building Folly on 64-bit Windows with Visual Studio 2015 or Visual Studio 2017.")
endif()