Mercurial > hg > orthanc
annotate Resources/CMake/BoostConfiguration.cmake @ 813:b640aeee11ba
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 08 May 2014 15:15:55 +0200 |
parents | a6576b478553 |
children | 816dccaeb7cf 882833632b1f |
rev | line source |
---|---|
735 | 1 if (STATIC_BUILD OR NOT USE_SYSTEM_BOOST) |
2 set(BOOST_STATIC 1) | |
3 else() | |
4 include(FindBoost) | |
5 | |
6 set(BOOST_STATIC 0) | |
7 #set(Boost_DEBUG 1) | |
8 #set(Boost_USE_STATIC_LIBS ON) | |
9 | |
10 find_package(Boost | |
11 COMPONENTS filesystem thread system date_time regex) | |
12 | |
13 if (NOT Boost_FOUND) | |
14 message(FATAL_ERROR "Unable to locate Boost on this system") | |
15 endif() | |
16 | |
17 # Boost releases 1.44 through 1.47 supply both V2 and V3 filesystem | |
18 # http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/index.htm | |
19 if (${Boost_VERSION} LESS 104400) | |
20 add_definitions( | |
21 -DBOOST_HAS_FILESYSTEM_V3=0 | |
22 ) | |
23 else() | |
24 add_definitions( | |
25 -DBOOST_HAS_FILESYSTEM_V3=1 | |
26 -DBOOST_FILESYSTEM_VERSION=3 | |
27 ) | |
28 endif() | |
29 | |
30 #if (${Boost_VERSION} LESS 104800) | |
31 # boost::locale is only available from 1.48.00 | |
32 #message("Too old version of Boost (${Boost_LIB_VERSION}): Building the static version") | |
33 # set(BOOST_STATIC 1) | |
34 #endif() | |
35 | |
36 include_directories(${Boost_INCLUDE_DIRS}) | |
37 link_libraries(${Boost_LIBRARIES}) | |
38 endif() | |
39 | |
40 | |
41 if (BOOST_STATIC) | |
753
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
42 # Parameters for Boost 1.55.0 |
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
43 set(BOOST_NAME boost_1_55_0) |
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
44 set(BOOST_BCP_SUFFIX bcpdigest-0.7.4) |
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
45 set(BOOST_MD5 "409f7a0e4fb1f5659d07114f3133b67b") |
735 | 46 set(BOOST_FILESYSTEM_SOURCES_DIR "${BOOST_NAME}/libs/filesystem/src") |
47 | |
48 set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME}) | |
49 DownloadPackage( | |
50 "${BOOST_MD5}" | |
51 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz" | |
52 "${BOOST_SOURCES_DIR}" | |
53 ) | |
54 | |
55 set(BOOST_SOURCES) | |
56 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | |
57 list(APPEND BOOST_SOURCES | |
58 ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp | |
59 ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp | |
60 ) | |
61 add_definitions( | |
62 -DBOOST_LOCALE_WITH_ICONV=1 | |
63 ) | |
64 | |
65 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") | |
66 add_definitions(-DBOOST_HAS_SCHED_YIELD=1) | |
67 endif() | |
68 | |
69 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
70 list(APPEND BOOST_SOURCES | |
71 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp | |
72 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/thread.cpp | |
73 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_pe.cpp | |
74 ${BOOST_FILESYSTEM_SOURCES_DIR}/windows_file_codecvt.cpp | |
75 ) | |
76 add_definitions( | |
77 -DBOOST_LOCALE_WITH_WCONV=1 | |
78 ) | |
79 else() | |
80 message(FATAL_ERROR "Support your platform here") | |
81 endif() | |
82 | |
83 aux_source_directory(${BOOST_SOURCES_DIR}/libs/regex/src BOOST_REGEX_SOURCES) | |
84 | |
85 list(APPEND BOOST_SOURCES | |
86 ${BOOST_REGEX_SOURCES} | |
87 ${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp | |
88 ${BOOST_FILESYSTEM_SOURCES_DIR}/codecvt_error_category.cpp | |
89 ${BOOST_FILESYSTEM_SOURCES_DIR}/operations.cpp | |
90 ${BOOST_FILESYSTEM_SOURCES_DIR}/path.cpp | |
91 ${BOOST_FILESYSTEM_SOURCES_DIR}/path_traits.cpp | |
92 ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp | |
93 ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp | |
94 ) | |
95 | |
96 list(APPEND THIRD_PARTY_SOURCES ${BOOST_SOURCES}) | |
97 | |
98 add_definitions( | |
99 # Static build of Boost | |
100 -DBOOST_ALL_NO_LIB | |
101 -DBOOST_ALL_NOLIB | |
102 -DBOOST_DATE_TIME_NO_LIB | |
103 -DBOOST_THREAD_BUILD_LIB | |
104 -DBOOST_PROGRAM_OPTIONS_NO_LIB | |
105 -DBOOST_REGEX_NO_LIB | |
106 -DBOOST_SYSTEM_NO_LIB | |
107 -DBOOST_LOCALE_NO_LIB | |
108 -DBOOST_HAS_LOCALE=1 | |
109 -DBOOST_HAS_FILESYSTEM_V3=1 | |
110 ) | |
111 | |
112 if (${CMAKE_COMPILER_IS_GNUCXX}) | |
113 add_definitions(-isystem ${BOOST_SOURCES_DIR}) | |
114 endif() | |
115 | |
116 include_directories( | |
117 ${BOOST_SOURCES_DIR} | |
118 ) | |
119 | |
120 source_group(ThirdParty\\Boost REGULAR_EXPRESSION ${BOOST_SOURCES_DIR}/.*) | |
121 else() | |
122 add_definitions( | |
123 -DBOOST_HAS_LOCALE=0 | |
124 ) | |
125 endif() |