11cmake_minimum_required (VERSION 3.10 )
22
33project (slick-queue
4- VERSION 1.2.3
4+ VERSION 1.3.0
55 DESCRIPTION "A C++ Lock-Free MPMC queue"
66 LANGUAGES CXX )
77
88set (CMAKE_CXX_STANDARD 20)
99
10+ # Options:
11+ option (BUILD_SLICK_QUEUE_TESTS "Build tests" ON )
12+
13+ find_package (slick-shm CONFIG QUIET )
14+
15+ if (NOT slick-shm_FOUND)
16+ include (FetchContent )
17+
18+ # Disable slick-shm tests and examples
19+ set (SLICK_SHM_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE )
20+ set (SLICK_SHM_BUILD_TESTS OFF CACHE BOOL "" FORCE )
21+ set (SLICK_SHM_INSTALL OFF CACHE BOOL "" FORCE )
22+ FetchContent_Declare (
23+ slick-shm
24+ GIT_REPOSITORY https://github.com/SlickQuant/slick-shm.git
25+ GIT_TAG v0.1.3
26+ )
27+ FetchContent_MakeAvailable (slick-shm)
28+ else ()
29+ message (STATUS "slick-shm: ${slick-shm_VERSION}" )
30+ endif ()
31+
1032add_library (slick-queue INTERFACE )
1133add_library (slick::queue ALIAS slick-queue )
1234# For backward compatibility with older versions
@@ -19,11 +41,39 @@ target_include_directories(slick-queue INTERFACE
1941)
2042set_target_properties (slick-queue PROPERTIES EXPORT_NAME queue )
2143
44+ target_link_libraries (slick-queue INTERFACE slick::shm )
2245if (UNIX AND NOT APPLE )
2346 target_link_libraries (slick-queue INTERFACE rt atomic )
2447endif ()
2548
26- option (BUILD_SLICK_QUEUE_TESTS "Build tests" ON )
49+ target_precompile_headers (slick-queue INTERFACE
50+ <cstdint>
51+ <cstddef>
52+ <atomic>
53+ <stdexcept>
54+ <string>
55+ <cassert>
56+ <thread>
57+ <chrono>
58+ <limits>
59+ <new>
60+ )
61+
62+ if (WIN32 )
63+ target_precompile_headers (slick-queue INTERFACE
64+ <windows.h>
65+ <tchar.h>
66+ )
67+ else ()
68+ target_precompile_headers (slick-queue INTERFACE
69+ <sys/mman.h>
70+ <sys/stat.h>
71+ <fcntl.h>
72+ <unistd.h>
73+ <cerrno>
74+ )
75+ endif ()
76+
2777if (BUILD_SLICK_QUEUE_TESTS)
2878 enable_testing ()
2979 add_subdirectory (tests )
@@ -88,4 +138,4 @@ install(EXPORT slick-queueTargets
88138 DESTINATION lib/cmake/slick-queue
89139)
90140
91- message (STATUS "slick-queue : ${PROJECT_VERSION} " )
141+ message (STATUS "${PROJECT_NAME} : ${PROJECT_VERSION} " )
0 commit comments