From ab21322d7285494f5c4609b3b549fe707a1c54e7 Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Thu, 11 Jan 2018 18:24:07 -0800 Subject: [PATCH] cmake: fix error message on non-Windows platform Summary: Building folly with cmake is only supported on Windows for now. This fixes cmake on non-Windows platforms to fail with a helpful message telling people to use autoconf. This message was in place before, but was after an MSVC version check preventing it from appearing. Reviewed By: meyering Differential Revision: D6707328 fbshipit-source-id: a28a07ab0da41d605b11d93bba40f33520c5f57e --- CMakeLists.txt | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6309aa06..a5dcf63c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,20 +16,30 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) project(${PACKAGE_NAME} CXX) -if (MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) - set(MSVC_IS_2017 ON) -elseif (MSVC_VERSION EQUAL 1900) - 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. MSVC version '${MSVC_VERSION}' is not supported.") -endif() - # Check target architecture if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8) message(FATAL_ERROR "Folly requires a 64bit target architecture.") endif() -if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") - message(FATAL_ERROR "The CMake build should only be used on Windows. For every other platform, use the makefile.") + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + if (MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) + set(MSVC_IS_2017 ON) + elseif (MSVC_VERSION EQUAL 1900) + 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. " + "MSVC version '${MSVC_VERSION}' is not supported." + ) + endif() +else() + message( + FATAL_ERROR + "The CMake build should only be used on Windows. " + "For every other platform, use autoconf." + ) endif() set(FOLLY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/folly") -- 2.34.1