comparison Resources/CMake/BoostConfiguration.cmake @ 0:3959d33612cc

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Jul 2012 14:32:22 +0200
parents
children 3a584803783e
comparison
equal deleted inserted replaced
-1:000000000000 0:3959d33612cc
1 if (${STATIC_BUILD})
2 SET(BOOST_STATIC 1)
3 else()
4 find_package(Boost
5 COMPONENTS filesystem thread system)
6
7 if (${Boost_VERSION} LESS 104800)
8 # boost::locale is only available from 1.48.00
9 message("Too old version of Boost (${Boost_LIB_VERSION}): Building the static version")
10 SET(BOOST_STATIC 1)
11 else()
12 SET(BOOST_STATIC 0)
13
14 add_definitions(
15 -DBOOST_FILESYSTEM_VERSION=3
16 )
17
18 include_directories(${Boost_INCLUDE_DIRS})
19 link_libraries(${Boost_LIBRARIES})
20 endif()
21 endif()
22
23
24 if (BOOST_STATIC)
25 SET(BOOST_NAME boost_1_49_0)
26 SET(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME})
27 DownloadPackage("http://switch.dl.sourceforge.net/project/boost/boost/1.49.0/${BOOST_NAME}.tar.gz" "${BOOST_SOURCES_DIR}" "${BOOST_PRELOADED}" "${BOOST_NAME}/boost ${BOOST_NAME}/libs/thread/src ${BOOST_NAME}/libs/system/src ${BOOST_NAME}/libs/filesystem/v3/src ${BOOST_NAME}/libs/locale/src")
28
29 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
30 list(APPEND THIRD_PARTY_SOURCES
31 ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
32 ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
33 )
34 add_definitions(
35 -DBOOST_LOCALE_WITH_ICONV=1
36 )
37 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
38 list(APPEND THIRD_PARTY_SOURCES
39 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp
40 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/thread.cpp
41 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_pe.cpp
42 ${BOOST_SOURCES_DIR}/libs/filesystem/v3/src/windows_file_codecvt.cpp
43 )
44 add_definitions(
45 -DBOOST_LOCALE_WITH_WCONV=1
46 )
47 else()
48 message(FATAL_ERROR "Support your platform here")
49 endif()
50
51 list(APPEND THIRD_PARTY_SOURCES
52 ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
53 ${BOOST_SOURCES_DIR}/libs/filesystem/v3/src/path.cpp
54 ${BOOST_SOURCES_DIR}/libs/filesystem/v3/src/path_traits.cpp
55 ${BOOST_SOURCES_DIR}/libs/filesystem/v3/src/operations.cpp
56 ${BOOST_SOURCES_DIR}/libs/filesystem/v3/src/codecvt_error_category.cpp
57 ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
58 )
59
60 add_definitions(
61 # Static build of Boost
62 -DBOOST_ALL_NO_LIB
63 -DBOOST_ALL_NOLIB
64 -DBOOST_DATE_TIME_NO_LIB
65 -DBOOST_THREAD_BUILD_LIB
66 -DBOOST_PROGRAM_OPTIONS_NO_LIB
67 -DBOOST_REGEX_NO_LIB
68 -DBOOST_SYSTEM_NO_LIB
69 -DBOOST_LOCALE_NO_LIB
70 )
71
72 include_directories(
73 ${BOOST_SOURCES_DIR}
74 )
75 endif()