~ubuntu-branches/ubuntu/wily/ledger/wily

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Package Import Robot
  • Author(s): David Bremner
  • Date: 2014-10-08 19:20:38 UTC
  • mfrom: (1.1.3) (9.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20141008192038-py5cxm93rdt3x2uz
Tags: 3.1+dfsg1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
PROJECT(ledger)
4
4
 
5
5
set(Ledger_VERSION_MAJOR 3)
6
 
set(Ledger_VERSION_MINOR 0)
 
6
set(Ledger_VERSION_MINOR 1)
7
7
set(Ledger_VERSION_PATCH 0)
8
 
set(Ledger_VERSION_DATE  20130529)
 
8
set(Ledger_VERSION_DATE  20141005)
9
9
 
10
10
enable_testing()
11
11
 
 
12
add_definitions(-std=c++11)
 
13
 
12
14
########################################################################
13
15
 
14
16
option(USE_PYTHON "Build support for the Python scripting bridge" OFF)
18
20
option(BUILD_DEBUG "Build support for runtime debugging" OFF)
19
21
 
20
22
option(BUILD_LIBRARY "Build and install Ledger as a library" ON)
21
 
option(BUILD_DOCS "Build and install documentation" ON)
 
23
option(BUILD_DOCS "Build and install documentation" OFF)
22
24
option(BUILD_WEB_DOCS "Build version of documentation suitable for viewing online" OFF)
23
25
option(BUILD_EMACSLISP "Build and install ledger-mode for Emacs" OFF)
24
26
 
25
 
if(BUILD_DEBUG)
 
27
if (BUILD_DEBUG)
26
28
  set(CMAKE_BUILD_TYPE Debug)
27
29
  set(DEBUG_MODE 1)
28
30
else()
30
32
  set(DEBUG_MODE 0)
31
33
endif()
32
34
 
33
 
if(DISABLE_ASSERTS)
 
35
if (DISABLE_ASSERTS)
34
36
  set(NO_ASSERTS 1)
35
37
else()
36
38
  set(NO_ASSERTS 0)
37
39
endif()
38
40
 
39
 
if(CLANG_GCOV)
 
41
if (CLANG_GCOV)
40
42
  set(PROFILE_LIBS profile_rt)
41
43
  set(CMAKE_REQUIRED_LIBRARIES ${PROFILE_LIBS})
42
44
endif()
45
47
 
46
48
find_package(PythonInterp)      # Used for running tests
47
49
 
48
 
if(USE_PYTHON)
49
 
  if(NOT BUILD_LIBRARY)
 
50
if (USE_PYTHON)
 
51
  if (NOT BUILD_LIBRARY)
50
52
    message(ERROR "Building the python module requires BUILD_LIBRARY=ON.")
51
53
  endif()
52
54
 
53
55
  set(Python_ADDITIONAL_VERSIONS 2.7 2.6)
54
56
  find_package(PythonLibs)
55
 
  if(PYTHONLIBS_FOUND)
 
57
  if (PYTHONLIBS_FOUND)
56
58
    set(BOOST_PYTHON python)
57
59
    set(HAVE_BOOST_PYTHON 1)
58
60
    include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS})
65
67
endif()
66
68
 
67
69
# Set BOOST_ROOT to help CMake to find the right Boost version
68
 
find_package(Boost 1.46.0
 
70
find_package(Boost 1.49.0
69
71
  REQUIRED date_time filesystem system iostreams regex unit_test_framework
70
72
  ${BOOST_PYTHON})
71
73
 
118
120
  return 0;
119
121
}" UNIX_PIPES_COMPILES)
120
122
 
121
 
if(UNIX_PIPES_COMPILES)
 
123
if (UNIX_PIPES_COMPILES)
122
124
  set(HAVE_UNIX_PIPES 1)
123
125
else()
124
126
  set(HAVE_UNIX_PIPES 0)
140
142
  return u32regex_search(text, r) ? 0 : 1;
141
143
}" BOOST_REGEX_UNICODE_RUNS)
142
144
 
143
 
if(BOOST_REGEX_UNICODE_RUNS)
 
145
if (BOOST_REGEX_UNICODE_RUNS)
144
146
  set(HAVE_BOOST_REGEX_UNICODE 1)
145
147
else()
146
148
  set(HAVE_BOOST_REGEX_UNICODE 0)
148
150
 
149
151
cmake_pop_check_state()
150
152
 
151
 
#cmake_push_check_state()
152
 
#
153
 
#set(CMAKE_REQUIRED_FLAGS -std=c++11)
154
 
#set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH})
155
 
#
156
 
#check_cxx_source_runs("
157
 
##include <regex>
158
 
##include <vector>
159
 
##include <iostream>
160
 
#
161
 
#int main() {
162
 
#  std::vector<int> x {0, 1, 2, 3, 4};
163
 
#  for (auto i : x)
164
 
#    std::cout << i << std::endl;
165
 
#
166
 
#  std::regex r(\"foo\");
167
 
#  std::cout << std::regex_match(\"foobar\", r) << std::endl;
168
 
#  return 0;
169
 
#}" CXX11_RUNS)
170
 
#
171
 
#cmake_pop_check_state()
172
 
#
173
 
#if(CXX11_RUNS)
174
 
#  set(HAVE_CXX11 1)
175
 
#  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
176
 
#else()
177
 
  set(HAVE_CXX11 0)
178
 
#endif()
179
 
#
180
 
#cmake_pop_check_state()
181
 
 
182
153
########################################################################
183
154
 
184
155
include_directories(${CMAKE_INCLUDE_PATH})
185
156
 
186
157
macro(find_opt_library_and_header _header_var _header _lib_var _lib _have_var)
187
 
  if(${_have_var})
 
158
  if (${_have_var})
188
159
    find_path(${_header_var} ${_header})
189
 
    if(NOT ${_header_var})
 
160
    if (NOT ${_header_var})
190
161
      set(${_have_var} 0)
191
162
    else()
192
163
      find_library(${_lib_var} ${_lib})
193
 
      if(NOT ${_lib_var})
 
164
      if (NOT ${_lib_var})
194
165
        set(${_have_var} 0)
195
166
      else()
196
167
        include_directories(SYSTEM "${${_header_var}}")
204
175
 
205
176
macro(find_req_library_and_header _header_var _header _lib_var _lib)
206
177
  find_path(${_header_var} ${_header})
207
 
  if(NOT ${_header_var})
 
178
  if (NOT ${_header_var})
208
179
    message(SEND_ERROR "Could not find ${_header} on your system")
209
180
  else()
210
181
    include_directories(SYSTEM "${${_header_var}}")
211
182
    find_library(${_lib_var} ${_lib})
212
 
    if(NOT ${_lib_var})
 
183
    if (NOT ${_lib_var})
213
184
      message(SEND_ERROR "Could not find library ${_lib} on your system")
214
185
    endif()
215
186
  endif()
223
194
 
224
195
#find_package(Gettext)           # Used for running tests
225
196
 
226
 
#if(GETTEXT_FOUND)
 
197
#if (GETTEXT_FOUND)
227
198
#  set(HAVE_GETTEXT 1)
228
199
#else()
229
200
  set(HAVE_GETTEXT 0)
238
209
macro(add_ledger_library_dependencies _target)
239
210
  target_link_libraries(${_target} ${MPFR_LIB})
240
211
  target_link_libraries(${_target} ${GMP_LIB})
241
 
  if(HAVE_EDIT)
 
212
  if (HAVE_EDIT)
242
213
    target_link_libraries(${_target} ${EDIT_LIB})
243
214
  endif()
244
 
  if(HAVE_GETTEXT)
 
215
  if (HAVE_GETTEXT)
245
216
    target_link_libraries(${_target} ${INTL_LIB})
246
217
  endif()
247
 
  if(HAVE_BOOST_PYTHON)
 
218
  if (HAVE_BOOST_PYTHON)
248
219
    target_link_libraries(${_target} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
249
220
  else()
250
221
    target_link_libraries(${_target} ${Boost_LIBRARIES})
251
222
  endif()
252
 
  if(HAVE_BOOST_REGEX_UNICODE)
 
223
  if (HAVE_BOOST_REGEX_UNICODE)
253
224
    target_link_libraries(${_target} icuuc)
254
225
  endif()
255
226
  target_link_libraries(${_target} ${PROFILE_LIBS})
270
241
  ${PROJECT_SOURCE_DIR}/src/system.hh.in
271
242
  ${PROJECT_BINARY_DIR}/system.hh)
272
243
 
273
 
if(CMAKE_CXX_COMPILER MATCHES "clang")
 
244
if (CMAKE_CXX_COMPILER MATCHES "clang")
274
245
  set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
275
246
elseif(CMAKE_CXX_COMPILER MATCHES "g\\+\\+")
276
247
  set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
278
249
 
279
250
add_subdirectory(src)
280
251
add_subdirectory(doc)
281
 
if(BUILD_EMACSLISP)
 
252
if (BUILD_EMACSLISP)
282
253
  add_subdirectory(lisp)
283
254
endif()
284
255
add_subdirectory(test)