• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 Mike Dev
2# Distributed under the Boost Software License, Version 1.0.
3# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
4#
5# NOTE: CMake support for Boost.Chrono is currently experimental at best
6#       and the interface is likely to change in the future
7
8cmake_minimum_required( VERSION 3.5 )
9project( BoostChrono LANGUAGES CXX)
10
11add_library( boost_chrono
12    src/chrono.cpp
13    src/process_cpu_clocks.cpp
14    src/thread_clock.cpp
15)
16add_library( Boost::chrono ALIAS boost_chrono )
17
18target_include_directories( boost_chrono PUBLIC include )
19target_compile_definitions( boost_chrono
20    PUBLIC
21        # NOTE:
22        # We deactivate autolinking because cmake based builds don't need it
23        # and we don't implement name mangling for the library file anyway.
24        # Ususally the parent CMakeLists.txt file should already have globally defined BOOST_ALL_NO_LIB
25        BOOST_CHRONO_NO_LIB
26        $<$<STREQUAL:$<TARGET_PROPERTY:boost_chrono,TYPE>,SHARED_LIBRARY>:BOOST_CHRONO_DYN_LINK=1>
27        $<$<STREQUAL:$<TARGET_PROPERTY:boost_chrono,TYPE>,STATIC_LIBRARY>:BOOST_CHRONO_STATIC_LINK=1>
28)
29
30target_link_libraries( boost_chrono
31    PUBLIC
32        Boost::assert
33        Boost::config
34        Boost::core
35        Boost::integer
36        Boost::move
37        Boost::mpl
38        Boost::predef
39        Boost::ratio
40        Boost::static_assert
41        Boost::system
42        Boost::throw_exception
43        Boost::type_traits
44        Boost::typeof
45        Boost::utility
46     PRIVATE
47        $<$<STREQUAL:Windows,$<PLATFORM_ID>>:Boost::winapi>
48)
49