forked from luceneplusplus/LucenePlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
167 lines (139 loc) · 3.85 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
project(lucene++)
cmake_minimum_required(VERSION 2.8.6)
set(lucene++_VERSION_MAJOR 3)
set(lucene++_VERSION_MINOR 0)
set(lucene++_VERSION_PATCH 6)
set(lucene++_SOVERSION "0")
set(lucene++_VERSION
"${lucene++_VERSION_MAJOR}.${lucene++_VERSION_MINOR}.${lucene++_VERSION_PATCH}"
)
# include specific modules
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
####################################
# pre-compiled headers support
####################################
include(cotire)
# if setup using the Toolchain-llvm.cmake file, then use llvm...
if(ENABLE_LLVM)
include(Toolchain-llvm)
endif()
####################################
# user specified build options
####################################
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
option(ENABLE_PACKAGING
"Create build scripts for creating lucene++ packages"
OFF
)
option(LUCENE_USE_STATIC_BOOST_LIBS
"Use static boost libraries"
OFF
)
option(ENABLE_CYCLIC_CHECK
"Enable cyclic checking"
OFF
)
####################################
# bootstrap
####################################
find_package(Subversion REQUIRED)
find_package(Threads REQUIRED)
find_package(Boost COMPONENTS
date_time
filesystem
iostreams
regex
system
thread
REQUIRED
)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ${LUCENE_USE_STATIC_BOOST_LIBS})
set(lucene_boost_libs
${Boost_LIBRARIES}
${Boost_FILESYSTEM_LIBRARIES}
${Boost_IOSTREAMS_LIBRARIES}
${Boost_REGEX_LIBRARIES}
${Boost_SYSTEM_LIBRARIES}
${Boost_THREAD_LIBRARIES}
)
include(Lucene++Docs)
include(TestCXXAcceptsFlag)
set(LIB_DESTINATION
"lib" CACHE STRING "Define lib output directory name"
)
if(ENABLE_CYCLIC_CHECK)
set(DEFINE_USE_CYCLIC_CHECK "define")
else()
set(DEFINE_USE_CYCLIC_CHECK "undef")
endif()
####################################
# platform specific options
####################################
if(WIN32 OR WIN64)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
if(NOT MSVC AND NOT CMAKE_SYSTEM MATCHES "SunOS-5*.")
add_definitions(-fPIC)
endif()
if(CYGWIN)
add_definitions(-D__LARGE64_FILES)
endif()
#################################
# generate Config.h
#################################
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/Config.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/include/Config.h" @ONLY
)
include_directories(
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
include(CMakeExternal.txt)
enable_testing()
add_subdirectory(src/core)
add_subdirectory(src/contrib)
add_subdirectory(src/demo)
add_subdirectory(src/test)
#################################
# install pkg-config file
#################################
if(NOT WIN32)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/liblucene++.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++.pc" @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/liblucene++-contrib.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++-contrib.pc" @ONLY)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++.pc"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++-contrib.pc"
DESTINATION "${LIB_DESTINATION}/pkgconfig")
endif()
####################################
# custom targets
####################################
configure_file(
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(
uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
VERBATIM
)
if(ENABLE_PACKAGING)
include(CreateLucene++Packages)
endif()
message("** Build Summary **")
message(" Version: ${lucene++_VERSION}")
message(" Prefix: ${CMAKE_INSTALL_PREFIX}")
message(" Build Type: ${CMAKE_BUILD_TYPE}")
message(" Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
message(" System: ${CMAKE_SYSTEM_NAME}")
message(" Boost Include: ${Boost_INCLUDE_DIRS}")
message(" Boost Library: ${Boost_LIBRARY_DIRS}")