target_enable_boost.cmake 924 Bytes
Newer Older
Praetorius, Simon's avatar
Praetorius, Simon committed
1
macro(target_enable_boost)
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  if (BOOST_ROOT)
      file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
  endif (BOOST_ROOT)
  if (BOOST_LIBRARYDIR)
      file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
  endif (BOOST_LIBRARYDIR)

  set(BOOST_VERSION "1.48")
  set(BOOST_LIBS_REQUIRED system iostreams filesystem program_options date_time)
  if (WIN32)
    list(APPEND BOOST_LIBS_REQUIRED zlib)
    if (ENABLE_COMPRESSION OR AMDIS_NEED_COMPRESSION)
      list(APPEND BOOST_LIBS_REQUIRED bzip2)
    endif (ENABLE_COMPRESSION OR AMDIS_NEED_COMPRESSION)
  endif (WIN32)

  if (NOT BUILD_SHARED_LIBS)
      set(Boost_USE_STATIC_LIBS ON)
  endif (NOT BUILD_SHARED_LIBS)

  find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS ${BOOST_LIBS_REQUIRED})
Praetorius, Simon's avatar
Praetorius, Simon committed
23
24
25
26
27
  if (${ARGC} GREATER 0)
    foreach (_C ${BOOST_LIBS_REQUIRED})
      target_link_libraries(${ARGV0} Boost::${_C})
    endforeach ()
  endif ()
28
endmacro(target_enable_boost)