This repository has been archived by the owner on Feb 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
179 lines (147 loc) · 4.51 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
168
169
170
171
172
173
174
175
176
177
178
179
# libtctl CMakeLists.txt
# ========================
project(libtclt)
cmake_minimum_required(VERSION 2.8)
# CMake Configuration
# ------------------
set(CMAKE_MODULE_PATH ${CMAME_MODULE_PATH} ${CMAKE_SOURCE_DIR}/util/cmake/Modules/)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(CMAKE_INSTALL_PREFIX "/usr/local/")
set(${CMAKE_SYSTEM_NAME} True)
include(${CMAKE_SOURCE_DIR}/CMakeLists.txt.local OPTIONAL)
# CMake global options
# ------------------
# None at the moment
# Global Packages search
# ------------------
find_package(Yajl REQUIRED)
# Global CPP definitions
add_definitions(-D${CMAKE_SYSTEM_NAME})
# Global include directories
# ------------------
include_directories(${CMAKE_HOME_DIRECTORY}/include)
include_directories(${YAJL_INCLUDE_DIR})
# Portable source files
# ------------------
set(SOURCES_LIST
${CMAKE_SOURCE_DIR}/tclt_format.c
${CMAKE_SOURCE_DIR}/tclt_parse.c
${CMAKE_SOURCE_DIR}/tclt.c
)
# OS families specific things
# ---------------------------
if(UNIX)
# Unix specific include directories
# ------------------
include_directories(/usr/include/)
# Unix specific definitions
# ------------------
add_definitions(-DUnix)
# Unix specific source files
# ------------------
# set(SOURCES_LIST ${SOURCES_LIST}
# )
endif()
if (Windows)
# CMake windows Configuration
# ------------------
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DWindows)
# Windows source files
# ------------------
set(HEADERS_LIST
)
set(SOURCES_LIST ${SOURCES_LIST} ${HEADERS_LIST}
)
endif()
# OS specific things
# ------------------
if(Linux)
set(CMAKE_SYSTEM_INCLUDE_PATH
${CMAKE_SYSTEM_INCLUDE_PATH} /usr/local/include)
# Linux specific Options
# ------------------
option(ENABLE_BSDCOMPAT "Enable the use of the libbsd" OFF)
# Linux specific package search
# ------------------
if (ENABLE_BSDCOMPAT)
find_package(Bsd)
endif()
# Linux specific definitions
# ------------------
add_definitions(-D_GNU_SOURCE)
add_definitions(-DHAVE_SETRESXID)
if (ENABLE_BSDCOMPAT AND BSD_FOUND)
add_definitions(-DHAVE_BSD_COMPAT)
endif()
# Linux specifig include directories
# ----------------------------------
include_directories(/usr/local/include)
if (ENABLE_BSDCOMPAT AND BSD_FOUND)
include_directories(${BSD_INCLUDE_DIRS})
endif()
endif()
if (OpenBSD)
set(CMAKE_SYSTEM_INCLUDE_PATH
${CMAKE_SYSTEM_INCLUDE_PATH} /usr/local/include)
include_directories(/usr/local/include)
add_definitions(-DHAVE_SETPROCTITLE)
add_definitions(-DHAVE_SETRESXID)
endif()
if (NetBSD)
set(CMAKE_SYSTEM_INCLUDE_PATH
${CMAKE_SYSTEM_INCLUDE_PATH} /usr/pkg/include)
include_directories(/usr/pkg/include)
add_definitions(-DHAVE_SETPROCTITLE)
endif()
if (FreeBSD)
set(CMAKE_SYSTEM_INCLUDE_PATH
${CMAKE_SYSTEM_INCLUDE_PATH} /usr/local/include)
include_directories(/usr/local/include)
add_definitions(-DHAVE_SETPROCTITLE)
add_definitions(-DHAVE_SETRESXID)
endif()
if (Darwin)
# Darwin specific include directories (macport)
# ------------------
set(CMAKE_SYSTEM_INCLUDE_PATH
${CMAKE_SYSTEM_INCLUDE_PATH} /opt/local/include)
include_directories(/opt/local/include)
# Darwin specific definitions
# ------------------
endif()
# Library definitons
# ------------------
add_library (tclt
SHARED
${SOURCES_LIST}
)
# Global linked libraries
# ------------------
target_link_libraries(tclt
${YAJL_LIBRARIES}
)
# Linux linked libraries
# ------------------------
if (ENABLE_BSDCOMPAT AND BSD_FOUND)
target_link_libraries(tclt ${BSD_LIBRARIES})
endif()
# Windows linked libraries
# ------------------------
if (Windows)
target_link_libraries(tclt Ws2_32.lib)
endif()
include(${CMAKE_SOURCE_DIR}/CMakeLists.txt.link.local OPTIONAL)
if (UNIX)
install (TARGETS tclt DESTINATION lib)
install (FILES ${CMAKE_HOME_DIRECTORY}/include/tclt.h DESTINATION include)
install (FILES ${CMAKE_HOME_DIRECTORY}/include/tclt_parse.h DESTINATION include)
install (FILES ${CMAKE_HOME_DIRECTORY}/include/tclt_format.h DESTINATION include)
install (FILES ${CMAKE_HOME_DIRECTORY}/include/tclt_command.h DESTINATION include)
install (FILES ${CMAKE_HOME_DIRECTORY}/include/tclt_import.h DESTINATION include)
endif (UNIX)
if (Regress)
include (${CMAKE_SOURCE_DIR}/regress/CMakeLists.txt)
endif (Regress)