-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
84 lines (65 loc) · 2.02 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
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(react)
FILE (READ "${CMAKE_CURRENT_SOURCE_DIR}/debian/changelog" DEBCHANGELOG)
string(REGEX MATCH "([0-9]+\\.[0-9]+\\.[0-9]+)" DEBFULLVERSION "${DEBCHANGELOG}")
STRING(REGEX MATCH "([0-9]+\\.[0-9]+)" REACT_VERSION_ABI "${DEBFULLVERSION}")
string(REPLACE "." ";" VERSION_LIST ${DEBFULLVERSION})
list(GET VERSION_LIST 0 REACT_VERSION_0)
list(GET VERSION_LIST 1 REACT_VERSION_1)
list(GET VERSION_LIST 2 REACT_VERSION_2)
add_definitions(-DCONFIG_REACT_VERSION_0=${REACT_VERSION_0})
add_definitions(-DCONFIG_REACT_VERSION_1=${REACT_VERSION_1})
add_definitions(-DCONFIG_REACT_VERSION_2=${REACT_VERSION_2})
option(ENABLE_TESTING "Enable testing" ON)
option(ENABLE_EXAMPLES "Enable examples" ON)
option(ENABLE_BENCHMARKING "Enable benchmarking" OFF)
include_directories("foreign/")
include_directories("include/")
add_definitions(-std=c++0x)
if(ENABLE_TESTING)
enable_testing()
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_subdirectory(tests)
endif()
if(ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()
if(ENABLE_BENCHMARKING)
add_subdirectory(benchmarks)
endif()
# Build react library
file(GLOB_RECURSE REACT_HEADERS
include/react/*.hpp
include/react/*.h
)
file(GLOB_RECURSE REACT_SOURCES
src/*.cpp
)
add_library(react SHARED
${REACT_HEADERS}
${REACT_SOURCES}
)
set_target_properties(react PROPERTIES
VERSION ${DEBFULLVERSION}
SOVERSION ${REACT_VERSION_ABI}
COMPILE_FLAGS "-std=c++0x -W -Wall -Werror -pedantic"
LINKER_LANGUAGE CXX
)
if(UNIX OR MINGW)
set_target_properties(react PROPERTIES COMPILE_FLAGS "-fPIC")
endif()
install(TARGETS react
EXPORT ReactTargets
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
BUNDLE DESTINATION library
)
install(DIRECTORY include/react/
DESTINATION include/react
)
install(DIRECTORY foreign/
DESTINATION include/react
)
set(INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
set(INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")