]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/CMakeLists.txt
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / log / CMakeLists.txt
1 # Copyright 2021-2022 Andrey Semashev
2 #
3 # Distributed under the Boost Software License, Version 1.0.
4 # See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
5
6 cmake_minimum_required(VERSION 3.5)
7 project(BoostLog VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
8
9 include(CheckCXXSourceCompiles)
10
11 set(BOOST_LOG_NO_THREADS OFF CACHE BOOL "Disable multithreading support in Boost.Log")
12 set(BOOST_LOG_WITHOUT_CHAR OFF CACHE BOOL "Disable support for narrow character logging in Boost.Log")
13 set(BOOST_LOG_WITHOUT_WCHAR_T OFF CACHE BOOL "Disable support for wide character logging in Boost.Log")
14 set(BOOST_LOG_WITHOUT_DEFAULT_FACTORIES OFF CACHE BOOL "Disable default factories for filters and formatters in Boost.Log")
15 set(BOOST_LOG_WITHOUT_SETTINGS_PARSERS OFF CACHE BOOL "Disable settings, filter and formatter parsers in Boost.Log")
16 if (WIN32)
17 set(BOOST_LOG_NO_QUERY_PERFORMANCE_COUNTER OFF CACHE BOOL "Disable using QueryPerformanceCounter API on Windows in Boost.Log")
18 set(BOOST_LOG_WITHOUT_DEBUG_OUTPUT OFF CACHE BOOL "Disable support for debugger output on Windows in Boost.Log")
19 set(BOOST_LOG_WITHOUT_EVENT_LOG OFF CACHE BOOL "Disable support for event log on Windows in Boost.Log")
20 endif()
21 set(BOOST_LOG_WITHOUT_IPC OFF CACHE BOOL "Disable support for inter-process communication in Boost.Log")
22 set(BOOST_LOG_WITHOUT_SYSLOG OFF CACHE BOOL "Disable support for syslog API in Boost.Log")
23 set(BOOST_LOG_USE_NATIVE_SYSLOG OFF CACHE BOOL "Force-enable using native syslog API in Boost.Log")
24 set(BOOST_LOG_USE_COMPILER_TLS OFF CACHE BOOL "Enable using compiler-specific intrinsics for thread-local storage in Boost.Log")
25
26 set(BOOST_LOG_REGEX_BACKENDS "std::regex" "Boost.Regex" "Boost.Xpressive")
27 set(BOOST_LOG_USE_REGEX_BACKEND "Boost.Regex" CACHE STRING "Regular expressions backend to use in Boost.Log")
28 set_property(CACHE BOOST_LOG_USE_REGEX_BACKEND PROPERTY STRINGS ${BOOST_LOG_REGEX_BACKENDS})
29 if (NOT BOOST_LOG_USE_REGEX_BACKEND IN_LIST BOOST_LOG_REGEX_BACKENDS)
30 message(FATAL_ERROR "BOOST_LOG_USE_REGEX_BACKEND must be one of: ${BOOST_LOG_REGEX_BACKENDS}")
31 endif()
32
33 if (NOT BOOST_LOG_NO_THREADS)
34 set(THREADS_PREFER_PTHREAD_FLAG ON)
35 find_package(Threads REQUIRED)
36 endif()
37
38 # Note: We can't use the Boost::library targets in the configure checks as they may not yet be included
39 # by the superproject when this CMakeLists.txt is included. We also don't want to hardcode include paths
40 # of the needed libraries and their dependencies, recursively, as this is too fragile and requires maintenance.
41 # Instead, we collect include paths of all libraries and use them in the configure checks. This works faster
42 # if there is a unified Boost include tree in the filesystem (i.e. if `b2 headers` was run or we're in the
43 # official monolithic Boost distribution tree).
44 include(cmake/BoostLibraryIncludes.cmake)
45
46 set(CMAKE_REQUIRED_INCLUDES ${BOOST_LIBRARY_INCLUDES})
47
48 check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/../config/checks/architecture/x86.cpp>\nint main() {}" BOOST_LOG_TARGET_X86)
49
50 set(CMAKE_REQUIRED_DEFINITIONS "-DBOOST_ALL_NO_LIB")
51 check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/atomic-int32/atomic_int32.cpp>" BOOST_LOG_HAS_LOCK_FREE_ATOMIC_INT32)
52 unset(CMAKE_REQUIRED_DEFINITIONS)
53
54 if (BOOST_LOG_TARGET_X86)
55 if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
56 if (CMAKE_SIZEOF_VOID_P EQUAL 4)
57 set(boost_log_ssse3_cflags "/arch:SSE2")
58 set(boost_log_avx2_cflags "/arch:AVX")
59 endif()
60 elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
61 if (WIN32)
62 set(boost_log_ssse3_cflags "/QxSSSE3")
63 set(boost_log_avx2_cflags "/arch:CORE-AVX2")
64 else()
65 set(boost_log_ssse3_cflags "-xSSSE3")
66 set(boost_log_avx2_cflags "-xCORE-AVX2 -fabi-version=0")
67 endif()
68 else()
69 set(boost_log_ssse3_cflags "-msse -msse2 -msse3 -mssse3")
70 set(boost_log_avx2_cflags "-mavx -mavx2")
71 if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
72 string(APPEND boost_log_avx2_cflags " -fabi-version=0")
73 endif()
74 endif()
75
76 set(CMAKE_REQUIRED_FLAGS "${boost_log_ssse3_cflags}")
77 check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/x86-ext/ssse3.cpp>" BOOST_LOG_COMPILER_HAS_SSSE3)
78 unset(CMAKE_REQUIRED_FLAGS)
79 set(CMAKE_REQUIRED_FLAGS "${boost_log_avx2_cflags}")
80 check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/x86-ext/avx2.cpp>" BOOST_LOG_COMPILER_HAS_AVX2)
81 unset(CMAKE_REQUIRED_FLAGS)
82 endif()
83
84 if (NOT BOOST_LOG_WITHOUT_SYSLOG AND NOT BOOST_LOG_USE_NATIVE_SYSLOG)
85 check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/native-syslog/native_syslog.cpp>" BOOST_LOG_HAS_NATIVE_SYSLOG)
86 endif()
87
88 if (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
89 # Solaris headers are broken and cannot be included in C++03 when _XOPEN_SOURCE=600. At the same time, they cannot be included with _XOPEN_SOURCE=500 in C++11 and later.
90 # This is because the system headers check the C language version and error out if the version does not match. We have to test if we can request _XOPEN_SOURCE=600.
91 check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/xopen-source-600/xopen_source_600.cpp>" BOOST_LOG_HAS_XOPEN_SOURCE_600)
92 endif()
93
94 unset(CMAKE_REQUIRED_INCLUDES)
95
96 set(boost_log_common_public_defines
97 # NOTE:
98 # We deactivate autolinking, because cmake based builds don't need it
99 # and we don't implement name mangling for the library file anyway.
100 # Ususally the parent CMakeLists.txt file should already have globally defined BOOST_ALL_NO_LIB
101 BOOST_LOG_NO_LIB
102 )
103
104 set(boost_log_common_private_defines
105 __STDC_CONSTANT_MACROS
106 BOOST_SPIRIT_USE_PHOENIX_V3=1
107 BOOST_THREAD_DONT_USE_CHRONO=1 # Don't introduce false dependency on Boost.Chrono
108 )
109
110 set(boost_log_private_defines
111 BOOST_LOG_BUILDING_THE_LIB
112 )
113
114 set(boost_log_setup_private_defines
115 BOOST_LOG_SETUP_BUILDING_THE_LIB
116 )
117
118 if (BUILD_SHARED_LIBS)
119 list(APPEND boost_log_common_public_defines BOOST_LOG_DYN_LINK)
120 list(APPEND boost_log_private_defines BOOST_LOG_DLL)
121 list(APPEND boost_log_setup_private_defines BOOST_LOG_SETUP_DLL)
122 else()
123 list(APPEND boost_log_common_public_defines BOOST_LOG_STATIC_LINK)
124 endif()
125
126 set(boost_log_sources
127 src/alignment_gap_between.hpp
128 src/attribute_name.cpp
129 src/attribute_set_impl.hpp
130 src/attribute_set.cpp
131 src/attribute_value_set.cpp
132 src/bit_tools.hpp
133 src/code_conversion.cpp
134 src/stateless_allocator.hpp
135 src/unique_ptr.hpp
136 src/core.cpp
137 src/record_ostream.cpp
138 src/severity_level.cpp
139 src/global_logger_storage.cpp
140 src/named_scope.cpp
141 src/process_name.cpp
142 src/process_id.cpp
143 src/thread_id.cpp
144 src/id_formatting.hpp
145 src/murmur3.hpp
146 src/timer.cpp
147 src/exceptions.cpp
148 src/default_attribute_names.cpp
149 src/default_sink.hpp
150 src/default_sink.cpp
151 src/text_ostream_backend.cpp
152 src/text_file_backend.cpp
153 src/text_multifile_backend.cpp
154 src/thread_specific.cpp
155 src/once_block.cpp
156 src/timestamp.cpp
157 src/threadsafe_queue.cpp
158 src/event.cpp
159 src/trivial.cpp
160 src/spirit_encoding.hpp
161 src/spirit_encoding.cpp
162 src/format_parser.cpp
163 src/date_time_format_parser.cpp
164 src/named_scope_format_parser.cpp
165 src/permissions.cpp
166 src/dump.cpp
167 )
168
169 if (BOOST_LOG_COMPILER_HAS_SSSE3)
170 set(boost_log_sources_ssse3 src/dump_ssse3.cpp)
171 set_source_files_properties(${boost_log_sources_ssse3} PROPERTIES COMPILE_FLAGS "${boost_log_ssse3_cflags}")
172 list(APPEND boost_log_private_defines BOOST_LOG_USE_SSSE3)
173 endif()
174 if (BOOST_LOG_COMPILER_HAS_AVX2)
175 set(boost_log_sources_avx2 src/dump_avx2.cpp)
176 set_source_files_properties(${boost_log_sources_avx2} PROPERTIES COMPILE_FLAGS "${boost_log_avx2_cflags}")
177 list(APPEND boost_log_private_defines BOOST_LOG_USE_AVX2)
178 endif()
179
180 if (NOT BOOST_LOG_WITHOUT_SYSLOG)
181 list(APPEND boost_log_sources src/syslog_backend.cpp)
182 if (BOOST_LOG_USE_NATIVE_SYSLOG OR BOOST_LOG_HAS_NATIVE_SYSLOG)
183 list(APPEND boost_log_common_private_defines BOOST_LOG_USE_NATIVE_SYSLOG)
184 endif()
185 endif()
186
187 if (WIN32)
188 list(APPEND boost_log_sources
189 src/windows/light_rw_mutex.cpp
190 src/windows/is_debugger_present.cpp
191 )
192 list(APPEND boost_log_common_private_defines
193 # Disable warnings about using 'insecure' standard C functions.
194 # These affect MSVC C/C++ library headers, which are used by various compilers.
195 _SCL_SECURE_NO_WARNINGS
196 _SCL_SECURE_NO_DEPRECATE
197 _CRT_SECURE_NO_WARNINGS
198 _CRT_SECURE_NO_DEPRECATE
199 )
200
201 if (NOT BOOST_LOG_WITHOUT_DEBUG_OUTPUT)
202 list(APPEND boost_log_sources src/windows/debug_output_backend.cpp)
203 endif()
204
205 if (NOT BOOST_LOG_WITHOUT_IPC)
206 list(APPEND boost_log_sources
207 src/windows/auto_handle.hpp
208 src/windows/object_name.cpp
209 src/windows/utf_code_conversion.hpp
210 src/windows/mapped_shared_memory.hpp
211 src/windows/mapped_shared_memory.cpp
212 src/windows/ipc_sync_wrappers.hpp
213 src/windows/ipc_sync_wrappers.cpp
214 src/windows/ipc_reliable_message_queue.cpp
215 )
216 list(APPEND boost_log_private_libs
217 secur32
218 )
219 endif()
220
221 if (NOT BOOST_LOG_WITHOUT_EVENT_LOG)
222 # Find message compiler (mc)
223 if (NOT CMAKE_MC_COMPILER AND DEFINED ENV{MC} AND EXISTS "$ENV{MC}" AND NOT IS_DIRECTORY "$ENV{MC}")
224 set(CMAKE_MC_COMPILER "$ENV{MC}")
225 endif()
226 if (NOT CMAKE_MC_COMPILER)
227 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
228 set(mc_executable "windmc.exe")
229 else()
230 set(mc_executable "mc.exe")
231 endif()
232 if (CMAKE_RC_COMPILER)
233 # Use resource compiler directory as a hint. CMake will initialize CMAKE_RC_COMPILER
234 # automatically based on environment variables, and message compiler typically resides
235 # in the same directory in the Windows SDK installation. Reusing resource compiler
236 # directory also provides user's choice of Windows SDK version and host and target
237 # architecture.
238 get_filename_component(rc_compiler_path "${CMAKE_RC_COMPILER}" DIRECTORY)
239 list(APPEND mc_search_hints "${rc_compiler_path}")
240 endif()
241 if (CMAKE_CXX_COMPILER)
242 # Message compiler can be located next to the compiler, e.g. on MinGW installations.
243 get_filename_component(cxx_compiler_path "${CMAKE_CXX_COMPILER}" DIRECTORY)
244 list(APPEND mc_search_hints "${cxx_compiler_path}")
245 endif()
246 message(DEBUG "Boost.Log: ${mc_executable} search hints: ${mc_search_hints}")
247 find_program(CMAKE_MC_COMPILER "${mc_executable}" HINTS "${mc_search_hints}")
248 if (CMAKE_MC_COMPILER STREQUAL "CMAKE_MC_COMPILER-NOTFOUND")
249 message(STATUS "Boost.Log: Message compiler ${mc_executable} not found, event log support will be disabled.")
250 unset(CMAKE_MC_COMPILER)
251 else()
252 message(STATUS "Boost.Log: Message compiler found: ${CMAKE_MC_COMPILER}")
253 endif()
254 endif()
255
256 if (CMAKE_MC_COMPILER)
257 add_custom_command(
258 OUTPUT
259 "${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.h"
260 "${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.rc"
261 COMMAND "${CMAKE_MC_COMPILER}"
262 ARGS
263 -h "${CMAKE_CURRENT_BINARY_DIR}/src/windows"
264 -r "${CMAKE_CURRENT_BINARY_DIR}/src/windows"
265 "${CMAKE_CURRENT_SOURCE_DIR}/src/windows/simple_event_log.mc"
266 MAIN_DEPENDENCY
267 "${CMAKE_CURRENT_SOURCE_DIR}/src/windows/simple_event_log.mc"
268 COMMENT
269 "Building src/windows/simple_event_log.mc"
270 VERBATIM
271 )
272 set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.h" PROPERTIES GENERATED TRUE)
273 set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.rc" PROPERTIES GENERATED TRUE)
274
275 list(APPEND boost_log_sources
276 "${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.h"
277 "${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.rc"
278 src/windows/event_log_registry.hpp
279 src/windows/event_log_backend.cpp
280 )
281 list(APPEND boost_log_private_libs
282 psapi
283 )
284 else()
285 set(BOOST_LOG_WITHOUT_EVENT_LOG ON)
286 endif()
287 endif()
288 else()
289 if (NOT BOOST_LOG_WITHOUT_IPC)
290 list(APPEND boost_log_sources
291 src/posix/object_name.cpp
292 src/posix/ipc_sync_wrappers.hpp
293 src/posix/ipc_reliable_message_queue.cpp
294 )
295 endif()
296 endif()
297
298 if (CYGWIN)
299 # Boost.Interprocess does not compile on Cygwin: https://github.com/boostorg/interprocess/issues/76
300 set(BOOST_LOG_WITHOUT_IPC ON)
301 list(APPEND boost_log_common_private_defines
302 __USE_W32_SOCKETS
303 _XOPEN_SOURCE=600
304 )
305 endif()
306
307 if (WIN32 OR CYGWIN)
308 list(APPEND boost_log_common_private_defines
309 BOOST_USE_WINDOWS_H
310 WIN32_LEAN_AND_MEAN
311 NOMINMAX
312 SECURITY_WIN32
313 )
314 list(APPEND boost_log_private_libs
315 ws2_32
316 mswsock
317 advapi32
318 )
319 endif()
320
321 if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
322 list(APPEND boost_log_common_private_defines _XOPEN_SOURCE=600)
323 list(APPEND boost_log_private_libs rt)
324 endif()
325
326 if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
327 list(APPEND boost_log_private_libs rt)
328 endif()
329
330 if (CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
331 list(APPEND boost_log_common_private_defines _XOPEN_SOURCE=600)
332 list(APPEND boost_log_private_libs ipv6)
333 endif()
334
335 if (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
336 if (BOOST_LOG_HAS_XOPEN_SOURCE_600)
337 list(APPEND boost_log_common_private_defines _XOPEN_SOURCE=600)
338 else()
339 list(APPEND boost_log_common_private_defines _XOPEN_SOURCE=500)
340 endif()
341 list(APPEND boost_log_common_private_defines __EXTENSIONS__)
342 list(APPEND boost_log_private_libs
343 socket
344 nsl
345 )
346 endif()
347
348 if (BOOST_LOG_USE_REGEX_BACKEND STREQUAL "Boost.Regex")
349 set(boost_log_regex_backend_private_libs Boost::regex)
350 list(APPEND boost_log_common_private_defines BOOST_LOG_USE_BOOST_REGEX)
351 elseif (BOOST_LOG_USE_REGEX_BACKEND STREQUAL "Boost.Xpressive")
352 set(boost_log_regex_backend_private_libs Boost::xpressive)
353 list(APPEND boost_log_common_private_defines BOOST_LOG_USE_BOOST_XPRESSIVE)
354 else()
355 list(APPEND boost_log_common_private_defines BOOST_LOG_USE_STD_REGEX)
356 endif()
357
358
359 if (BOOST_LOG_NO_THREADS)
360 list(APPEND boost_log_common_public_defines BOOST_LOG_NO_THREADS)
361 endif()
362 if (BOOST_LOG_WITHOUT_CHAR)
363 list(APPEND boost_log_common_public_defines BOOST_LOG_WITHOUT_CHAR)
364 endif()
365 if (BOOST_LOG_WITHOUT_WCHAR_T)
366 list(APPEND boost_log_common_public_defines BOOST_LOG_WITHOUT_WCHAR_T)
367 endif()
368 if (BOOST_LOG_WITHOUT_DEFAULT_FACTORIES)
369 list(APPEND boost_log_setup_private_defines BOOST_LOG_WITHOUT_DEFAULT_FACTORIES)
370 endif()
371 if (BOOST_LOG_WITHOUT_SETTINGS_PARSERS)
372 list(APPEND boost_log_setup_private_defines BOOST_LOG_WITHOUT_SETTINGS_PARSERS)
373 endif()
374 if (BOOST_LOG_WITHOUT_SYSLOG)
375 list(APPEND boost_log_common_private_defines BOOST_LOG_WITHOUT_SYSLOG)
376 endif()
377 if (BOOST_LOG_WITHOUT_IPC)
378 list(APPEND boost_log_common_private_defines BOOST_LOG_WITHOUT_IPC)
379 endif()
380 if (WIN32)
381 if (BOOST_LOG_NO_QUERY_PERFORMANCE_COUNTER)
382 list(APPEND boost_log_common_private_defines BOOST_LOG_NO_QUERY_PERFORMANCE_COUNTER)
383 endif()
384 if (BOOST_LOG_WITHOUT_DEBUG_OUTPUT)
385 list(APPEND boost_log_common_private_defines BOOST_LOG_WITHOUT_DEBUG_OUTPUT)
386 endif()
387 if (BOOST_LOG_WITHOUT_EVENT_LOG)
388 list(APPEND boost_log_common_private_defines BOOST_LOG_WITHOUT_EVENT_LOG)
389 endif()
390 endif()
391
392
393 if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
394 list(APPEND boost_log_common_private_cxxflags
395 /bigobj
396 /wd4503 # decorated name length exceeded, name was truncated
397 /wd4456 # declaration of 'A' hides previous local declaration
398 /wd4459 # declaration of 'A' hides global declaration
399 /wd4003 # not enough actual parameters for macro 'X' - caused by BOOST_PP_IS_EMPTY and BOOST_PP_IS_BEGIN_PARENS which are used by Fusion
400 )
401 endif()
402
403 if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
404 # Disable Intel warnings:
405 # warning #177: function "X" was declared but never referenced
406 # warning #780: using-declaration ignored -- it refers to the current namespace
407 # warning #2196: routine is both "inline" and "noinline"
408 # remark #1782: #pragma once is obsolete. Use #ifndef guard instead.
409 # remark #193: zero used for undefined preprocessing identifier "X"
410 # remark #304: access control not specified ("public" by default)
411 # remark #981: operands are evaluated in unspecified order
412 # remark #1418: external function definition with no prior declaration
413 # Mostly comes from Boost.Phoenix: warning #411: class "X" defines no constructor to initialize the following: reference member "Y"...
414 # warning #734: "X" (declared at line N of "file.hpp"), required for copy that was eliminated, is inaccessible
415 # warning #279: controlling expression is constant
416 if (WIN32)
417 list(APPEND boost_log_common_private_cxxflags
418 "/Qwd177,780,2196,1782,193,304,981,1418,411,734,279"
419 )
420 else()
421 list(APPEND boost_log_common_private_cxxflags
422 "-wd177,780,2196,1782,193,304,981,1418,411,734,279"
423 )
424 endif()
425 endif()
426
427 if ((WIN32 OR CYGWIN) AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
428 list(APPEND boost_log_common_private_linkflags
429 -Wl,--enable-auto-import
430 )
431 endif()
432
433
434 add_library(boost_log
435 ${boost_log_sources}
436 ${boost_log_sources_ssse3}
437 ${boost_log_sources_avx2}
438 )
439 if (BOOST_SUPERPROJECT_VERSION)
440 set_target_properties(boost_log PROPERTIES VERSION "${BOOST_SUPERPROJECT_VERSION}")
441 endif()
442 set(boost_log_install_targets boost_log)
443 add_library(Boost::log ALIAS boost_log)
444
445 target_include_directories(boost_log
446 PUBLIC
447 include
448 PRIVATE
449 src
450 "${CMAKE_CURRENT_BINARY_DIR}/src"
451 )
452
453 target_link_libraries(boost_log
454 PUBLIC
455 Boost::array
456 Boost::assert
457 Boost::config
458 Boost::container
459 Boost::core
460 Boost::date_time
461 Boost::filesystem
462 Boost::function_types
463 Boost::fusion
464 Boost::intrusive
465 Boost::move
466 Boost::mpl
467 Boost::parameter
468 Boost::phoenix
469 Boost::predef
470 Boost::preprocessor
471 Boost::proto
472 Boost::range
473 Boost::smart_ptr
474 Boost::static_assert
475 Boost::system
476 Boost::throw_exception
477 Boost::type_index
478 Boost::type_traits
479 Boost::utility
480 Boost::winapi
481
482 PRIVATE
483 Boost::align
484 Boost::asio
485 Boost::bind
486 Boost::exception
487 Boost::interprocess
488 Boost::lexical_cast
489 Boost::optional
490 Boost::random
491 Boost::spirit
492 ${boost_log_regex_backend_private_libs}
493 )
494
495 if (NOT BOOST_LOG_NO_THREADS)
496 target_link_libraries(boost_log
497 PUBLIC
498 Boost::atomic
499 Boost::thread
500 )
501 endif()
502
503 target_compile_definitions(boost_log
504 PUBLIC
505 ${boost_log_common_public_defines}
506 ${boost_log_public_defines}
507 PRIVATE
508 ${boost_log_common_private_defines}
509 ${boost_log_private_defines}
510 )
511
512 target_compile_options(boost_log
513 PRIVATE
514 ${boost_log_common_private_cxxflags}
515 )
516
517 target_link_libraries(boost_log
518 PUBLIC
519 ${boost_log_public_libs}
520 PRIVATE
521 ${boost_log_private_libs}
522 ${boost_log_common_private_linkflags}
523 )
524
525 # An alias target for Boost::log but with all optional dependencies (i.e. for support headers)
526 add_library(boost_log_with_support INTERFACE)
527 add_library(Boost::log_with_support ALIAS boost_log_with_support)
528
529 target_link_libraries(boost_log_with_support
530 INTERFACE
531 Boost::log
532
533 Boost::exception
534 Boost::regex
535 Boost::spirit
536 Boost::xpressive
537 )
538
539
540 set(boost_log_setup_public_deps
541 Boost::log
542
543 Boost::assert
544 Boost::config
545 Boost::core
546 Boost::iterator
547 Boost::lexical_cast
548 Boost::move
549 Boost::optional
550 Boost::parameter
551 Boost::phoenix
552 Boost::preprocessor
553 Boost::property_tree
554 Boost::smart_ptr
555 Boost::type_traits
556 )
557
558 if (NOT BOOST_LOG_WITHOUT_SETTINGS_PARSERS)
559 set(boost_log_setup_sources
560 src/setup/parser_utils.hpp
561 src/setup/parser_utils.cpp
562 src/setup/init_from_stream.cpp
563 src/setup/init_from_settings.cpp
564 src/setup/settings_parser.cpp
565 src/setup/filter_parser.cpp
566 src/setup/formatter_parser.cpp
567 )
568
569 if (NOT BOOST_LOG_WITHOUT_DEFAULT_FACTORIES)
570 list(APPEND boost_log_setup_sources
571 src/setup/default_filter_factory.hpp
572 src/setup/default_filter_factory.cpp
573 src/setup/matches_relation_factory.cpp
574 src/setup/default_formatter_factory.hpp
575 src/setup/default_formatter_factory.cpp
576 )
577 endif()
578
579 add_library(boost_log_setup ${boost_log_setup_sources})
580 if (BOOST_SUPERPROJECT_VERSION)
581 set_target_properties(boost_log_setup PROPERTIES VERSION "${BOOST_SUPERPROJECT_VERSION}")
582 endif()
583 list(APPEND boost_log_install_targets boost_log_setup)
584
585 target_include_directories(boost_log_setup
586 PUBLIC
587 include
588 PRIVATE
589 src
590 )
591
592 target_link_libraries(boost_log_setup
593 PUBLIC
594 ${boost_log_setup_public_deps}
595
596 PRIVATE
597 Boost::asio
598 Boost::bind
599 Boost::date_time
600 Boost::exception
601 Boost::filesystem
602 Boost::io
603 Boost::spirit
604 Boost::throw_exception
605 Boost::utility
606 )
607
608 if (NOT BOOST_LOG_WITHOUT_DEFAULT_FACTORIES)
609 target_link_libraries(boost_log_setup
610 PRIVATE
611 Boost::fusion
612 Boost::mpl
613 ${boost_log_regex_backend_private_libs}
614 )
615 endif()
616
617 target_compile_definitions(boost_log_setup
618 PUBLIC
619 ${boost_log_common_public_defines}
620 PRIVATE
621 ${boost_log_common_private_defines}
622 ${boost_log_setup_private_defines}
623 )
624
625 target_compile_options(boost_log_setup
626 PRIVATE
627 ${boost_log_common_private_cxxflags}
628 )
629
630 target_link_libraries(boost_log_setup
631 PRIVATE
632 ${boost_log_common_private_linkflags}
633 )
634 else()
635 add_library(boost_log_setup INTERFACE)
636 target_include_directories(boost_log_setup INTERFACE include)
637 target_compile_definitions(boost_log_setup INTERFACE ${boost_log_common_public_defines})
638 target_link_libraries(boost_log_setup INTERFACE ${boost_log_setup_public_deps})
639 endif()
640
641 add_library(Boost::log_setup ALIAS boost_log_setup)
642
643 if (BOOST_SUPERPROJECT_VERSION AND NOT CMAKE_VERSION VERSION_LESS 3.13)
644 boost_install(TARGETS ${boost_log_install_targets} VERSION "${BOOST_SUPERPROJECT_VERSION}" HEADER_DIRECTORY include)
645 endif()