@@ -6,38 +6,49 @@ cmake_minimum_required(VERSION 3.5...3.16)
6
6
7
7
project (boost_container VERSION "${BOOST_SUPERPROJECT_VERSION} " LANGUAGES C CXX)
8
8
9
- add_library (boost_container
10
- src/alloc_lib.c
11
- src/dlmalloc.cpp
12
- src/global_resource.cpp
13
- src/monotonic_buffer_resource.cpp
14
- src/pool_resource.cpp
15
- src/synchronized_pool_resource.cpp
16
- src/unsynchronized_pool_resource.cpp
17
- )
9
+ option (Boost_CONTAINER_HEADER_ONLY "Build Extended Allocators and Some Polymorphic Memory Resources classes" OFF )
10
+
11
+ if (Boost_CONTAINER_HEADER_ONLY)
12
+ add_library (boost_container INTERFACE )
13
+ set (_populate INTERFACE )
14
+ else ()
15
+ add_library (boost_container
16
+ src/alloc_lib.c
17
+ src/dlmalloc.cpp
18
+ src/global_resource.cpp
19
+ src/monotonic_buffer_resource.cpp
20
+ src/pool_resource.cpp
21
+ src/synchronized_pool_resource.cpp
22
+ src/unsynchronized_pool_resource.cpp
23
+ )
24
+ set (_populate PUBLIC )
25
+ endif ()
26
+
18
27
19
28
add_library (Boost::container ALIAS boost_container)
20
29
21
- target_include_directories (boost_container PUBLIC include )
30
+ target_include_directories (boost_container ${_populate} include )
22
31
23
32
target_link_libraries (boost_container
24
- PUBLIC
33
+ ${_populate}
25
34
Boost::assert
26
35
Boost::config
27
36
Boost::intrusive
28
37
Boost::move
29
38
)
30
39
31
40
target_compile_definitions (boost_container
32
- PUBLIC BOOST_CONTAINER_NO_LIB
41
+ ${_populate} BOOST_CONTAINER_NO_LIB
33
42
# Source files already define BOOST_CONTAINER_SOURCE
34
43
# PRIVATE BOOST_CONTAINER_SOURCE
35
44
)
36
45
37
- if (BUILD_SHARED_LIBS )
38
- target_compile_definitions (boost_container PUBLIC BOOST_CONTAINER_DYN_LINK)
39
- else ()
40
- target_compile_definitions (boost_container PUBLIC BOOST_CONTAINER_STATIC_LINK)
46
+ if (NOT Boost_CONTAINER_HEADER_ONLY)
47
+ if (BUILD_SHARED_LIBS )
48
+ target_compile_definitions (boost_container ${_populate} BOOST_CONTAINER_DYN_LINK)
49
+ else ()
50
+ target_compile_definitions (boost_container ${_populate} BOOST_CONTAINER_STATIC_LINK)
51
+ endif ()
41
52
endif ()
42
53
43
54
if (BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR} /test/CMakeLists.txt" )
0 commit comments