diff --git a/CMakeLists.txt b/CMakeLists.txt index 977b31c..ce9cbc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,6 +108,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}) diff --git a/src/ds/defines.h b/src/ds/defines.h index b001982..d8c4955 100644 --- a/src/ds/defines.h +++ b/src/ds/defines.h @@ -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