summaryrefslogtreecommitdiff
path: root/indra/cmake/Boost.cmake
blob: 31bb4124c2fe253ef085985a2df7d7ac6060af15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- cmake -*-
include(Prebuilt)

include_guard()

add_library( ll::boost INTERFACE IMPORTED )
if( USE_CONAN )
  target_link_libraries( ll::boost INTERFACE CONAN_PKG::boost )
  target_compile_definitions( ll::boost INTERFACE BOOST_ALLOW_DEPRECATED_HEADERS BOOST_BIND_GLOBAL_PLACEHOLDERS )
  return()
elseif( NOT USE_AUTOBUILD_3P )
  if (DARWIN)
    set(sfx "-mt")
    target_include_directories( ll::boost SYSTEM INTERFACE /opt/local/libexec/boost/1.81/include)
    target_link_directories( ll::boost INTERFACE /opt/local/libexec/boost/1.81/lib)
  else (DARWIN)
    find_package( Boost REQUIRED )
  endif (DARWIN)
  target_link_libraries( ll::boost INTERFACE
    boost_context${sfx}
    boost_fiber${sfx}
    boost_filesystem${sfx}
    boost_program_options${sfx}
    boost_regex${sfx}
    boost_system${sfx}
    boost_thread${sfx}
    boost_url${sfx}
    )
  target_compile_definitions( ll::boost INTERFACE BOOST_BIND_GLOBAL_PLACEHOLDERS )
  return()
endif()

use_prebuilt_binary(boost)

# As of sometime between Boost 1.67 and 1.72, Boost libraries are suffixed
# with the address size.
set(addrsfx "-x${ADDRESS_SIZE}")

if (WINDOWS)
  target_link_libraries( ll::boost INTERFACE
          libboost_context-mt${addrsfx}
          libboost_fiber-mt${addrsfx}
          libboost_filesystem-mt${addrsfx}
          libboost_program_options-mt${addrsfx}
          libboost_regex-mt${addrsfx}
          libboost_system-mt${addrsfx}
          libboost_thread-mt${addrsfx}
          libboost_url-mt${addrsfx})
elseif (LINUX)
  target_link_libraries( ll::boost INTERFACE
          boost_fiber-mt${addrsfx}
          boost_context-mt${addrsfx}
          boost_filesystem-mt${addrsfx}
          boost_program_options-mt${addrsfx}
          boost_regex-mt${addrsfx}
          boost_system-mt${addrsfx}
          boost_thread-mt${addrsfx}
          boost_url-mt${addrsfx})
elseif (DARWIN)
  target_link_libraries( ll::boost INTERFACE
          boost_context-mt${addrsfx}
          boost_fiber-mt${addrsfx}
          boost_filesystem-mt${addrsfx}
          boost_program_options-mt${addrsfx}
          boost_regex-mt${addrsfx}
          boost_system-mt${addrsfx}
          boost_thread-mt${addrsfx}
          boost_url-mt${addrsfx})
endif (WINDOWS)

if (LINUX)
    set(BOOST_SYSTEM_LIBRARY ${BOOST_SYSTEM_LIBRARY} rt)
    set(BOOST_THREAD_LIBRARY ${BOOST_THREAD_LIBRARY} rt)
endif (LINUX)