forked from mysql/mysql-connector-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_layout.cmake
197 lines (153 loc) · 5.87 KB
/
install_layout.cmake
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an
# additional permission to link the program and your derivative works
# with the separately licensed software that they have included with
# MySQL.
#
# Without limiting anything contained in the foregoing, this file,
# which is part of MySQL Connector/C++, is also subject to the
# Universal FOSS Exception, version 1.0, a copy of which can be found at
# http://oss.oracle.com/licenses/universal-foss-exception.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Pick install location for the main library
# ------------------------------------------
#
# On Windows the install layout is as follows, where NN is the MSVC version
# used to build the connector:
#
# {lib,lib64}/mysqlcppconnX-vsNN.dll <-- shared library
# {lib,lib64}/vsNN/mysqlcppconnX-static.lib <-- static with /MD
# {lib,lib64}/vsNN/mysqlcppconnX-static-mt.lib <-- static with /MT
# {lib,lib64}/vsNN/mysqlcppconnX.lib <-- import library for DLL
#
# On Linux it is as follows, where A.B is the API version number
#
# {lib,lib64}/libmysqlcppconnX.so.A.B <-- shared library
# {lib,lib64}/libmysqlcppconnX.so.A <-- soname link
# {lib,lib64}/libmysqlcppconnX.so <-- development link
# {lib,lib64}/libmysqlcppconnX-static.a <-- static library
#
# Additionally, if connector is built in debug mode, the libraries are installed
# in debug/ subfolder of {lib,lib64}/ or {lib,lib64}/vsNN/.
#
# Note: We expect VS variable to hold the "vsNN" bit on Windows.
#
if(NOT DEFINED IS64BIT)
message(FATAL_ERROR "IS64BIT not defined!")
endif()
#
# Default locations, if not overridden with cmake options
#
if(NOT CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE STRING
"Include Install location (Relative to CMAKE_INSTALL_PREFIX)")
endif()
if(NOT CMAKE_INSTALL_LIBDIR)
if(FREEBSD)
set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING
"Library Install location (Relative to CMAKE_INSTALL_PREFIX)")
elseif(IS64BIT OR SUNPRO)
set(CMAKE_INSTALL_LIBDIR "lib64" CACHE STRING
"Library Install location (Relative to CMAKE_INSTALL_PREFIX)")
else()
set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING
"Library Install location (Relative to CMAKE_INSTALL_PREFIX)")
endif()
endif()
if(NOT CMAKE_INSTALL_DOCDIR)
set(CMAKE_INSTALL_DOCDIR "." CACHE STRING
"Doc Install location (Relative to CMAKE_INSTALL_PREFIX)")
endif()
#
# These variables should be used in install specs.
#
set(INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
set(INSTALL_LIB_DIR_STATIC "${INSTALL_LIB_DIR}")
if(VS)
set(INSTALL_LIB_DIR_STATIC "${INSTALL_LIB_DIR_STATIC}/${VS}")
endif()
set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR})
#
# Store layout settings in the cache.
#
set(INSTALL_INCLUDE_DIR "${INSTALL_INCLUDE_DIR}"
CACHE INTERNAL "Install location for include headers"
)
set(INSTALL_DOC_DIR "${INSTALL_DOC_DIR}"
CACHE INTERNAL "Install location for documentation files"
)
set(INSTALL_LIB_DIR "${INSTALL_LIB_DIR}"
CACHE INTERNAL "Library install location (relative to install root)"
)
set(INSTALL_LIB_DIR_STATIC "${INSTALL_LIB_DIR_STATIC}"
CACHE INTERNAL "Install location for static libraries (relative to install root)"
)
#
# Default install location
#
if(NOT CMAKE_INSTALL_PREFIX)
if(WIN32)
if(DEFINED ENV{HOMEPATH})
file(TO_CMAKE_PATH "$ENV{HOMEDRIVE}$ENV{HOMEPATH}" install_home)
else()
set(install_home "C:/Program Files (x86)")
endif()
set(CMAKE_INSTALL_PREFIX "${install_home}/MySQL/MySQL Connector C++ ${CONCPP_PACKAGE_BASE_VERSION}")
else()
set(CMAKE_INSTALL_PREFIX "/usr/local/mysql/connector-c++-${CONCPP_PACKAGE_BASE_VERSION}")
endif()
endif()
#
# Library names
#
# The library name base is mysqlcppconnX where X is the major version
# of Connector/C++ product.
#
# Static library has -static suffix added to the base name.
#
# On Windows we add major ABI version to the shared library name, so that
# different ABI versions of the library can be installed next to each other.
# Also, on Windows we distinguish the MSVC version used to build the library
# (as this determines the runtime version). The shared libraries use
# -vsNN suffix, the import library does not have the suffix but is installed
# to a vsNN/ subfolder of the library install location (see install layout
# below). For static libraries, we add -mt suffix if it is linked with
# static runtime.
#
set(LIB_NAME_BASE "mysqlcppconn${CONCPP_VERSION_MAJOR}")
set(LIB_NAME_STATIC "${LIB_NAME_BASE}-static")
if(WIN32 AND STATIC_MSVCRT)
set(LIB_NAME_STATIC "${LIB_NAME}-mt")
endif()
if(BUILD_STATIC)
set(LIB_NAME ${LIB_NAME_STATIC})
else()
set(LIB_NAME "${LIB_NAME_BASE}")
if(WIN32)
set(LIB_NAME "${LIB_NAME}-${ABI_VERSION_MAJOR}")
endif()
if(VS)
set(LIB_NAME "${LIB_NAME}-${VS}")
endif()
endif()
#set(LIB_NAME_BASE ${LIB_NAME_BASE} CACHE INTERNAL "")
#set(LIB_NAME ${LIB_NAME} CACHE INTERNAL "")
#set(LIB_NAME_STATIC ${LIB_NAME_STATIC} CACHE INTERNAL "")