From c2e28878d8f88359599da03080fbbe71dac2e80f Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Wed, 3 May 2017 09:28:45 -0700 Subject: [PATCH] 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 --- CMake/FindGFlags.cmake | 2 +- CMake/FollyCompiler.cmake | 4 +++- CMakeLists.txt | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMake/FindGFlags.cmake b/CMake/FindGFlags.cmake index 167bdd4b..3217c6fa 100755 --- a/CMake/FindGFlags.cmake +++ b/CMake/FindGFlags.cmake @@ -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) diff --git a/CMake/FollyCompiler.cmake b/CMake/FollyCompiler.cmake index e01f6569..29d2ca2e 100755 --- a/CMake/FollyCompiler.cmake +++ b/CMake/FollyCompiler.cmake @@ -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 + $<$:/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. diff --git a/CMakeLists.txt b/CMakeLists.txt index 36701464..38886d65 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 "v141truev141") + set(MSVC_IS_2017 ON) elseif ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 14 2015 Win64") set(CMAKE_GENERATOR_TOOLSET "v140truev140") + 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() -- 2.34.1