-
Notifications
You must be signed in to change notification settings - Fork 236
/
CMakeLists.txt
134 lines (102 loc) · 3.35 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
####################################
# init
####################################
cmake_minimum_required(VERSION 3.5)
project(lucene++)
set(lucene++_VERSION_MAJOR 3)
set(lucene++_VERSION_MINOR 0)
set(lucene++_VERSION_PATCH 9)
set(lucene++_SOVERSION "0")
set(lucene++_VERSION
"${lucene++_VERSION_MAJOR}.${lucene++_VERSION_MINOR}.${lucene++_VERSION_PATCH}")
# set default build type as release
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
set(LIB_DESTINATION
"${CMAKE_INSTALL_LIBDIR}" CACHE STRING "Define lib output directory name")
####################################
# CMake Modules
####################################
# include specific modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(options.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()
# fetch dependencies
include(dependencies)
# build docs
include(Lucene++Docs)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
####################################
# platform specific options
####################################
if(WIN32 OR WIN64)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
if(MSVC)
# Disable automatic boost linking on Windows as libraries are added to the linker explicitly
add_definitions(-DBOOST_ALL_NO_LIB)
# enable exceptions, see http://msdn.microsoft.com/en-us/library/1deeycx5.aspx
add_definitions(-EHsc)
# Disable including too many Windows headers
add_definitions(-DWIN32_LEAN_AND_MEAN)
# Disable the min/max macros that conflict with std::min/std::max
add_definitions(-DNOMINMAX)
endif()
if(NOT WIN32 AND NOT CMAKE_SYSTEM MATCHES "SunOS-5*.")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
if(CYGWIN)
add_definitions(-D__LARGE64_FILES)
endif()
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
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()
####################################
# bootstrap
####################################
include(TestCXXAcceptsFlag)
include(GNUInstallDirs)
add_subdirectory(include)
add_subdirectory(src)
message("\n\n** 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 Libraries: ${Boost_LIBRARY_DIRS}")
message(" Zlib Include: ${ZLIB_INCLUDE_DIRS}")
message(" Zlib Library: ${ZLIB_LIBRARY_RELEASE}")