Commit c2e28878 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Fix a couple of issues with the CMake script

Summary:
The first issue is that I was missing a `G` in `LIBGFLAGS_INCLUDE_DIR` meaning that it always claimed it couldn't find gflags even though it did, and worked just fine anyways.
The second issue is that it was passing `/permissive-` to MSVC 2015 builds, even though MSVC 2015 doesn't support the permissive flag.

Reviewed By: yfeldblum

Differential Revision: D4988813

fbshipit-source-id: f1ea009226baee54032409ce7add3c41f1fe7a19
parent 58a70372
......@@ -18,6 +18,6 @@ FIND_LIBRARY(LIBGFLAGS_LIBRARY gflags)
# handle the QUIETLY and REQUIRED arguments and set LIBGFLAGS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGFLAGS DEFAULT_MSG LIBGFLAGS_LIBRARY LIBFLAGS_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGFLAGS DEFAULT_MSG LIBGFLAGS_LIBRARY LIBGFLAGS_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBGFLAGS_LIBRARY LIBGFLAGS_INCLUDE_DIR)
......@@ -54,7 +54,9 @@ function(apply_folly_compile_options_to_target THETARGET)
/Zc:strictStrings # Don't allow conversion from a string literal to mutable characters.
/Zc:threadSafeInit # Enable thread-safe function-local statics initialization.
/Zc:throwingNew # Assume operator new throws on failure.
/permissive- # Be mean, don't allow bad non-standard stuff (C++/CLI, __declspec, etc. are all left intact).
# This is only supported by MSVC 2017
$<$<BOOL:${MSVC_IS_2017}>:/permissive-> # Be mean, don't allow bad non-standard stuff (C++/CLI, __declspec, etc. are all left intact).
PRIVATE
/bigobj # Support objects with > 65k sections. Needed due to templates.
/favor:${MSVC_FAVORED_ARCHITECTURE} # Architecture to prefer when generating code.
......
......@@ -7,8 +7,10 @@ cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)
# the alternatives are far, far worse.
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio 15( 2017)? Win64")
set(CMAKE_GENERATOR_TOOLSET "v141</PlatformToolset></PropertyGroup><ItemDefinitionGroup Condition=\"'$(ProjectName)'=='folly'\"><ProjectReference><LinkLibraryDependencies>true</LinkLibraryDependencies></ProjectReference></ItemDefinitionGroup><PropertyGroup><PlatformToolset>v141")
set(MSVC_IS_2017 ON)
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)
else()
message(FATAL_ERROR "This build script only supports building Folly on 64-bit Windows with Visual Studio 2015 or Visual Studio 2017.")
endif()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment