cmake: add more checks for folly-config.h generation
authorAdam Simpkins <simpkins@fb.com>
Fri, 19 Jan 2018 04:43:15 +0000 (20:43 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 19 Jan 2018 05:04:33 +0000 (21:04 -0800)
Summary:
Update the CMake build files to perform additional checks to set configuration
macros in folly-config.h

I believe this should largely bring the CMake build on-par with (or even better
than) the autoconf build scripts.  I believe that the CMake build scripts now
perform all of the checks necessary to set macros in folly-config.h correctly.

The autoconf-based configure script also appears to have a number of bugs:
in several places it accidentally uses different macro names than the ones
checked in the source code.  Some of it's checks are also broken, and fail to
detect features correctly due to compilation errors in the check.

Reviewed By: yfeldblum

Differential Revision: D6735699

fbshipit-source-id: 5ce48f1deddd63c9d52fcccd5d5ccf6ca35e9a0d

CMake/FollyConfigChecks.cmake
CMake/folly-config.h.cmake
CMake/folly-deps.cmake
CMakeLists.txt

index b7da815..3dda37c 100644 (file)
@@ -3,16 +3,35 @@ include(CheckCXXSourceRuns)
 include(CheckFunctionExists)
 include(CheckIncludeFile)
 include(CheckSymbolExists)
+include(CheckTypeSize)
+include(CheckCXXCompilerFlag)
 
 CHECK_INCLUDE_FILE_CXX(malloc.h FOLLY_HAVE_MALLOC_H)
 CHECK_INCLUDE_FILE_CXX(bits/functexcept.h FOLLY_HAVE_BITS_FUNCTEXCEPT_H)
+CHECK_INCLUDE_FILE_CXX(bits/c++config.h FOLLY_HAVE_BITS_CXXCONFIG_H)
+CHECK_INCLUDE_FILE_CXX(features.h FOLLY_HAVE_FEATURES_H)
+CHECK_INCLUDE_FILE_CXX(linux/membarrier.h FOLLY_HAVE_LINUX_MEMBARRIER_H)
+CHECK_INCLUDE_FILE_CXX(jemalloc/jemalloc.h FOLLY_USE_JEMALLOC)
 
-if (FOLLY_HAVE_PTHREAD)
-  set(CMAKE_REQUIRED_LIBRARIES
-      "${CMAKE_REQUIRED_LIBRARIES} ${LIBPTHREAD_LIBRARIES}")
-  set(CMAKE_REQUIRED_INCLUDES
-      "${CMAKE_REQUIRED_INCLUDES} ${LIBPTHREAD_INCLUDE_DIRS}")
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
+  # clang only rejects unknown warning flags if -Werror=unknown-warning-option
+  # is also specified.
+  CHECK_CXX_COMPILER_FLAG(
+    -Werror=unknown-warning-option
+    COMPILER_HAS_UNKNOWN_WARNING_OPTION)
+  if (COMPILER_HAS_UNKNOWN_WARNING_OPTION)
+    list(APPEND CMAKE_REQUIRED_FLAGS -Werror=unknown-warning-option)
+  endif()
+
+  CHECK_CXX_COMPILER_FLAG(-Wshadow-local COMPILER_HAS_W_SHADOW_LOCAL)
+  CHECK_CXX_COMPILER_FLAG(
+    -Wshadow-compatible-local
+    COMPILER_HAS_W_SHADOW_COMPATIBLE_LOCAL)
+  if (COMPILER_HAS_W_SHADOW_LOCAL AND COMPILER_HAS_W_SHADOW_COMPATIBLE_LOCAL)
+    set(FOLLY_HAVE_SHADOW_LOCAL_WARNINGS ON)
+  endif()
 endif()
+
 check_symbol_exists(pthread_atfork pthread.h FOLLY_HAVE_PTHREAD_ATFORK)
 
 # Unfortunately check_symbol_exists() does not work for memrchr():
@@ -22,6 +41,12 @@ check_symbol_exists(preadv sys/uio.h FOLLY_HAVE_PREADV)
 check_symbol_exists(pwritev sys/uio.h FOLLY_HAVE_PWRITEV)
 check_symbol_exists(clock_gettime time.h FOLLY_HAVE_CLOCK_GETTIME)
 
+check_function_exists(
+  cplus_demangle_v3_callback
+  FOLLY_HAVE_CPLUS_DEMANGLE_V3_CALLBACK
+)
+check_function_exists(malloc_usable_size FOLLY_HAVE_MALLOC_USABLE_SIZE)
+
 check_cxx_source_compiles("
   #pragma GCC diagnostic error \"-Wattributes\"
   extern \"C\" void (*test_ifunc(void))() { return 0; }
@@ -59,3 +84,128 @@ check_cxx_source_compiles("
   }"
   FOLLY_HAVE_WEAK_SYMBOLS
 )
+check_cxx_source_runs("
+  #include <dlfcn.h>
+  int main() {
+    void *h = dlopen(\"linux-vdso.so.1\", RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
+    if (h == nullptr) {
+      return -1;
+    }
+    dlclose(h);
+    return 0;
+  }"
+  FOLLY_HAVE_LINUX_VDSO
+)
+
+check_type_size(__int128 INT128_SIZE LANGUAGE CXX)
+if (NOT INT128_SIZE STREQUAL "")
+  set(FOLLY_HAVE_INT128_T ON)
+  check_cxx_source_compiles("
+    #include <type_traits>
+    static_assert(
+      ::std::is_same<::std::make_signed<unsigned __int128>::type,
+                     __int128>::value,
+      \"signed form of \`unsigned __uint128\` must be \`__int128\`.\");
+    int main() { return 0; }"
+    HAVE_INT128_TRAITS
+  )
+  if (HAVE_INT128_TRAITS)
+    set(FOLLY_SUPPLY_MISSING_INT128_TRAITS OFF)
+  else()
+    set(FOLLY_SUPPLY_MISSING_INT128_TRAITS ON)
+  endif()
+endif()
+
+check_cxx_source_runs("
+  #include <cstddef>
+  #include <cwchar>
+  int main(int argc, char** argv) {
+    return wcstol(L\"01\", nullptr, 10) == 1 ? 0 : 1;
+  }"
+  FOLLY_HAVE_WCHAR_SUPPORT
+)
+
+check_cxx_source_compiles("
+  #include <ext/random>
+  int main(int argc, char** argv) {
+    __gnu_cxx::sfmt19937 rng;
+    return 0;
+  }"
+  FOLLY_HAVE_EXTRANDOM_SFMT19937
+)
+
+check_cxx_source_compiles("
+  #include <type_traits>
+  #if !_LIBCPP_VERSION
+  #error No libc++
+  #endif
+  void func() {}"
+  FOLLY_USE_LIBCPP
+)
+
+check_cxx_source_runs("
+  #include <string.h>
+  #include <errno.h>
+  int main(int argc, char** argv) {
+    char buf[1024];
+    buf[0] = 0;
+    int ret = strerror_r(ENOMEM, buf, sizeof(buf));
+    return ret;
+  }"
+  FOLLY_HAVE_XSI_STRERROR_R
+)
+
+check_cxx_source_runs("
+  #include <stdarg.h>
+  #include <stdio.h>
+
+  int call_vsnprintf(const char* fmt, ...) {
+    char buf[256];
+    va_list ap;
+    va_start(ap, fmt);
+    int result = vsnprintf(buf, sizeof(buf), fmt, ap);
+    va_end(ap);
+    return result;
+  }
+
+  int main(int argc, char** argv) {
+    return call_vsnprintf(\"%\", 1) < 0 ? 0 : 1;
+  }"
+  HAVE_VSNPRINTF_ERRORS
+)
+
+if (FOLLY_HAVE_LIBGFLAGS)
+  # Older releases of gflags used the namespace "gflags"; newer releases
+  # use "google" but also make symbols available in the deprecated "gflags"
+  # namespace too.  The folly code internally uses "gflags" unless we tell it
+  # otherwise.
+  check_cxx_source_compiles("
+    #include <gflags/gflags.h>
+    int main() {
+      gflags::GetArgv();
+      return 0;
+    }
+    "
+    GFLAGS_NAMESPACE_IS_GFLAGS
+  )
+  if (GFLAGS_NAMESPACE_IS_GFLAGS)
+    set(FOLLY_UNUSUAL_GFLAGS_NAMESPACE OFF)
+    set(FOLLY_GFLAGS_NAMESPACE gflags)
+  else()
+    set(FOLLY_UNUSUAL_GFLAGS_NAMESPACE ON)
+    set(FOLLY_GFLAGS_NAMESPACE google)
+  endif()
+endif()
+
+set(FOLLY_USE_SYMBOLIZER OFF)
+CHECK_INCLUDE_FILE_CXX(elf.h FOLLY_HAVE_ELF_H)
+find_library(UNWIND_LIBRARIES NAMES unwind)
+if (UNWIND_LIBRARIES)
+  list(APPEND FOLLY_LINK_LIBRARIES ${UNWIND_LIBRARIES})
+  list(APPEND CMAKE_REQUIRED_LIBRARIES ${UNWIND_LIBRARIES})
+endif()
+check_function_exists(backtrace FOLLY_HAVE_BACKTRACE)
+if (FOLLY_HAVE_ELF_H AND FOLLY_HAVE_BACKTRACE AND LIBDWARF_FOUND)
+  set(FOLLY_USE_SYMBOLIZER ON)
+endif()
+message(STATUS "Setting FOLLY_USE_SYMBOLIZER: ${FOLLY_USE_SYMBOLIZER}")
index 744cfc6..92e397f 100755 (executable)
 
 #pragma once
 
+#if !defined(FOLLY_MOBILE)
+#if defined(__ANDROID__) || \
+    (defined(__APPLE__) &&  \
+     (TARGET_IPHONE_SIMULATOR || TARGET_OS_SIMULATOR || TARGET_OS_IPHONE))
+#define FOLLY_MOBILE 1
+#else
+#define FOLLY_MOBILE 0
+#endif
+#endif // FOLLY_MOBILE
+
 #cmakedefine FOLLY_HAVE_PTHREAD 1
 #cmakedefine FOLLY_HAVE_PTHREAD_ATFORK 1
 
-#define FOLLY_HAVE_LIBGFLAGS 1
-#define FOLLY_UNUSUAL_GFLAGS_NAMESPACE 1
-#define FOLLY_GFLAGS_NAMESPACE google
+#cmakedefine FOLLY_HAVE_LIBGFLAGS 1
+#cmakedefine FOLLY_UNUSUAL_GFLAGS_NAMESPACE 1
+#cmakedefine FOLLY_GFLAGS_NAMESPACE @FOLLY_GFLAGS_NAMESPACE@
+
+#cmakedefine FOLLY_HAVE_LIBGLOG 1
 
 #cmakedefine FOLLY_HAVE_MALLOC_H 1
 #cmakedefine FOLLY_HAVE_BITS_FUNCTEXCEPT_H 1
+#cmakedefine FOLLY_HAVE_BITS_CXXCONFIG_H 1
+#cmakedefine FOLLY_HAVE_FEATURES_H 1
+#cmakedefine FOLLY_HAVE_LINUX_MEMBARRIER_H 1
+#cmakedefine FOLLY_USE_JEMALLOC 1
+
+#if FOLLY_HAVE_FEATURES_H
+#include <features.h>
+#endif
 
 #cmakedefine FOLLY_HAVE_MEMRCHR 1
 #cmakedefine FOLLY_HAVE_PREADV 1
 #cmakedefine FOLLY_HAVE_PWRITEV 1
 #cmakedefine FOLLY_HAVE_CLOCK_GETTIME 1
+#cmakedefine FOLLY_HAVE_CPLUS_DEMANGLE_V3_CALLBACK 1
 
 #cmakedefine FOLLY_HAVE_IFUNC 1
 #cmakedefine FOLLY_HAVE_STD__IS_TRIVIALLY_COPYABLE 1
 #cmakedefine FOLLY_HAVE_UNALIGNED_ACCESS 1
 #cmakedefine FOLLY_HAVE_VLA 1
 #cmakedefine FOLLY_HAVE_WEAK_SYMBOLS 1
+#cmakedefine FOLLY_HAVE_LINUX_VDSO 1
+#cmakedefine FOLLY_HAVE_MALLOC_USABLE_SIZE 1
+#cmakedefine FOLLY_HAVE_INT128_T 1
+#cmakedefine FOLLY_SUPPLY_MISSING_INT128_TRAITS 1
+#cmakedefine FOLLY_HAVE_WCHAR_SUPPORT 1
+#cmakedefine FOLLY_HAVE_EXTRANDOM_SFMT19937 1
+#cmakedefine FOLLY_USE_LIBCPP 1
+#cmakedefine FOLLY_HAVE_XSI_STRERROR_R 1
+#cmakedefine HAVE_VSNPRINTF_ERRORS 1
 
 #define FOLLY_VERSION "${PACKAGE_VERSION}"
 
-//#define FOLLY_HAVE_LIBLZ4 1
-//#define FOLLY_HAVE_LIBLZMA 1
-//#define FOLLY_HAVE_LIBSNAPPY 1
-//#define FOLLY_HAVE_LIBZ 1
-//#define FOLLY_HAVE_LIBZSTD 1
+#cmakedefine FOLLY_HAVE_LIBDWARF_DWARF_H 1
+#cmakedefine FOLLY_USE_SYMBOLIZER 1
+#define FOLLY_DEMANGLE_MAX_SYMBOL_SIZE 1024
+
+#cmakedefine FOLLY_HAVE_SHADOW_LOCAL_WARNINGS 1
+
+#cmakedefine FOLLY_HAVE_LIBLZ4 1
+#cmakedefine FOLLY_HAVE_LIBLZMA 1
+#cmakedefine FOLLY_HAVE_LIBSNAPPY 1
+#cmakedefine FOLLY_HAVE_LIBZ 1
+#cmakedefine FOLLY_HAVE_LIBZSTD 1
+#cmakedefine FOLLY_HAVE_LIBBZ2 1
index 9dedda6..409fa55 100755 (executable)
@@ -1,3 +1,5 @@
+include(CheckCXXSourceCompiles)
+
 find_package(Boost 1.55.0 MODULE
   COMPONENTS
     context
@@ -10,23 +12,131 @@ find_package(Boost 1.55.0 MODULE
     thread
   REQUIRED
 )
+set(FOLLY_SHINY_DEPENDENCIES
+  Boost::chrono
+  Boost::context
+  Boost::date_time
+  Boost::filesystem
+  Boost::program_options
+  Boost::regex
+  Boost::system
+  OpenSSL::SSL
+  OpenSSL::Crypto
+)
 
 find_package(DoubleConversion MODULE REQUIRED)
+list(APPEND FOLLY_LINK_LIBRARIES ${DOUBLE_CONVERSION_LIBRARY})
+list(APPEND FOLLY_INCLUDE_DIRECTORIES ${DOUBLE_CONVERSION_INCLUDE_DIR})
 
-find_package(gflags CONFIG)
-if(NOT TARGET gflags)
-  find_package(GFlags MODULE REQUIRED)
+set(FOLLY_HAVE_LIBGFLAGS OFF)
+find_package(gflags CONFIG QUIET)
+if (gflags_FOUND)
+  message(STATUS "Found gflags from package config")
+  set(FOLLY_HAVE_LIBGFLAGS ON)
+  set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} gflags)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARIES})
+  list(APPEND CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
+else()
+  find_package(GFlags MODULE)
+  set(FOLLY_HAVE_LIBGFLAGS ${LIBGFLAGS_FOUND})
+  list(APPEND FOLLY_LINK_LIBRARIES ${LIBGFLAGS_LIBRARY})
+  list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBGFLAGS_INCLUDE_DIR})
+  list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBGFLAGS_LIBRARY})
+  list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBGFLAGS_INCLUDE_DIR})
 endif()
 
-find_package(glog CONFIG)
-if(NOT TARGET glog::glog)
-  find_package(GLog MODULE REQUIRED)
+set(FOLLY_HAVE_LIBGLOG OFF)
+find_package(glog CONFIG QUIET)
+if (glog_FOUND)
+  message(STATUS "Found glog from package config")
+  set(FOLLY_HAVE_LIBGLOG ON)
+  set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} glog::glog)
+else()
+  find_package(GLog MODULE)
+  set(FOLLY_HAVE_LIBGLOG ${LIBGLOG_FOUND})
+  list(APPEND FOLLY_LINK_LIBRARIES ${LIBGLOG_LIBRARY})
+  list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBGLOG_INCLUDE_DIR})
 endif()
 
-find_package(Libevent CONFIG)
-if(NOT TARGET event)
+find_package(Libevent CONFIG QUIET)
+if(TARGET event)
+  message(STATUS "Found libevent from package config")
+  set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} event)
+else()
   find_package(LibEvent MODULE REQUIRED)
+  list(APPEND FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB})
+  list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBEVENT_INCLUDE_DIR})
 endif()
 
 find_package(OpenSSL MODULE REQUIRED)
+
 find_package(PThread MODULE)
+set(FOLLY_HAVE_PTHREAD ${LIBPTHREAD_FOUND})
+if (LIBPTHREAD_FOUND)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBPTHREAD_LIBRARIES})
+  list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBPTHREAD_INCLUDE_DIRS})
+  list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBPTHREAD_INCLUDE_DIRS})
+  list(APPEND FOLLY_LINK_LIBRARIES ${LIBPTHREAD_LIBRARIES})
+endif()
+
+find_package(ZLIB MODULE)
+set(FOLLY_HAVE_LIBZ ${ZLIB_FOUND})
+if (ZLIB_FOUND)
+  list(APPEND FOLLY_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRS})
+  list(APPEND FOLLY_LINK_LIBRARIES ${ZLIB_LIBRARIES})
+endif()
+
+find_package(BZip2 MODULE)
+set(FOLLY_HAVE_LIBBZ2 ${BZIP2_FOUND})
+if (BZIP2_FOUND)
+  list(APPEND FOLLY_INCLUDE_DIRECTORIES ${BZIP2_INCLUDE_DIRS})
+  list(APPEND FOLLY_LINK_LIBRARIES ${BZIP2_LIBRARIES})
+endif()
+
+find_package(LibLZMA MODULE)
+set(FOLLY_HAVE_LIBLZMA ${LIBLZMA_FOUND})
+if (LIBLZMA_FOUND)
+  list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIRS})
+  list(APPEND FOLLY_LINK_LIBRARIES ${LIBLZMA_LIBRARIES})
+endif()
+
+# TODO: We should ideally build FindXXX modules for the following libraries,
+# rather than the simple checks we currently have here.
+CHECK_INCLUDE_FILE_CXX(zstd.h FOLLY_HAVE_LIBZSTD)
+if (FOLLY_HAVE_LIBZSTD)
+  list(APPEND FOLLY_LINK_LIBRARIES zstd)
+endif()
+CHECK_INCLUDE_FILE_CXX(snappy.h FOLLY_HAVE_LIBSNAPPY)
+if (FOLLY_HAVE_LIBSNAPPY)
+  list(APPEND FOLLY_LINK_LIBRARIES snappy)
+endif()
+CHECK_INCLUDE_FILE_CXX(lz4.h FOLLY_HAVE_LIBLZ4)
+if (FOLLY_HAVE_LIBLZ4)
+  list(APPEND FOLLY_LINK_LIBRARIES lz4)
+endif()
+
+message(STATUS "Looking for libdwarf")
+find_library(LIBDWARF_LIBRARIES NAMES dwarf)
+if (LIBDWARF_LIBRARIES)
+  message(STATUS "Looking for libdwarf - found: ${LIBDWARF_LIBRARIES}")
+  set(LIBDWARF_FOUND ON)
+  CHECK_INCLUDE_FILE_CXX(libdwarf/dwarf.h FOLLY_HAVE_LIBDWARF_DWARF_H)
+  list(APPEND FOLLY_LINK_LIBRARIES ${LIBDWARF_LIBRARIES})
+else()
+  message(STATUS "Looking for libdwarf - not found")
+endif()
+
+message(STATUS "Looking for libiberty")
+find_library(LIBIBERTY_LIBRARIES NAMES iberty_pic iberty)
+if (LIBIBERTY_LIBRARIES)
+  message(STATUS "Looking for libiberty - found: ${LIBIBERTY_LIBRARIES}")
+  set(LIBIBERTY_FOUND ON)
+  list(APPEND FOLLY_LINK_LIBRARIES ${LIBIBERTY_LIBRARIES})
+  list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBIBERTY_LIBRARIES})
+else()
+  message(STATUS "Looking for libiberty - not found")
+  set(LIBIBERTY_FOUND OFF)
+endif()
+
+list(APPEND FOLLY_LINK_LIBRARIES ${CMAKE_DL_LIBS})
+list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
index dee718b..e8d1b41 100755 (executable)
@@ -16,7 +16,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
 project(${PACKAGE_NAME} CXX)
 
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
   # Check target architecture
   if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
     message(FATAL_ERROR "Folly requires a 64bit target architecture.")
@@ -78,11 +78,8 @@ add_custom_command(
 )
 
 include(folly-deps) # Find the required packages
-if (LIBPTHREAD_FOUND)
-  set(FOLLY_HAVE_PTHREAD ON)
-endif()
 
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
   include(FollyCompilerMSVC)
 else()
   include(FollyCompilerUnix)
@@ -107,7 +104,6 @@ REMOVE_MATCHES_FROM_LISTS(files hfiles
     "/experimental/hazptr/bench/"
     "/experimental/hazptr/example/"
     "/experimental/logging/example/"
-    "/experimental/symbolizer/"
     "/futures/exercises/"
     "/test/"
     "/tools/"
@@ -118,12 +114,12 @@ REMOVE_MATCHES_FROM_LISTS(files hfiles
 )
 list(REMOVE_ITEM files
   ${FOLLY_DIR}/Poly.cpp
-  ${FOLLY_DIR}/Subprocess.cpp
   ${FOLLY_DIR}/SingletonStackTrace.cpp
   ${FOLLY_DIR}/experimental/JSONSchemaTester.cpp
   ${FOLLY_DIR}/experimental/RCUUtils.cpp
   ${FOLLY_DIR}/experimental/io/AsyncIO.cpp
   ${FOLLY_DIR}/experimental/io/HugePageUtil.cpp
+  ${FOLLY_DIR}/experimental/symbolizer/ElfUtil.cpp
   ${FOLLY_DIR}/futures/test/Benchmark.cpp
 )
 list(REMOVE_ITEM hfiles
@@ -140,6 +136,17 @@ list(REMOVE_ITEM hfiles
   ${FOLLY_DIR}/poly/Nullable.h
   ${FOLLY_DIR}/poly/Regular.h
 )
+if (NOT FOLLY_USE_SYMBOLIZER)
+  REMOVE_MATCHES_FROM_LISTS(files hfiles
+    MATCHES
+      "/experimental/symbolizer/"
+  )
+endif()
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+list(REMOVE_ITEM files
+  ${FOLLY_DIR}/Subprocess.cpp
+)
+endif()
 
 add_library(folly_base OBJECT
   ${files} ${hfiles}
@@ -160,59 +167,12 @@ source_group("folly\\build" FILES
   ${CMAKE_CURRENT_BINARY_DIR}/folly/build/GroupVarintTables.cpp
 )
 
-set(FOLLY_SHINY_DEPENDENCIES
-  Boost::chrono
-  Boost::context
-  Boost::date_time
-  Boost::filesystem
-  Boost::program_options
-  Boost::regex
-  Boost::system
-  OpenSSL::SSL
-  OpenSSL::Crypto
-)
-
-set(FOLLY_LINK_LIBRARIES
-  ${DOUBLE_CONVERSION_LIBRARY}
-)
-
-set(FOLLY_INCLUDE_DIRECTORIES
-  ${DOUBLE_CONVERSION_INCLUDE_DIR}
-)
-
-if(TARGET gflags)
-  set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} gflags)
-else()
-  set(FOLLY_LINK_LIBRARIES ${FOLLY_LINK_LIBRARIES} ${LIBGFLAGS_LIBRARY})
-  set(FOLLY_INCLUDE_DIRECTORIES ${FOLLY_INCLUDE_DIRECTORIES} ${LIBGFLAGS_INCLUDE_DIR})
-endif()
-
-if(TARGET glog::glog)
-  set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} glog::glog)
-else()
-  set(FOLLY_LINK_LIBRARIES ${FOLLY_LINK_LIBRARIES} ${LIBGLOG_LIBRARY})
-  set(FOLLY_INCLUDE_DIRECTORIES ${FOLLY_INCLUDE_DIRECTORIES} ${LIBGLOG_INCLUDE_DIR})
-endif()
-
-if(TARGET event)
-  set(FOLLY_SHINY_DEPENDENCIES ${FOLLY_SHINY_DEPENDENCIES} event)
-else()
-  set(FOLLY_LINK_LIBRARIES ${FOLLY_LINK_LIBRARIES} ${LIBEVENT_LIB})
-  set(FOLLY_INCLUDE_DIRECTORIES ${FOLLY_INCLUDE_DIRECTORIES} ${LIBEVENT_INCLUDE_DIR})
-endif()
-
-
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
   set(FOLLY_LINK_LIBRARIES
     ${FOLLY_LINK_LIBRARIES}
     Iphlpapi.lib
     Ws2_32.lib
   )
-else()
-  set(FOLLY_LINK_LIBRARIES
-    ${FOLLY_LINK_LIBRARIES}
-    dl
-  )
 endif()
 
 set(FOLLY_LINK_LIBRARIES
@@ -233,7 +193,6 @@ endforeach()
 
 if (FOLLY_HAVE_PTHREAD)
   target_include_directories(folly_base PUBLIC ${LIBPTHREAD_INCLUDE_DIRS})
-  list(APPEND FOLLY_LINK_LIBRARIES ${LIBPTHREAD_LIBRARIES})
 endif()
 
 # Now to generate the fingerprint tables