cmake: remove DOS-style line endings
authorAdam Simpkins <simpkins@fb.com>
Sat, 13 Jan 2018 00:03:02 +0000 (16:03 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 13 Jan 2018 00:07:43 +0000 (16:07 -0800)
Summary:
A number of the files in CMake/ had inconsistent line-endings.  This updates
files using DOS-style CRLF line endings to just use CR instead.  On Windows,
git is capable of automatically changing CR to CRLF when checking out the
repository working directory.

Reviewed By: meyering

Differential Revision: D6714717

fbshipit-source-id: 82adccf4e522d38fd1cb420869f62e52dbd6c5f1

CMake/FollyCompilerMSVC.cmake
CMake/FollyFunctions.cmake
CMake/folly-config.h.cmake
CMake/folly-deps.cmake

index 3c8093755c75c18bdcb3d2d301f777b4420eef40..2411d4a9c0a6eb8bd18b0ba6f5cf79ed9ae649d4 100755 (executable)
-# Some additional configuration options.\r
-option(MSVC_ENABLE_ALL_WARNINGS "If enabled, pass /Wall to the compiler." ON)\r
-option(MSVC_ENABLE_CPP_LATEST "If enabled, pass /std:c++latest to the compiler" ON)\r
-option(MSVC_ENABLE_DEBUG_INLINING "If enabled, enable inlining in the debug configuration. This allows /Zc:inline to be far more effective." OFF)\r
-option(MSVC_ENABLE_FAST_LINK "If enabled, pass /DEBUG:FASTLINK to the linker. This makes linking faster, but the gtest integration for Visual Studio can't currently handle the .pdbs generated." OFF)\r
-option(MSVC_ENABLE_LEAN_AND_MEAN_WINDOWS "If enabled, define WIN32_LEAN_AND_MEAN to include a smaller subset of Windows.h" ON)\r
-option(MSVC_ENABLE_LTCG "If enabled, use Link Time Code Generation for Release builds." OFF)\r
-option(MSVC_ENABLE_PARALLEL_BUILD "If enabled, build multiple source files in parallel." ON)\r
-option(MSVC_ENABLE_STATIC_ANALYSIS "If enabled, do more complex static analysis and generate warnings appropriately." OFF)\r
-option(MSVC_USE_STATIC_RUNTIME "If enabled, build against the static, rather than the dynamic, runtime." OFF)\r
-\r
-# Alas, option() doesn't support string values.\r
-set(MSVC_FAVORED_ARCHITECTURE "blend" CACHE STRING "One of 'blend', 'AMD64', 'INTEL64', or 'ATOM'. This tells the compiler to generate code optimized to run best on the specified architecture.")\r
-# Add a pretty drop-down selector for these values when using the GUI.\r
-set_property(\r
-  CACHE MSVC_FAVORED_ARCHITECTURE\r
-  PROPERTY STRINGS\r
-    blend\r
-    AMD64\r
-    ATOM\r
-    INTEL64\r
-)\r
-# Validate, and then add the favored architecture.\r
-if (NOT MSVC_FAVORED_ARCHITECTURE STREQUAL "blend" AND NOT MSVC_FAVORED_ARCHITECTURE STREQUAL "AMD64" AND NOT MSVC_FAVORED_ARCHITECTURE STREQUAL "INTEL64" AND NOT MSVC_FAVORED_ARCHITECTURE STREQUAL "ATOM")\r
-  message(FATAL_ERROR "MSVC_FAVORED_ARCHITECTURE must be set to one of exactly, 'blend', 'AMD64', 'INTEL64', or 'ATOM'! Got '${MSVC_FAVORED_ARCHITECTURE}' instead!")\r
-endif()\r
-\r
-############################################################\r
-# We need to adjust a couple of the default option sets.\r
-############################################################\r
-\r
-# If the static runtime is requested, we have to\r
-# overwrite some of CMake's defaults.\r
-if (MSVC_USE_STATIC_RUNTIME)\r
-  foreach(flag_var\r
-      CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE\r
-      CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO\r
-      CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE\r
-      CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)\r
-    if (${flag_var} MATCHES "/MD")\r
-      string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")\r
-    endif()\r
-  endforeach()\r
-endif()\r
-\r
-# The Ninja generator doesn't de-dup the exception mode flag, so remove the\r
-# default flag so that MSVC doesn't warn about it on every single file.\r
-if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")\r
-  foreach(flag_var\r
-      CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE\r
-      CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO\r
-      CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE\r
-      CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)\r
-    if (${flag_var} MATCHES "/EHsc")\r
-      string(REGEX REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}")\r
-    endif()\r
-  endforeach()\r
-endif()\r
-\r
-# In order for /Zc:inline, which speeds up the build significantly, to work\r
-# we need to remove the /Ob0 parameter that CMake adds by default, because that\r
-# would normally disable all inlining.\r
-foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG)\r
-  if (${flag_var} MATCHES "/Ob0")\r
-    string(REGEX REPLACE "/Ob0" "" ${flag_var} "${${flag_var}}")\r
-  endif()\r
-endforeach()\r
-\r
-# Apply the option set for Folly to the specified target.\r
-function(apply_folly_compile_options_to_target THETARGET)\r
-  # The general options passed:\r
-  target_compile_options(${THETARGET}\r
-    PUBLIC\r
-      /EHa # Enable both SEH and C++ Exceptions.\r
-      /GF # There are bugs with constexpr StringPiece when string pooling is disabled.\r
-      /Zc:referenceBinding # Disallow temporaries from binding to non-const lvalue references.\r
-      /Zc:rvalueCast # Enforce the standard rules for explicit type conversion.\r
-      /Zc:implicitNoexcept # Enable implicit noexcept specifications where required, such as destructors.\r
-      /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
-\r
-      $<$<BOOL:${MSVC_ENABLE_CPP_LATEST}>:/std:c++latest> # Build in C++ Latest mode if requested.\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
-      /Zc:inline # Have the compiler eliminate unreferenced COMDAT functions and data before emitting the object file.\r
-\r
-      $<$<BOOL:${MSVC_ENABLE_ALL_WARNINGS}>:/Wall> # Enable all warnings if requested.\r
-      $<$<BOOL:${MSVC_ENABLE_PARALLEL_BUILD}>:/MP> # Enable multi-processor compilation if requested.\r
-      $<$<BOOL:${MSVC_ENABLE_STATIC_ANALYSIS}>:/analyze> # Enable static analysis if requested.\r
-\r
-      # Debug builds\r
-      $<$<CONFIG:DEBUG>:\r
-        /Gy- # Disable function level linking.\r
-\r
-        $<$<BOOL:${MSVC_ENABLE_DEBUG_INLINING}>:/Ob2> # Add /Ob2 if allowing inlining in debug mode.\r
-      >\r
-\r
-      # Non-debug builds\r
-      $<$<NOT:$<CONFIG:DEBUG>>:\r
-        /Gw # Optimize global data. (-fdata-sections)\r
-        /Gy # Enable function level linking. (-ffunction-sections)\r
-        /Qpar # Enable parallel code generation.\r
-        /Oi # Enable intrinsic functions.\r
-        /Ot # Favor fast code.\r
-\r
-        $<$<BOOL:${MSVC_ENABLE_LTCG}>:/GL> # Enable link time code generation.\r
-      >\r
-  )\r
-\r
-  target_compile_options(${THETARGET}\r
-    PUBLIC\r
-      /wd4191 # 'type cast' unsafe conversion of function pointers\r
-      /wd4291 # no matching operator delete found\r
-      /wd4309 # '=' truncation of constant value\r
-      /wd4310 # cast truncates constant value\r
-      /wd4366 # result of unary '&' operator may be unaligned\r
-      /wd4587 # behavior change; constructor no longer implicitly called\r
-      /wd4592 # symbol will be dynamically initialized (implementation limitation)\r
-      /wd4628 # digraphs not supported with -Ze\r
-      /wd4723 # potential divide by 0\r
-      /wd4724 # potential mod by 0\r
-      /wd4868 # compiler may not enforce left-to-right evaluation order\r
-      /wd4996 # user deprecated\r
-\r
-      # The warnings that are disabled:\r
-      /wd4068 # Unknown pragma.\r
-      /wd4091 # 'typedef' ignored on left of '' when no variable is declared.\r
-      /wd4146 # Unary minus applied to unsigned type, result still unsigned.\r
-      /wd4800 # Values being forced to bool, this happens many places, and is a "performance warning".\r
-\r
-      # NOTE: glog/logging.h:1116 change to `size_t pcount() const { return size_t(pptr() - pbase()); }`\r
-      # NOTE: gmock/gmock-spec-builders.h:1177 change to `*static_cast<const Action<F>*>(untyped_actions_[size_t(count - 1)]) :`\r
-      # NOTE: gmock/gmock-spec-builders.h:1749 change to `const size_t count = untyped_expectations_.size();`\r
-      # NOTE: gmock/gmock-spec-builders.h:1754 change to `for (size_t i = 0; i < count; i++) {`\r
-      # NOTE: gtest/gtest-printers.h:173 change to `const internal::BiggestInt kBigInt = internal::BiggestInt(value);`\r
-      # NOTE: gtest/internal/gtest-internal.h:890 add `GTEST_DISABLE_MSC_WARNINGS_PUSH_(4365)`\r
-      # NOTE: gtest/internal/gtest-internal.h:894 ass `GTEST_DISABLE_MSC_WARNINGS_POP_()`\r
-      # NOTE: boost/crc.hpp:578 change to `{ return static_cast<unsigned char>(x ^ rem); }`\r
-      # NOTE: boost/regex/v4/match_results.hpp:126 change to `return m_subs[size_type(sub)].length();`\r
-      # NOTE: boost/regex/v4/match_results.hpp:226 change to `return m_subs[size_type(sub)];`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:67 change to `origDayOfMonth_ = short(ymd.day);`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:75 change to `wrap_int2 wi(short(ymd.month));`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:82 change to `day_type resultingEndOfMonthDay(cal_type::end_of_month_day(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int())));`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:85 change to `return date_type(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int()), resultingEndOfMonthDay) - d;`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:87 change to `day_type dayOfMonth = static_cast<unsigned short>(origDayOfMonth_);`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:91 change to `return date_type(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int()), dayOfMonth) - d;`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:98 change to `origDayOfMonth_ = short(ymd.day);`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:106 change to `wrap_int2 wi(short(ymd.month));`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:111 change to `day_type resultingEndOfMonthDay(cal_type::end_of_month_day(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int())));`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:114 change to `return date_type(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int()), resultingEndOfMonthDay) - d;`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:116 change to `day_type dayOfMonth = static_cast<unsigned short>(origDayOfMonth_);`\r
-      # NOTE: boost/date_time/adjust_functors.hpp:120 change to `return date_type(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int()), dayOfMonth) - d;`\r
-      # NOTE: boost/date_time/gregorian_calendar.ipp:81 change to `unsigned long  d = static_cast<unsigned long>(ymd.day + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045);`\r
-      # NOTE: boost/date_time/gregorian/greg_date.hpp:122 change to `unsigned short eom_day =  gregorian_calendar::end_of_month_day(ymd.year, ymd.month);`\r
-      # NOTE: boost/thread/future.hpp:1050 change to `locks[std::ptrdiff_t(i)]=BOOST_THREAD_MAKE_RV_REF(boost::unique_lock<boost::mutex>(futures[i].future_->mutex));`\r
-      # NOTE: boost/thread/future.hpp:1063 change to `locks[std::ptrdiff_t(i)].unlock();`\r
-      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:47 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`\r
-      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:53 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`\r
-      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:64 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`\r
-      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:78 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`\r
-      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:84 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`\r
-      # NOTE: boost/thread/win32/condition_variable.hpp:79 change to `detail::win32::ReleaseSemaphore(semaphore,long(count_to_release),0);`\r
-      # NOTE: boost/thread/win32/condition_variable.hpp:84 change to `release(unsigned(detail::interlocked_read_acquire(&waiters)));`\r
-      # NOTE: boost/algorithm/string/detail/classification.hpp:85 change to `std::size_t Size=std::size_t(::boost::distance(Range));`\r
-      /wd4018 # Signed/unsigned mismatch.\r
-      /wd4365 # Signed/unsigned mismatch.\r
-      /wd4388 # Signed/unsigned mismatch on relative comparison operator.\r
-      /wd4389 # Signed/unsigned mismatch on equality comparison operator.\r
-\r
-      # TODO:\r
-      /wd4100 # Unreferenced formal parameter.\r
-      /wd4459 # Declaration of parameter hides global declaration.\r
-      /wd4505 # Unreferenced local function has been removed.\r
-      /wd4701 # Potentially uninitialized local variable used.\r
-      /wd4702 # Unreachable code.\r
-\r
-      # These warnings are disabled because we've\r
-      # enabled all warnings. If all warnings are\r
-      # not enabled, we still need to disable them\r
-      # for consuming libs.\r
-      /wd4061 # Enum value not handled by a case in a switch on an enum. This isn't very helpful because it is produced even if a default statement is present.\r
-      /wd4127 # Conditional expression is constant.\r
-      /wd4200 # Non-standard extension, zero sized array.\r
-      /wd4201 # Non-standard extension used: nameless struct/union.\r
-      /wd4296 # '<' Expression is always false.\r
-      /wd4316 # Object allocated on the heap may not be aligned to 128.\r
-      /wd4324 # Structure was padded due to alignment specifier.\r
-      /wd4355 # 'this' used in base member initializer list.\r
-      /wd4371 # Layout of class may have changed due to fixes in packing.\r
-      /wd4435 # Object layout under /vd2 will change due to virtual base.\r
-      /wd4514 # Unreferenced inline function has been removed. (caused by /Zc:inline)\r
-      /wd4548 # Expression before comma has no effect. I wouldn't disable this normally, but malloc.h triggers this warning.\r
-      /wd4574 # ifdef'd macro was defined to 0.\r
-      /wd4582 # Constructor is not implicitly called.\r
-      /wd4583 # Destructor is not implicitly called.\r
-      /wd4619 # Invalid warning number used in #pragma warning.\r
-      /wd4623 # Default constructor was implicitly defined as deleted.\r
-      /wd4625 # Copy constructor was implicitly defined as deleted.\r
-      /wd4626 # Assignment operator was implicitly defined as deleted.\r
-      /wd4647 # Behavior change in __is_pod.\r
-      /wd4668 # Macro was not defined, replacing with 0.\r
-      /wd4706 # Assignment within conditional expression.\r
-      /wd4710 # Function was not inlined.\r
-      /wd4711 # Function was selected for automated inlining.\r
-      /wd4714 # Function marked as __forceinline not inlined.\r
-      /wd4820 # Padding added after data member.\r
-      /wd5026 # Move constructor was implicitly defined as deleted.\r
-      /wd5027 # Move assignment operator was implicitly defined as deleted.\r
-      /wd5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file. This is needed because of how boost does things.\r
-\r
-      # Warnings to treat as errors:\r
-      /we4099 # Mixed use of struct and class on same type names.\r
-      /we4129 # Unknown escape sequence. This is usually caused by incorrect escaping.\r
-      /we4566 # Character cannot be represented in current charset. This is remidied by prefixing string with "u8".\r
-\r
-    PRIVATE\r
-      # Warnings disabled for /analyze\r
-      $<$<BOOL:${MSVC_ENABLE_STATIC_ANALYSIS}>:\r
-        /wd6001 # Using uninitialized memory. This is disabled because it is wrong 99% of the time.\r
-        /wd6011 # Dereferencing potentially NULL pointer.\r
-        /wd6031 # Return value ignored.\r
-        /wd6235 # (<non-zero constant> || <expression>) is always a non-zero constant.\r
-        /wd6237 # (<zero> && <expression>) is always zero. <expression> is never evaluated and may have side effects.\r
-        /wd6239 # (<non-zero constant> && <expression>) always evaluates to the result of <expression>.\r
-        /wd6240 # (<expression> && <non-zero constant>) always evaluates to the result of <expression>.\r
-        /wd6246 # Local declaration hides declaration of same name in outer scope.\r
-        /wd6248 # Setting a SECURITY_DESCRIPTOR's DACL to NULL will result in an unprotected object. This is done by one of the boost headers.\r
-        /wd6255 # _alloca indicates failure by raising a stack overflow exception.\r
-        /wd6262 # Function uses more than x bytes of stack space.\r
-        /wd6271 # Extra parameter passed to format function. The analysis pass doesn't recognize %j or %z, even though the runtime does.\r
-        /wd6285 # (<non-zero constant> || <non-zero constant>) is always true.\r
-        /wd6297 # 32-bit value is shifted then cast to 64-bits. The places this occurs never use more than 32 bits.\r
-        /wd6308 # Realloc might return null pointer: assigning null pointer to '<name>', which is passed as an argument to 'realloc', will cause the original memory to leak.\r
-        /wd6326 # Potential comparison of a constant with another constant.\r
-        /wd6330 # Unsigned/signed mismatch when passed as a parameter.\r
-        /wd6340 # Mismatch on sign when passed as format string value.\r
-        /wd6387 # '<value>' could be '0': This does not adhere to the specification for a function.\r
-        /wd28182 # Dereferencing NULL pointer. '<value>' contains the same NULL value as '<expression>'.\r
-        /wd28251 # Inconsistent annotation for function. This is because we only annotate the declaration and not the definition.\r
-        /wd28278 # Function appears with no prototype in scope.\r
-      >\r
-  )\r
-\r
-  # And the extra defines:\r
-  target_compile_definitions(${THETARGET}\r
-    PUBLIC\r
-      _CRT_NONSTDC_NO_WARNINGS # Don't deprecate posix names of functions.\r
-      _CRT_SECURE_NO_WARNINGS # Don't deprecate the non _s versions of various standard library functions, because safety is for chumps.\r
-      _SCL_SECURE_NO_WARNINGS # Don't deprecate the non _s versions of various standard library functions, because safety is for chumps.\r
-      \r
-      _STL_EXTRA_DISABLED_WARNINGS=4774\ 4987\r
-\r
-      $<$<BOOL:${MSVC_ENABLE_CPP_LATEST}>:_HAS_AUTO_PTR_ETC=1> # We're building in C++ 17 or greater mode, but certain dependencies (Boost) still have dependencies on unary_function and binary_function, so we have to make sure not to remove them.\r
-      $<$<BOOL:${MSVC_ENABLE_LEAN_AND_MEAN_WINDOWS}>:WIN32_LEAN_AND_MEAN> # Don't include most of Windows.h\r
-  )\r
-\r
-  # Ignore a warning about an object file not defining any symbols,\r
-  # these are known, and we don't care.\r
-  set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " /ignore:4221")\r
-\r
-  # The options to pass to the linker:\r
-  set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /INCREMENTAL") # Do incremental linking.\r
-  if (NOT $<TARGET_PROPERTY:${THETARGET},TYPE> STREQUAL "STATIC_LIBRARY")\r
-    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /OPT:NOREF") # No unreferenced data elimination.\r
-    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /OPT:NOICF") # No Identical COMDAT folding.\r
-\r
-    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /OPT:REF") # Remove unreferenced functions and data.\r
-    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /OPT:ICF") # Identical COMDAT folding.\r
-  endif()\r
-\r
-  if (MSVC_ENABLE_FAST_LINK)\r
-    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /DEBUG:FASTLINK") # Generate a partial PDB file that simply references the original object and library files.\r
-  endif()\r
-\r
-  # Add /GL to the compiler, and /LTCG to the linker\r
-  # if link time code generation is enabled.\r
-  if (MSVC_ENABLE_LTCG)\r
-    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /LTCG")\r
-  endif()\r
-endfunction()\r
+# Some additional configuration options.
+option(MSVC_ENABLE_ALL_WARNINGS "If enabled, pass /Wall to the compiler." ON)
+option(MSVC_ENABLE_CPP_LATEST "If enabled, pass /std:c++latest to the compiler" ON)
+option(MSVC_ENABLE_DEBUG_INLINING "If enabled, enable inlining in the debug configuration. This allows /Zc:inline to be far more effective." OFF)
+option(MSVC_ENABLE_FAST_LINK "If enabled, pass /DEBUG:FASTLINK to the linker. This makes linking faster, but the gtest integration for Visual Studio can't currently handle the .pdbs generated." OFF)
+option(MSVC_ENABLE_LEAN_AND_MEAN_WINDOWS "If enabled, define WIN32_LEAN_AND_MEAN to include a smaller subset of Windows.h" ON)
+option(MSVC_ENABLE_LTCG "If enabled, use Link Time Code Generation for Release builds." OFF)
+option(MSVC_ENABLE_PARALLEL_BUILD "If enabled, build multiple source files in parallel." ON)
+option(MSVC_ENABLE_STATIC_ANALYSIS "If enabled, do more complex static analysis and generate warnings appropriately." OFF)
+option(MSVC_USE_STATIC_RUNTIME "If enabled, build against the static, rather than the dynamic, runtime." OFF)
+
+# Alas, option() doesn't support string values.
+set(MSVC_FAVORED_ARCHITECTURE "blend" CACHE STRING "One of 'blend', 'AMD64', 'INTEL64', or 'ATOM'. This tells the compiler to generate code optimized to run best on the specified architecture.")
+# Add a pretty drop-down selector for these values when using the GUI.
+set_property(
+  CACHE MSVC_FAVORED_ARCHITECTURE
+  PROPERTY STRINGS
+    blend
+    AMD64
+    ATOM
+    INTEL64
+)
+# Validate, and then add the favored architecture.
+if (NOT MSVC_FAVORED_ARCHITECTURE STREQUAL "blend" AND NOT MSVC_FAVORED_ARCHITECTURE STREQUAL "AMD64" AND NOT MSVC_FAVORED_ARCHITECTURE STREQUAL "INTEL64" AND NOT MSVC_FAVORED_ARCHITECTURE STREQUAL "ATOM")
+  message(FATAL_ERROR "MSVC_FAVORED_ARCHITECTURE must be set to one of exactly, 'blend', 'AMD64', 'INTEL64', or 'ATOM'! Got '${MSVC_FAVORED_ARCHITECTURE}' instead!")
+endif()
+
+############################################################
+# We need to adjust a couple of the default option sets.
+############################################################
+
+# If the static runtime is requested, we have to
+# overwrite some of CMake's defaults.
+if (MSVC_USE_STATIC_RUNTIME)
+  foreach(flag_var
+      CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+      CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+      CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+      CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+    if (${flag_var} MATCHES "/MD")
+      string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+    endif()
+  endforeach()
+endif()
+
+# The Ninja generator doesn't de-dup the exception mode flag, so remove the
+# default flag so that MSVC doesn't warn about it on every single file.
+if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
+  foreach(flag_var
+      CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+      CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+      CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+      CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+    if (${flag_var} MATCHES "/EHsc")
+      string(REGEX REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}")
+    endif()
+  endforeach()
+endif()
+
+# In order for /Zc:inline, which speeds up the build significantly, to work
+# we need to remove the /Ob0 parameter that CMake adds by default, because that
+# would normally disable all inlining.
+foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG)
+  if (${flag_var} MATCHES "/Ob0")
+    string(REGEX REPLACE "/Ob0" "" ${flag_var} "${${flag_var}}")
+  endif()
+endforeach()
+
+# Apply the option set for Folly to the specified target.
+function(apply_folly_compile_options_to_target THETARGET)
+  # The general options passed:
+  target_compile_options(${THETARGET}
+    PUBLIC
+      /EHa # Enable both SEH and C++ Exceptions.
+      /GF # There are bugs with constexpr StringPiece when string pooling is disabled.
+      /Zc:referenceBinding # Disallow temporaries from binding to non-const lvalue references.
+      /Zc:rvalueCast # Enforce the standard rules for explicit type conversion.
+      /Zc:implicitNoexcept # Enable implicit noexcept specifications where required, such as destructors.
+      /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.
+
+      $<$<BOOL:${MSVC_ENABLE_CPP_LATEST}>:/std:c++latest> # Build in C++ Latest mode if requested.
+
+      # 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.
+      /Zc:inline # Have the compiler eliminate unreferenced COMDAT functions and data before emitting the object file.
+
+      $<$<BOOL:${MSVC_ENABLE_ALL_WARNINGS}>:/Wall> # Enable all warnings if requested.
+      $<$<BOOL:${MSVC_ENABLE_PARALLEL_BUILD}>:/MP> # Enable multi-processor compilation if requested.
+      $<$<BOOL:${MSVC_ENABLE_STATIC_ANALYSIS}>:/analyze> # Enable static analysis if requested.
+
+      # Debug builds
+      $<$<CONFIG:DEBUG>:
+        /Gy- # Disable function level linking.
+
+        $<$<BOOL:${MSVC_ENABLE_DEBUG_INLINING}>:/Ob2> # Add /Ob2 if allowing inlining in debug mode.
+      >
+
+      # Non-debug builds
+      $<$<NOT:$<CONFIG:DEBUG>>:
+        /Gw # Optimize global data. (-fdata-sections)
+        /Gy # Enable function level linking. (-ffunction-sections)
+        /Qpar # Enable parallel code generation.
+        /Oi # Enable intrinsic functions.
+        /Ot # Favor fast code.
+
+        $<$<BOOL:${MSVC_ENABLE_LTCG}>:/GL> # Enable link time code generation.
+      >
+  )
+
+  target_compile_options(${THETARGET}
+    PUBLIC
+      /wd4191 # 'type cast' unsafe conversion of function pointers
+      /wd4291 # no matching operator delete found
+      /wd4309 # '=' truncation of constant value
+      /wd4310 # cast truncates constant value
+      /wd4366 # result of unary '&' operator may be unaligned
+      /wd4587 # behavior change; constructor no longer implicitly called
+      /wd4592 # symbol will be dynamically initialized (implementation limitation)
+      /wd4628 # digraphs not supported with -Ze
+      /wd4723 # potential divide by 0
+      /wd4724 # potential mod by 0
+      /wd4868 # compiler may not enforce left-to-right evaluation order
+      /wd4996 # user deprecated
+
+      # The warnings that are disabled:
+      /wd4068 # Unknown pragma.
+      /wd4091 # 'typedef' ignored on left of '' when no variable is declared.
+      /wd4146 # Unary minus applied to unsigned type, result still unsigned.
+      /wd4800 # Values being forced to bool, this happens many places, and is a "performance warning".
+
+      # NOTE: glog/logging.h:1116 change to `size_t pcount() const { return size_t(pptr() - pbase()); }`
+      # NOTE: gmock/gmock-spec-builders.h:1177 change to `*static_cast<const Action<F>*>(untyped_actions_[size_t(count - 1)]) :`
+      # NOTE: gmock/gmock-spec-builders.h:1749 change to `const size_t count = untyped_expectations_.size();`
+      # NOTE: gmock/gmock-spec-builders.h:1754 change to `for (size_t i = 0; i < count; i++) {`
+      # NOTE: gtest/gtest-printers.h:173 change to `const internal::BiggestInt kBigInt = internal::BiggestInt(value);`
+      # NOTE: gtest/internal/gtest-internal.h:890 add `GTEST_DISABLE_MSC_WARNINGS_PUSH_(4365)`
+      # NOTE: gtest/internal/gtest-internal.h:894 ass `GTEST_DISABLE_MSC_WARNINGS_POP_()`
+      # NOTE: boost/crc.hpp:578 change to `{ return static_cast<unsigned char>(x ^ rem); }`
+      # NOTE: boost/regex/v4/match_results.hpp:126 change to `return m_subs[size_type(sub)].length();`
+      # NOTE: boost/regex/v4/match_results.hpp:226 change to `return m_subs[size_type(sub)];`
+      # NOTE: boost/date_time/adjust_functors.hpp:67 change to `origDayOfMonth_ = short(ymd.day);`
+      # NOTE: boost/date_time/adjust_functors.hpp:75 change to `wrap_int2 wi(short(ymd.month));`
+      # NOTE: boost/date_time/adjust_functors.hpp:82 change to `day_type resultingEndOfMonthDay(cal_type::end_of_month_day(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int())));`
+      # NOTE: boost/date_time/adjust_functors.hpp:85 change to `return date_type(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int()), resultingEndOfMonthDay) - d;`
+      # NOTE: boost/date_time/adjust_functors.hpp:87 change to `day_type dayOfMonth = static_cast<unsigned short>(origDayOfMonth_);`
+      # NOTE: boost/date_time/adjust_functors.hpp:91 change to `return date_type(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int()), dayOfMonth) - d;`
+      # NOTE: boost/date_time/adjust_functors.hpp:98 change to `origDayOfMonth_ = short(ymd.day);`
+      # NOTE: boost/date_time/adjust_functors.hpp:106 change to `wrap_int2 wi(short(ymd.month));`
+      # NOTE: boost/date_time/adjust_functors.hpp:111 change to `day_type resultingEndOfMonthDay(cal_type::end_of_month_day(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int())));`
+      # NOTE: boost/date_time/adjust_functors.hpp:114 change to `return date_type(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int()), resultingEndOfMonthDay) - d;`
+      # NOTE: boost/date_time/adjust_functors.hpp:116 change to `day_type dayOfMonth = static_cast<unsigned short>(origDayOfMonth_);`
+      # NOTE: boost/date_time/adjust_functors.hpp:120 change to `return date_type(static_cast<unsigned short>(year), static_cast<unsigned short>(wi.as_int()), dayOfMonth) - d;`
+      # NOTE: boost/date_time/gregorian_calendar.ipp:81 change to `unsigned long  d = static_cast<unsigned long>(ymd.day + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045);`
+      # NOTE: boost/date_time/gregorian/greg_date.hpp:122 change to `unsigned short eom_day =  gregorian_calendar::end_of_month_day(ymd.year, ymd.month);`
+      # NOTE: boost/thread/future.hpp:1050 change to `locks[std::ptrdiff_t(i)]=BOOST_THREAD_MAKE_RV_REF(boost::unique_lock<boost::mutex>(futures[i].future_->mutex));`
+      # NOTE: boost/thread/future.hpp:1063 change to `locks[std::ptrdiff_t(i)].unlock();`
+      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:47 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`
+      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:53 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`
+      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:64 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`
+      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:78 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`
+      # NOTE: boost/thread/win32/basic_recursive_mutex.hpp:84 change to `long const current_thread_id=long(win32::GetCurrentThreadId());`
+      # NOTE: boost/thread/win32/condition_variable.hpp:79 change to `detail::win32::ReleaseSemaphore(semaphore,long(count_to_release),0);`
+      # NOTE: boost/thread/win32/condition_variable.hpp:84 change to `release(unsigned(detail::interlocked_read_acquire(&waiters)));`
+      # NOTE: boost/algorithm/string/detail/classification.hpp:85 change to `std::size_t Size=std::size_t(::boost::distance(Range));`
+      /wd4018 # Signed/unsigned mismatch.
+      /wd4365 # Signed/unsigned mismatch.
+      /wd4388 # Signed/unsigned mismatch on relative comparison operator.
+      /wd4389 # Signed/unsigned mismatch on equality comparison operator.
+
+      # TODO:
+      /wd4100 # Unreferenced formal parameter.
+      /wd4459 # Declaration of parameter hides global declaration.
+      /wd4505 # Unreferenced local function has been removed.
+      /wd4701 # Potentially uninitialized local variable used.
+      /wd4702 # Unreachable code.
+
+      # These warnings are disabled because we've
+      # enabled all warnings. If all warnings are
+      # not enabled, we still need to disable them
+      # for consuming libs.
+      /wd4061 # Enum value not handled by a case in a switch on an enum. This isn't very helpful because it is produced even if a default statement is present.
+      /wd4127 # Conditional expression is constant.
+      /wd4200 # Non-standard extension, zero sized array.
+      /wd4201 # Non-standard extension used: nameless struct/union.
+      /wd4296 # '<' Expression is always false.
+      /wd4316 # Object allocated on the heap may not be aligned to 128.
+      /wd4324 # Structure was padded due to alignment specifier.
+      /wd4355 # 'this' used in base member initializer list.
+      /wd4371 # Layout of class may have changed due to fixes in packing.
+      /wd4435 # Object layout under /vd2 will change due to virtual base.
+      /wd4514 # Unreferenced inline function has been removed. (caused by /Zc:inline)
+      /wd4548 # Expression before comma has no effect. I wouldn't disable this normally, but malloc.h triggers this warning.
+      /wd4574 # ifdef'd macro was defined to 0.
+      /wd4582 # Constructor is not implicitly called.
+      /wd4583 # Destructor is not implicitly called.
+      /wd4619 # Invalid warning number used in #pragma warning.
+      /wd4623 # Default constructor was implicitly defined as deleted.
+      /wd4625 # Copy constructor was implicitly defined as deleted.
+      /wd4626 # Assignment operator was implicitly defined as deleted.
+      /wd4647 # Behavior change in __is_pod.
+      /wd4668 # Macro was not defined, replacing with 0.
+      /wd4706 # Assignment within conditional expression.
+      /wd4710 # Function was not inlined.
+      /wd4711 # Function was selected for automated inlining.
+      /wd4714 # Function marked as __forceinline not inlined.
+      /wd4820 # Padding added after data member.
+      /wd5026 # Move constructor was implicitly defined as deleted.
+      /wd5027 # Move assignment operator was implicitly defined as deleted.
+      /wd5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file. This is needed because of how boost does things.
+
+      # Warnings to treat as errors:
+      /we4099 # Mixed use of struct and class on same type names.
+      /we4129 # Unknown escape sequence. This is usually caused by incorrect escaping.
+      /we4566 # Character cannot be represented in current charset. This is remidied by prefixing string with "u8".
+
+    PRIVATE
+      # Warnings disabled for /analyze
+      $<$<BOOL:${MSVC_ENABLE_STATIC_ANALYSIS}>:
+        /wd6001 # Using uninitialized memory. This is disabled because it is wrong 99% of the time.
+        /wd6011 # Dereferencing potentially NULL pointer.
+        /wd6031 # Return value ignored.
+        /wd6235 # (<non-zero constant> || <expression>) is always a non-zero constant.
+        /wd6237 # (<zero> && <expression>) is always zero. <expression> is never evaluated and may have side effects.
+        /wd6239 # (<non-zero constant> && <expression>) always evaluates to the result of <expression>.
+        /wd6240 # (<expression> && <non-zero constant>) always evaluates to the result of <expression>.
+        /wd6246 # Local declaration hides declaration of same name in outer scope.
+        /wd6248 # Setting a SECURITY_DESCRIPTOR's DACL to NULL will result in an unprotected object. This is done by one of the boost headers.
+        /wd6255 # _alloca indicates failure by raising a stack overflow exception.
+        /wd6262 # Function uses more than x bytes of stack space.
+        /wd6271 # Extra parameter passed to format function. The analysis pass doesn't recognize %j or %z, even though the runtime does.
+        /wd6285 # (<non-zero constant> || <non-zero constant>) is always true.
+        /wd6297 # 32-bit value is shifted then cast to 64-bits. The places this occurs never use more than 32 bits.
+        /wd6308 # Realloc might return null pointer: assigning null pointer to '<name>', which is passed as an argument to 'realloc', will cause the original memory to leak.
+        /wd6326 # Potential comparison of a constant with another constant.
+        /wd6330 # Unsigned/signed mismatch when passed as a parameter.
+        /wd6340 # Mismatch on sign when passed as format string value.
+        /wd6387 # '<value>' could be '0': This does not adhere to the specification for a function.
+        /wd28182 # Dereferencing NULL pointer. '<value>' contains the same NULL value as '<expression>'.
+        /wd28251 # Inconsistent annotation for function. This is because we only annotate the declaration and not the definition.
+        /wd28278 # Function appears with no prototype in scope.
+      >
+  )
+
+  # And the extra defines:
+  target_compile_definitions(${THETARGET}
+    PUBLIC
+      _CRT_NONSTDC_NO_WARNINGS # Don't deprecate posix names of functions.
+      _CRT_SECURE_NO_WARNINGS # Don't deprecate the non _s versions of various standard library functions, because safety is for chumps.
+      _SCL_SECURE_NO_WARNINGS # Don't deprecate the non _s versions of various standard library functions, because safety is for chumps.
+      
+      _STL_EXTRA_DISABLED_WARNINGS=4774\ 4987
+
+      $<$<BOOL:${MSVC_ENABLE_CPP_LATEST}>:_HAS_AUTO_PTR_ETC=1> # We're building in C++ 17 or greater mode, but certain dependencies (Boost) still have dependencies on unary_function and binary_function, so we have to make sure not to remove them.
+      $<$<BOOL:${MSVC_ENABLE_LEAN_AND_MEAN_WINDOWS}>:WIN32_LEAN_AND_MEAN> # Don't include most of Windows.h
+  )
+
+  # Ignore a warning about an object file not defining any symbols,
+  # these are known, and we don't care.
+  set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " /ignore:4221")
+
+  # The options to pass to the linker:
+  set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /INCREMENTAL") # Do incremental linking.
+  if (NOT $<TARGET_PROPERTY:${THETARGET},TYPE> STREQUAL "STATIC_LIBRARY")
+    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /OPT:NOREF") # No unreferenced data elimination.
+    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /OPT:NOICF") # No Identical COMDAT folding.
+
+    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /OPT:REF") # Remove unreferenced functions and data.
+    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /OPT:ICF") # Identical COMDAT folding.
+  endif()
+
+  if (MSVC_ENABLE_FAST_LINK)
+    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /DEBUG:FASTLINK") # Generate a partial PDB file that simply references the original object and library files.
+  endif()
+
+  # Add /GL to the compiler, and /LTCG to the linker
+  # if link time code generation is enabled.
+  if (MSVC_ENABLE_LTCG)
+    set_property(TARGET ${THETARGET} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /LTCG")
+  endif()
+endfunction()
index ee538856b20fee6819fc70beb3002941d444be0b..691ac4a39b87a125ad9af97994f3f3b8e590552b 100755 (executable)
-function(auto_sources RETURN_VALUE PATTERN SOURCE_SUBDIRS)\r
-  if ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")\r
-    SET(PATH ".")\r
-    if (${ARGC} EQUAL 4)\r
-      list(GET ARGV 3 PATH)\r
-    endif ()\r
-  endif()\r
-\r
-  if ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")\r
-    unset(${RETURN_VALUE})\r
-    file(GLOB SUBDIR_FILES "${PATH}/${PATTERN}")\r
-    list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})\r
-\r
-    file(GLOB subdirs RELATIVE ${PATH} ${PATH}/*)\r
-\r
-    foreach(DIR ${subdirs})\r
-      if (IS_DIRECTORY ${PATH}/${DIR})\r
-        if (NOT "${DIR}" STREQUAL "CMakeFiles")\r
-          file(GLOB_RECURSE SUBDIR_FILES "${PATH}/${DIR}/${PATTERN}")\r
-          list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})\r
-        endif()\r
-      endif()\r
-    endforeach()\r
-  else()\r
-    file(GLOB ${RETURN_VALUE} "${PATTERN}")\r
-\r
-    foreach (PATH ${SOURCE_SUBDIRS})\r
-      file(GLOB SUBDIR_FILES "${PATH}/${PATTERN}")\r
-      list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})\r
-    endforeach()\r
-  endif ()\r
-\r
-  set(${RETURN_VALUE} ${${RETURN_VALUE}} PARENT_SCOPE)\r
-endfunction(auto_sources)\r
-\r
-# Remove all files matching a set of patterns, and,\r
-# optionally, not matching a second set of patterns,\r
-# from a set of lists.\r
-#\r
-# Example:\r
-# This will remove all files in the CPP_SOURCES list\r
-# matching "/test/" or "Test.cpp$", but not matching\r
-# "BobTest.cpp$".\r
-# REMOVE_MATCHES_FROM_LISTS(CPP_SOURCES MATCHES "/test/" "Test.cpp$" IGNORE_MATCHES "BobTest.cpp$")\r
-#\r
-# Parameters:\r
-#\r
-# [...]:\r
-# The names of the lists to remove matches from.\r
-#\r
-# [MATCHES ...]:\r
-# The matches to remove from the lists.\r
-#\r
-# [IGNORE_MATCHES ...]:\r
-# The matches not to remove, even if they match\r
-# the main set of matches to remove.\r
-function(REMOVE_MATCHES_FROM_LISTS)\r
-  set(LISTS_TO_SEARCH)\r
-  set(MATCHES_TO_REMOVE)\r
-  set(MATCHES_TO_IGNORE)\r
-  set(argumentState 0)\r
-  foreach (arg ${ARGN})\r
-    if ("x${arg}" STREQUAL "xMATCHES")\r
-      set(argumentState 1)\r
-    elseif ("x${arg}" STREQUAL "xIGNORE_MATCHES")\r
-      set(argumentState 2)\r
-    elseif (argumentState EQUAL 0)\r
-      list(APPEND LISTS_TO_SEARCH ${arg})\r
-    elseif (argumentState EQUAL 1)\r
-      list(APPEND MATCHES_TO_REMOVE ${arg})\r
-    elseif (argumentState EQUAL 2)\r
-      list(APPEND MATCHES_TO_IGNORE ${arg})\r
-    else()\r
-      message(FATAL_ERROR "Unknown argument state!")\r
-    endif()\r
-  endforeach()\r
-\r
-  foreach (theList ${LISTS_TO_SEARCH})\r
-    foreach (entry ${${theList}})\r
-      foreach (match ${MATCHES_TO_REMOVE})\r
-        if (${entry} MATCHES ${match})\r
-          set(SHOULD_IGNORE OFF)\r
-          foreach (ign ${MATCHES_TO_IGNORE})\r
-            if (${entry} MATCHES ${ign})\r
-              set(SHOULD_IGNORE ON)\r
-              break()\r
-            endif()\r
-          endforeach()\r
-\r
-          if (NOT SHOULD_IGNORE)\r
-            list(REMOVE_ITEM ${theList} ${entry})\r
-          endif()\r
-        endif()\r
-      endforeach()\r
-    endforeach()\r
-    set(${theList} ${${theList}} PARENT_SCOPE)\r
-  endforeach()\r
-endfunction()\r
-\r
-# Automatically create source_group directives for the sources passed in.\r
-function(auto_source_group rootName rootDir)\r
-  file(TO_CMAKE_PATH "${rootDir}" rootDir)\r
-  string(LENGTH "${rootDir}" rootDirLength)\r
-  set(sourceGroups)\r
-  foreach (fil ${ARGN})\r
-    file(TO_CMAKE_PATH "${fil}" filePath)\r
-    string(FIND "${filePath}" "/" rIdx REVERSE)\r
-    if (rIdx EQUAL -1)\r
-      message(FATAL_ERROR "Unable to locate the final forward slash in '${filePath}'!")\r
-    endif()\r
-    string(SUBSTRING "${filePath}" 0 ${rIdx} filePath)\r
-\r
-    string(LENGTH "${filePath}" filePathLength)\r
-    string(FIND "${filePath}" "${rootDir}" rIdx)\r
-    if (rIdx EQUAL 0)\r
-      math(EXPR filePathLength "${filePathLength} - ${rootDirLength}")\r
-      string(SUBSTRING "${filePath}" ${rootDirLength} ${filePathLength} fileGroup)\r
-\r
-      string(REPLACE "/" "\\" fileGroup "${fileGroup}")\r
-      set(fileGroup "\\${rootName}${fileGroup}")\r
-\r
-      list(FIND sourceGroups "${fileGroup}" rIdx)\r
-      if (rIdx EQUAL -1)\r
-        list(APPEND sourceGroups "${fileGroup}")\r
-        source_group("${fileGroup}" REGULAR_EXPRESSION "${filePath}/[^/.]+.(cpp|h)$")\r
-      endif()\r
-    endif()\r
-  endforeach()\r
-endfunction()\r
-\r
-# CMake is a pain and doesn't have an easy way to install only the files\r
-# we actually included in our build :(\r
-function(auto_install_files rootName rootDir)\r
-  file(TO_CMAKE_PATH "${rootDir}" rootDir)\r
-  string(LENGTH "${rootDir}" rootDirLength)\r
-  set(sourceGroups)\r
-  foreach (fil ${ARGN})\r
-    file(TO_CMAKE_PATH "${fil}" filePath)\r
-    string(FIND "${filePath}" "/" rIdx REVERSE)\r
-    if (rIdx EQUAL -1)\r
-      message(FATAL_ERROR "Unable to locate the final forward slash in '${filePath}'!")\r
-    endif()\r
-    string(SUBSTRING "${filePath}" 0 ${rIdx} filePath)\r
-\r
-    string(LENGTH "${filePath}" filePathLength)\r
-    string(FIND "${filePath}" "${rootDir}" rIdx)\r
-    if (rIdx EQUAL 0)\r
-      math(EXPR filePathLength "${filePathLength} - ${rootDirLength}")\r
-      string(SUBSTRING "${filePath}" ${rootDirLength} ${filePathLength} fileGroup)\r
-      install(FILES ${fil} DESTINATION include/${rootName}${fileGroup})\r
-    endif()\r
-  endforeach()\r
-endfunction()\r
-\r
-function(folly_define_tests)\r
-  set(directory_count 0)\r
-  set(test_count 0)\r
-  set(currentArg 0)\r
-  while (currentArg LESS ${ARGC})\r
-    if ("x${ARGV${currentArg}}" STREQUAL "xDIRECTORY")\r
-      math(EXPR currentArg "${currentArg} + 1")\r
-      if (NOT currentArg LESS ${ARGC})\r
-        message(FATAL_ERROR "Expected base directory!")\r
-      endif()\r
-\r
-      set(cur_dir ${directory_count})\r
-      math(EXPR directory_count "${directory_count} + 1")\r
-      set(directory_${cur_dir}_name "${ARGV${currentArg}}")\r
-      # We need a single list of sources to get source_group to work nicely.\r
-      set(directory_${cur_dir}_source_list)\r
-\r
-      math(EXPR currentArg "${currentArg} + 1")\r
-      while (currentArg LESS ${ARGC})\r
-        if ("x${ARGV${currentArg}}" STREQUAL "xDIRECTORY")\r
-          break()\r
-        elseif ("x${ARGV${currentArg}}" STREQUAL "xTEST")\r
-          math(EXPR currentArg "${currentArg} + 1")\r
-          if (NOT currentArg LESS ${ARGC})\r
-            message(FATAL_ERROR "Expected test name!")\r
-          endif()\r
-\r
-          set(cur_test ${test_count})\r
-          math(EXPR test_count "${test_count} + 1")\r
-          set(test_${cur_test}_name "${ARGV${currentArg}}")\r
-          math(EXPR currentArg "${currentArg} + 1")\r
-          set(test_${cur_test}_directory ${cur_dir})\r
-          set(test_${cur_test}_content_dir)\r
-          set(test_${cur_test}_headers)\r
-          set(test_${cur_test}_sources)\r
-          set(test_${cur_test}_tag "NONE")\r
-\r
-          set(argumentState 0)\r
-          while (currentArg LESS ${ARGC})\r
-            if ("x${ARGV${currentArg}}" STREQUAL "xHEADERS")\r
-              set(argumentState 1)\r
-            elseif ("x${ARGV${currentArg}}" STREQUAL "xSOURCES")\r
-              set(argumentState 2)\r
-            elseif ("x${ARGV${currentArg}}" STREQUAL "xCONTENT_DIR")\r
-              math(EXPR currentArg "${currentArg} + 1")\r
-              if (NOT currentArg LESS ${ARGC})\r
-                message(FATAL_ERROR "Expected content directory name!")\r
-              endif()\r
-              set(test_${cur_test}_content_dir "${ARGV${currentArg}}")\r
-            elseif ("x${ARGV${currentArg}}" STREQUAL "xTEST" OR\r
-                    "x${ARGV${currentArg}}" STREQUAL "xDIRECTORY")\r
-              break()\r
-            elseif (argumentState EQUAL 0)\r
-              if ("x${ARGV${currentArg}}" STREQUAL "xBROKEN")\r
-                set(test_${cur_test}_tag "BROKEN")\r
-              elseif ("x${ARGV${currentArg}}" STREQUAL "xHANGING")\r
-                set(test_${cur_test}_tag "HANGING")\r
-              elseif ("x${ARGV${currentArg}}" STREQUAL "xSLOW")\r
-                set(test_${cur_test}_tag "SLOW")\r
-              else()\r
-                message(FATAL_ERROR "Unknown test tag '${ARGV${currentArg}}'!")\r
-              endif()\r
-            elseif (argumentState EQUAL 1)\r
-              list(APPEND test_${cur_test}_headers\r
-                "${FOLLY_DIR}/${directory_${cur_dir}_name}${ARGV${currentArg}}"\r
-              )\r
-            elseif (argumentState EQUAL 2)\r
-              list(APPEND test_${cur_test}_sources\r
-                "${FOLLY_DIR}/${directory_${cur_dir}_name}${ARGV${currentArg}}"\r
-              )\r
-            else()\r
-              message(FATAL_ERROR "Unknown argument state!")\r
-            endif()\r
-            math(EXPR currentArg "${currentArg} + 1")\r
-          endwhile()\r
-\r
-          list(APPEND directory_${cur_dir}_source_list\r
-            ${test_${cur_test}_sources} ${test_${cur_test}_headers})\r
-        else()\r
-          message(FATAL_ERROR "Unknown argument inside directory '${ARGV${currentArg}}'!")\r
-        endif()\r
-      endwhile()\r
-    else()\r
-      message(FATAL_ERROR "Unknown argument '${ARGV${currentArg}}'!")\r
-    endif()\r
-  endwhile()\r
-\r
-  set(cur_dir 0)\r
-  while (cur_dir LESS directory_count)\r
-    source_group("" FILES ${directory_${cur_dir}_source_list})\r
-    math(EXPR cur_dir "${cur_dir} + 1")\r
-  endwhile()\r
-\r
-  set(cur_test 0)\r
-  while (cur_test LESS test_count)\r
-    if ("x${test_${cur_test}_tag}" STREQUAL "xNONE" OR\r
-        ("x${test_${cur_test}_tag}" STREQUAL "xBROKEN" AND BUILD_BROKEN_TESTS) OR\r
-        ("x${test_${cur_test}_tag}" STREQUAL "xSLOW" AND BUILD_SLOW_TESTS) OR\r
-        ("x${test_${cur_test}_tag}" STREQUAL "xHANGING" AND BUILD_HANGING_TESTS)\r
-    )\r
-      set(cur_test_name ${test_${cur_test}_name})\r
-      set(cur_dir_name ${directory_${test_${cur_test}_directory}_name})\r
-      add_executable(${cur_test_name}\r
-        ${test_${cur_test}_headers}\r
-        ${test_${cur_test}_sources}\r
-      )\r
-      if (NOT "x${test_${cur_test}_content_dir}" STREQUAL "x")\r
-        # Copy the content directory to the output directory tree so that\r
-        # tests can be run easily from Visual Studio without having to change\r
-        # the working directory for each test individually.\r
-        file(\r
-          COPY "${FOLLY_DIR}/${cur_dir_name}${test_${cur_test}_content_dir}"\r
-          DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/folly/${cur_dir_name}${test_${cur_test}_content_dir}"\r
-        )\r
-        add_custom_command(TARGET ${cur_test_name} POST_BUILD COMMAND\r
-          ${CMAKE_COMMAND} ARGS -E copy_directory\r
-            "${FOLLY_DIR}/${cur_dir_name}${test_${cur_test}_content_dir}"\r
-            "$<TARGET_FILE_DIR:${cur_test_name}>/folly/${cur_dir_name}${test_${cur_test}_content_dir}"\r
-          COMMENT "Copying test content for ${cur_test_name}" VERBATIM\r
-        )\r
-      endif()\r
-      # Strip the tailing test directory name for the folder name.\r
-      string(REPLACE "test/" "" test_dir_name "${cur_dir_name}")\r
-      set_property(TARGET ${cur_test_name} PROPERTY FOLDER "Tests/${test_dir_name}")\r
-      target_link_libraries(${cur_test_name} PRIVATE folly_test_support)\r
-      apply_folly_compile_options_to_target(${cur_test_name})\r
-    endif()\r
-    math(EXPR cur_test "${cur_test} + 1")\r
-  endwhile()\r
-endfunction()\r
+function(auto_sources RETURN_VALUE PATTERN SOURCE_SUBDIRS)
+  if ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
+    SET(PATH ".")
+    if (${ARGC} EQUAL 4)
+      list(GET ARGV 3 PATH)
+    endif ()
+  endif()
+
+  if ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
+    unset(${RETURN_VALUE})
+    file(GLOB SUBDIR_FILES "${PATH}/${PATTERN}")
+    list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})
+
+    file(GLOB subdirs RELATIVE ${PATH} ${PATH}/*)
+
+    foreach(DIR ${subdirs})
+      if (IS_DIRECTORY ${PATH}/${DIR})
+        if (NOT "${DIR}" STREQUAL "CMakeFiles")
+          file(GLOB_RECURSE SUBDIR_FILES "${PATH}/${DIR}/${PATTERN}")
+          list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})
+        endif()
+      endif()
+    endforeach()
+  else()
+    file(GLOB ${RETURN_VALUE} "${PATTERN}")
+
+    foreach (PATH ${SOURCE_SUBDIRS})
+      file(GLOB SUBDIR_FILES "${PATH}/${PATTERN}")
+      list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})
+    endforeach()
+  endif ()
+
+  set(${RETURN_VALUE} ${${RETURN_VALUE}} PARENT_SCOPE)
+endfunction(auto_sources)
+
+# Remove all files matching a set of patterns, and,
+# optionally, not matching a second set of patterns,
+# from a set of lists.
+#
+# Example:
+# This will remove all files in the CPP_SOURCES list
+# matching "/test/" or "Test.cpp$", but not matching
+# "BobTest.cpp$".
+# REMOVE_MATCHES_FROM_LISTS(CPP_SOURCES MATCHES "/test/" "Test.cpp$" IGNORE_MATCHES "BobTest.cpp$")
+#
+# Parameters:
+#
+# [...]:
+# The names of the lists to remove matches from.
+#
+# [MATCHES ...]:
+# The matches to remove from the lists.
+#
+# [IGNORE_MATCHES ...]:
+# The matches not to remove, even if they match
+# the main set of matches to remove.
+function(REMOVE_MATCHES_FROM_LISTS)
+  set(LISTS_TO_SEARCH)
+  set(MATCHES_TO_REMOVE)
+  set(MATCHES_TO_IGNORE)
+  set(argumentState 0)
+  foreach (arg ${ARGN})
+    if ("x${arg}" STREQUAL "xMATCHES")
+      set(argumentState 1)
+    elseif ("x${arg}" STREQUAL "xIGNORE_MATCHES")
+      set(argumentState 2)
+    elseif (argumentState EQUAL 0)
+      list(APPEND LISTS_TO_SEARCH ${arg})
+    elseif (argumentState EQUAL 1)
+      list(APPEND MATCHES_TO_REMOVE ${arg})
+    elseif (argumentState EQUAL 2)
+      list(APPEND MATCHES_TO_IGNORE ${arg})
+    else()
+      message(FATAL_ERROR "Unknown argument state!")
+    endif()
+  endforeach()
+
+  foreach (theList ${LISTS_TO_SEARCH})
+    foreach (entry ${${theList}})
+      foreach (match ${MATCHES_TO_REMOVE})
+        if (${entry} MATCHES ${match})
+          set(SHOULD_IGNORE OFF)
+          foreach (ign ${MATCHES_TO_IGNORE})
+            if (${entry} MATCHES ${ign})
+              set(SHOULD_IGNORE ON)
+              break()
+            endif()
+          endforeach()
+
+          if (NOT SHOULD_IGNORE)
+            list(REMOVE_ITEM ${theList} ${entry})
+          endif()
+        endif()
+      endforeach()
+    endforeach()
+    set(${theList} ${${theList}} PARENT_SCOPE)
+  endforeach()
+endfunction()
+
+# Automatically create source_group directives for the sources passed in.
+function(auto_source_group rootName rootDir)
+  file(TO_CMAKE_PATH "${rootDir}" rootDir)
+  string(LENGTH "${rootDir}" rootDirLength)
+  set(sourceGroups)
+  foreach (fil ${ARGN})
+    file(TO_CMAKE_PATH "${fil}" filePath)
+    string(FIND "${filePath}" "/" rIdx REVERSE)
+    if (rIdx EQUAL -1)
+      message(FATAL_ERROR "Unable to locate the final forward slash in '${filePath}'!")
+    endif()
+    string(SUBSTRING "${filePath}" 0 ${rIdx} filePath)
+
+    string(LENGTH "${filePath}" filePathLength)
+    string(FIND "${filePath}" "${rootDir}" rIdx)
+    if (rIdx EQUAL 0)
+      math(EXPR filePathLength "${filePathLength} - ${rootDirLength}")
+      string(SUBSTRING "${filePath}" ${rootDirLength} ${filePathLength} fileGroup)
+
+      string(REPLACE "/" "\\" fileGroup "${fileGroup}")
+      set(fileGroup "\\${rootName}${fileGroup}")
+
+      list(FIND sourceGroups "${fileGroup}" rIdx)
+      if (rIdx EQUAL -1)
+        list(APPEND sourceGroups "${fileGroup}")
+        source_group("${fileGroup}" REGULAR_EXPRESSION "${filePath}/[^/.]+.(cpp|h)$")
+      endif()
+    endif()
+  endforeach()
+endfunction()
+
+# CMake is a pain and doesn't have an easy way to install only the files
+# we actually included in our build :(
+function(auto_install_files rootName rootDir)
+  file(TO_CMAKE_PATH "${rootDir}" rootDir)
+  string(LENGTH "${rootDir}" rootDirLength)
+  set(sourceGroups)
+  foreach (fil ${ARGN})
+    file(TO_CMAKE_PATH "${fil}" filePath)
+    string(FIND "${filePath}" "/" rIdx REVERSE)
+    if (rIdx EQUAL -1)
+      message(FATAL_ERROR "Unable to locate the final forward slash in '${filePath}'!")
+    endif()
+    string(SUBSTRING "${filePath}" 0 ${rIdx} filePath)
+
+    string(LENGTH "${filePath}" filePathLength)
+    string(FIND "${filePath}" "${rootDir}" rIdx)
+    if (rIdx EQUAL 0)
+      math(EXPR filePathLength "${filePathLength} - ${rootDirLength}")
+      string(SUBSTRING "${filePath}" ${rootDirLength} ${filePathLength} fileGroup)
+      install(FILES ${fil} DESTINATION include/${rootName}${fileGroup})
+    endif()
+  endforeach()
+endfunction()
+
+function(folly_define_tests)
+  set(directory_count 0)
+  set(test_count 0)
+  set(currentArg 0)
+  while (currentArg LESS ${ARGC})
+    if ("x${ARGV${currentArg}}" STREQUAL "xDIRECTORY")
+      math(EXPR currentArg "${currentArg} + 1")
+      if (NOT currentArg LESS ${ARGC})
+        message(FATAL_ERROR "Expected base directory!")
+      endif()
+
+      set(cur_dir ${directory_count})
+      math(EXPR directory_count "${directory_count} + 1")
+      set(directory_${cur_dir}_name "${ARGV${currentArg}}")
+      # We need a single list of sources to get source_group to work nicely.
+      set(directory_${cur_dir}_source_list)
+
+      math(EXPR currentArg "${currentArg} + 1")
+      while (currentArg LESS ${ARGC})
+        if ("x${ARGV${currentArg}}" STREQUAL "xDIRECTORY")
+          break()
+        elseif ("x${ARGV${currentArg}}" STREQUAL "xTEST")
+          math(EXPR currentArg "${currentArg} + 1")
+          if (NOT currentArg LESS ${ARGC})
+            message(FATAL_ERROR "Expected test name!")
+          endif()
+
+          set(cur_test ${test_count})
+          math(EXPR test_count "${test_count} + 1")
+          set(test_${cur_test}_name "${ARGV${currentArg}}")
+          math(EXPR currentArg "${currentArg} + 1")
+          set(test_${cur_test}_directory ${cur_dir})
+          set(test_${cur_test}_content_dir)
+          set(test_${cur_test}_headers)
+          set(test_${cur_test}_sources)
+          set(test_${cur_test}_tag "NONE")
+
+          set(argumentState 0)
+          while (currentArg LESS ${ARGC})
+            if ("x${ARGV${currentArg}}" STREQUAL "xHEADERS")
+              set(argumentState 1)
+            elseif ("x${ARGV${currentArg}}" STREQUAL "xSOURCES")
+              set(argumentState 2)
+            elseif ("x${ARGV${currentArg}}" STREQUAL "xCONTENT_DIR")
+              math(EXPR currentArg "${currentArg} + 1")
+              if (NOT currentArg LESS ${ARGC})
+                message(FATAL_ERROR "Expected content directory name!")
+              endif()
+              set(test_${cur_test}_content_dir "${ARGV${currentArg}}")
+            elseif ("x${ARGV${currentArg}}" STREQUAL "xTEST" OR
+                    "x${ARGV${currentArg}}" STREQUAL "xDIRECTORY")
+              break()
+            elseif (argumentState EQUAL 0)
+              if ("x${ARGV${currentArg}}" STREQUAL "xBROKEN")
+                set(test_${cur_test}_tag "BROKEN")
+              elseif ("x${ARGV${currentArg}}" STREQUAL "xHANGING")
+                set(test_${cur_test}_tag "HANGING")
+              elseif ("x${ARGV${currentArg}}" STREQUAL "xSLOW")
+                set(test_${cur_test}_tag "SLOW")
+              else()
+                message(FATAL_ERROR "Unknown test tag '${ARGV${currentArg}}'!")
+              endif()
+            elseif (argumentState EQUAL 1)
+              list(APPEND test_${cur_test}_headers
+                "${FOLLY_DIR}/${directory_${cur_dir}_name}${ARGV${currentArg}}"
+              )
+            elseif (argumentState EQUAL 2)
+              list(APPEND test_${cur_test}_sources
+                "${FOLLY_DIR}/${directory_${cur_dir}_name}${ARGV${currentArg}}"
+              )
+            else()
+              message(FATAL_ERROR "Unknown argument state!")
+            endif()
+            math(EXPR currentArg "${currentArg} + 1")
+          endwhile()
+
+          list(APPEND directory_${cur_dir}_source_list
+            ${test_${cur_test}_sources} ${test_${cur_test}_headers})
+        else()
+          message(FATAL_ERROR "Unknown argument inside directory '${ARGV${currentArg}}'!")
+        endif()
+      endwhile()
+    else()
+      message(FATAL_ERROR "Unknown argument '${ARGV${currentArg}}'!")
+    endif()
+  endwhile()
+
+  set(cur_dir 0)
+  while (cur_dir LESS directory_count)
+    source_group("" FILES ${directory_${cur_dir}_source_list})
+    math(EXPR cur_dir "${cur_dir} + 1")
+  endwhile()
+
+  set(cur_test 0)
+  while (cur_test LESS test_count)
+    if ("x${test_${cur_test}_tag}" STREQUAL "xNONE" OR
+        ("x${test_${cur_test}_tag}" STREQUAL "xBROKEN" AND BUILD_BROKEN_TESTS) OR
+        ("x${test_${cur_test}_tag}" STREQUAL "xSLOW" AND BUILD_SLOW_TESTS) OR
+        ("x${test_${cur_test}_tag}" STREQUAL "xHANGING" AND BUILD_HANGING_TESTS)
+    )
+      set(cur_test_name ${test_${cur_test}_name})
+      set(cur_dir_name ${directory_${test_${cur_test}_directory}_name})
+      add_executable(${cur_test_name}
+        ${test_${cur_test}_headers}
+        ${test_${cur_test}_sources}
+      )
+      if (NOT "x${test_${cur_test}_content_dir}" STREQUAL "x")
+        # Copy the content directory to the output directory tree so that
+        # tests can be run easily from Visual Studio without having to change
+        # the working directory for each test individually.
+        file(
+          COPY "${FOLLY_DIR}/${cur_dir_name}${test_${cur_test}_content_dir}"
+          DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/folly/${cur_dir_name}${test_${cur_test}_content_dir}"
+        )
+        add_custom_command(TARGET ${cur_test_name} POST_BUILD COMMAND
+          ${CMAKE_COMMAND} ARGS -E copy_directory
+            "${FOLLY_DIR}/${cur_dir_name}${test_${cur_test}_content_dir}"
+            "$<TARGET_FILE_DIR:${cur_test_name}>/folly/${cur_dir_name}${test_${cur_test}_content_dir}"
+          COMMENT "Copying test content for ${cur_test_name}" VERBATIM
+        )
+      endif()
+      # Strip the tailing test directory name for the folder name.
+      string(REPLACE "test/" "" test_dir_name "${cur_dir_name}")
+      set_property(TARGET ${cur_test_name} PROPERTY FOLDER "Tests/${test_dir_name}")
+      target_link_libraries(${cur_test_name} PRIVATE folly_test_support)
+      apply_folly_compile_options_to_target(${cur_test_name})
+    endif()
+    math(EXPR cur_test "${cur_test} + 1")
+  endwhile()
+endfunction()
index 0f8a31e220ac37ae9901137ae664ce03de9c7973..744cfc6e041356de02f2ec0eeb0e4f4a6439b95b 100755 (executable)
@@ -1,46 +1,46 @@
-/*\r
- * Copyright 2016 Facebook, Inc.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *   http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#pragma once\r
-\r
-#cmakedefine FOLLY_HAVE_PTHREAD 1\r
-#cmakedefine FOLLY_HAVE_PTHREAD_ATFORK 1\r
-\r
-#define FOLLY_HAVE_LIBGFLAGS 1\r
-#define FOLLY_UNUSUAL_GFLAGS_NAMESPACE 1\r
-#define FOLLY_GFLAGS_NAMESPACE google\r
-\r
-#cmakedefine FOLLY_HAVE_MALLOC_H 1\r
-#cmakedefine FOLLY_HAVE_BITS_FUNCTEXCEPT_H 1\r
-\r
-#cmakedefine FOLLY_HAVE_MEMRCHR 1\r
-#cmakedefine FOLLY_HAVE_PREADV 1\r
-#cmakedefine FOLLY_HAVE_PWRITEV 1\r
-#cmakedefine FOLLY_HAVE_CLOCK_GETTIME 1\r
-\r
-#cmakedefine FOLLY_HAVE_IFUNC 1\r
-#cmakedefine FOLLY_HAVE_STD__IS_TRIVIALLY_COPYABLE 1\r
-#cmakedefine FOLLY_HAVE_UNALIGNED_ACCESS 1\r
-#cmakedefine FOLLY_HAVE_VLA 1\r
-#cmakedefine FOLLY_HAVE_WEAK_SYMBOLS 1\r
-\r
-#define FOLLY_VERSION "${PACKAGE_VERSION}"\r
-\r
-//#define FOLLY_HAVE_LIBLZ4 1\r
-//#define FOLLY_HAVE_LIBLZMA 1\r
-//#define FOLLY_HAVE_LIBSNAPPY 1\r
-//#define FOLLY_HAVE_LIBZ 1\r
-//#define FOLLY_HAVE_LIBZSTD 1\r
+/*
+ * Copyright 2016 Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#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_MALLOC_H 1
+#cmakedefine FOLLY_HAVE_BITS_FUNCTEXCEPT_H 1
+
+#cmakedefine FOLLY_HAVE_MEMRCHR 1
+#cmakedefine FOLLY_HAVE_PREADV 1
+#cmakedefine FOLLY_HAVE_PWRITEV 1
+#cmakedefine FOLLY_HAVE_CLOCK_GETTIME 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
+
+#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
index 37cd56f55aeec61deaee3be34a6e15e056e5c763..9dedda658a6ac9be9066a3c264154db5ed178597 100755 (executable)
@@ -1,32 +1,32 @@
-find_package(Boost 1.55.0 MODULE\r
-  COMPONENTS\r
-    context\r
-    chrono\r
-    date_time\r
-    filesystem\r
-    program_options\r
-    regex\r
-    system\r
-    thread\r
-  REQUIRED\r
-)\r
-\r
-find_package(DoubleConversion MODULE REQUIRED)\r
-\r
-find_package(gflags CONFIG)\r
-if(NOT TARGET gflags)\r
-  find_package(GFlags MODULE REQUIRED)\r
-endif()\r
-\r
-find_package(glog CONFIG)\r
-if(NOT TARGET glog::glog)\r
-  find_package(GLog MODULE REQUIRED)\r
-endif()\r
-\r
-find_package(Libevent CONFIG)\r
-if(NOT TARGET event)\r
-  find_package(LibEvent MODULE REQUIRED)\r
-endif()\r
-\r
-find_package(OpenSSL MODULE REQUIRED)\r
-find_package(PThread MODULE)\r
+find_package(Boost 1.55.0 MODULE
+  COMPONENTS
+    context
+    chrono
+    date_time
+    filesystem
+    program_options
+    regex
+    system
+    thread
+  REQUIRED
+)
+
+find_package(DoubleConversion MODULE REQUIRED)
+
+find_package(gflags CONFIG)
+if(NOT TARGET gflags)
+  find_package(GFlags MODULE REQUIRED)
+endif()
+
+find_package(glog CONFIG)
+if(NOT TARGET glog::glog)
+  find_package(GLog MODULE REQUIRED)
+endif()
+
+find_package(Libevent CONFIG)
+if(NOT TARGET event)
+  find_package(LibEvent MODULE REQUIRED)
+endif()
+
+find_package(OpenSSL MODULE REQUIRED)
+find_package(PThread MODULE)