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
# 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)
/Zc:strictStrings # Don't allow conversion from a string literal to mutable characters.\r
/Zc:threadSafeInit # Enable thread-safe function-local statics initialization.\r
/Zc:throwingNew # Assume operator new throws on failure.\r
- /permissive- # Be mean, don't allow bad non-standard stuff (C++/CLI, __declspec, etc. are all left intact).\r
+\r
+ # This is only supported by MSVC 2017\r
+ $<$<BOOL:${MSVC_IS_2017}>:/permissive-> # Be mean, don't allow bad non-standard stuff (C++/CLI, __declspec, etc. are all left intact).\r
PRIVATE\r
/bigobj # Support objects with > 65k sections. Needed due to templates.\r
/favor:${MSVC_FAVORED_ARCHITECTURE} # Architecture to prefer when generating code.\r
# 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()