Register singleton's destruction using std::atexit
[folly.git] / CMakeLists.txt
index ae6ab6d01dc44e182284260a72a89f402a75ed8d..a5dcf63c2242f57572d67d4f6395d10dfac27f0d 100755 (executable)
@@ -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")
@@ -337,6 +347,7 @@ if (BUILD_TESTS)
     DIRECTORY container/test/
       TEST access_test SOURCES AccessTest.cpp
       TEST array_test SOURCES ArrayTest.cpp
+      TEST bit_iterator_test SOURCES BitIteratorTest.cpp
       TEST enumerate_test SOURCES EnumerateTest.cpp
       TEST evicting_cache_map_test SOURCES EvictingCacheMapTest.cpp
       TEST foreach_test SOURCES ForeachTest.cpp
@@ -519,6 +530,7 @@ if (BUILD_TESTS)
 
     DIRECTORY lang/test/
       TEST bits_test SOURCES BitsTest.cpp
+      TEST cold_class_test SOURCES ColdClassTest.cpp
 
     DIRECTORY memory/test/
       TEST arena_test SOURCES ArenaTest.cpp
@@ -543,6 +555,7 @@ if (BUILD_TESTS)
       TEST baton_test SOURCES BatonTest.cpp
       TEST call_once_test SOURCES CallOnceTest.cpp
       TEST lifo_sem_test SOURCES LifoSemTests.cpp
+      TEST rw_spin_lock_test SOURCES RWSpinLockTest.cpp
 
     DIRECTORY system/test/
       TEST memory_mapping_test SOURCES MemoryMappingTest.cpp
@@ -562,7 +575,6 @@ if (BUILD_TESTS)
       TEST atomic_linked_list_test SOURCES AtomicLinkedListTest.cpp
       TEST atomic_struct_test SOURCES AtomicStructTest.cpp
       TEST atomic_unordered_map_test SOURCES AtomicUnorderedMapTest.cpp
-      TEST bit_iterator_test SOURCES BitIteratorTest.cpp
       TEST cacheline_padded_test SOURCES CachelinePaddedTest.cpp
       TEST clock_gettime_wrappers_test SOURCES ClockGettimeWrappersTest.cpp
       TEST concurrent_skip_list_test SOURCES ConcurrentSkipListTest.cpp
@@ -630,7 +642,6 @@ if (BUILD_TESTS)
       TEST portability_test SOURCES PortabilityTest.cpp
       TEST producer_consumer_queue_test SLOW
         SOURCES ProducerConsumerQueueTest.cpp
-      TEST r_w_spin_lock_test SOURCES RWSpinLockTest.cpp
       TEST random_test SOURCES RandomTest.cpp
       TEST range_test SOURCES RangeTest.cpp
       TEST safe_assert_test SOURCES SafeAssertTest.cpp