Improved support for MSVC with C++17

This commit is contained in:
Istvan Haller
2021-08-26 12:18:53 +01:00
parent 95d33d777b
commit 935f3ccd29
2 changed files with 5 additions and 1 deletions

View File

@@ -107,6 +107,10 @@ endif()
add_library(snmalloc_lib INTERFACE)
target_include_directories(snmalloc_lib INTERFACE src/)
if(SNMALLOC_USE_CXX17)
target_compile_definitions(snmalloc_lib INTERFACE -DSNMALLOC_USE_CXX17)
endif()
if(NOT MSVC)
find_package(Threads REQUIRED COMPONENTS snmalloc_lib)
target_link_libraries(snmalloc_lib INTERFACE ${CMAKE_THREAD_LIBS_INIT})

View File

@@ -7,7 +7,7 @@
# define unlikely(x) !!(x)
# define SNMALLOC_SLOW_PATH NOINLINE
# define SNMALLOC_FAST_PATH ALWAYSINLINE
# if _MSC_VER >= 1927
# if _MSC_VER >= 1927 && !defined(SNMALLOC_USE_CXX17)
# define SNMALLOC_FAST_PATH_LAMBDA [[msvc::forceinline]]
# else
# define SNMALLOC_FAST_PATH_LAMBDA