-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
88 lines (65 loc) · 1.96 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
cmake_minimum_required(VERSION 2.8.12)
#
# Stop warning on cygwin
#
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
project(libpoly C CXX)
# ctests
include(CTest)
option(LIBPOLY_BUILD_PYTHON_API "Build the Python API" ON)
option(LIBPOLY_BUILD_STATIC_PIC "Build the static PIC library" ON)
option(LIBPOLY_BUILD_STATIC "Build the static library" ON)
option(LIBPOLY_BUILD_STATISTICS "Build the statistics internals" OFF)
set(LIBPOLY_VERSION_MAJOR 0)
set(LIBPOLY_VERSION_MINOR 1)
set(LIBPOLY_VERSION_PATCH 13)
set(LIBPOLY_VERSION ${LIBPOLY_VERSION_MAJOR}.${LIBPOLY_VERSION_MINOR}.${LIBPOLY_VERSION_PATCH})
if(APPLE)
# This is the simplest setting that seems to currently work on the mac.
#
set(CMAKE_MACOSX_RPATH OFF)
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
endif()
#
# Search for GMP. We do this here since GMP_INCLUDE_DIR may be
# required for building the python binding.
#
# Find the GMP number library
find_path(GMP_INCLUDE_DIR gmp.h)
find_library(GMP_LIBRARY gmp)
if (GMP_INCLUDE_DIR AND GMP_LIBRARY)
message(STATUS "GMP headers: " ${GMP_INCLUDE_DIR})
message(STATUS "GMP library: " ${GMP_LIBRARY})
else()
MESSAGE(FATAL_ERROR "Could not the GMP number library (sudo apt-get install libgmp-dev)")
endif()
# statistics configuration
if(LIBPOLY_BUILD_STATISTICS)
add_definitions(-DLIBPOLY_STATISTICS)
endif()
#
# Check for open_memstream
#
include(CheckFunctionExists)
check_function_exists(open_memstream HAVE_OPEN_MEMSTREAM)
if(HAVE_OPEN_MEMSTREAM)
add_definitions(-DHAVE_OPEN_MEMSTREAM)
endif()
# Configure the library source
add_subdirectory(src)
# Configure the headers
add_subdirectory(include)
if(LIBPOLY_BUILD_PYTHON_API)
# Need the Python binary to run tests
find_package(PythonInterp)
# Configure the Python bindings
add_subdirectory(python)
# Configure the Python tests
add_subdirectory(test/python)
endif()
if (BUILD_TESTING)
# Configure the C++ tests
enable_testing()
add_subdirectory(test/poly)
add_subdirectory(test/polyxx)
endif()