find_boost.cmake 1.11 KB
Newer Older
1
if (BOOST_ROOT)
2
    file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
3
4
endif (BOOST_ROOT)
if (BOOST_LIBRARYDIR)
5
    file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
6
7
endif (BOOST_LIBRARYDIR)

8
9
10
11
12
13
14
15
16
17
18
19
20
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 ${BOOST_LIBS_REQUIRED})
21
if (Boost_FOUND)
22
23
24
    add_library(boost INTERFACE)
    target_include_directories(boost INTERFACE ${Boost_INCLUDE_DIR})
    target_link_libraries(boost INTERFACE  ${Boost_LIBRARIES})
25

26
    target_link_libraries(amdis_base INTERFACE boost)
27

28
29
30
31
    if (MSVC_SHARED_LIBS)
        link_directories(${Boost_LIBRARY_DIRS})
        target_compile_definitions(amdis_base INTERFACE ${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
    endif (MSVC_SHARED_LIBS)
32
endif (Boost_FOUND)