forked from mysql/mysql-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
542 lines (476 loc) · 17.2 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# Copyright (c) 2006, 2023, Oracle and/or its affiliates.
#
# 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.
#
# 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
DISABLE_MISSING_PROFILE_WARNING()
ADD_SUBDIRECTORY(sys_schema)
MYSQL_ADD_EXECUTABLE(comp_sql comp_sql.cc SKIP_INSTALL)
# Add compiler information, for easier debugging of output from mysql_config.
SET(COMPILER_ID_AND_VERSION
"${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
# Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts)
IF(NOT WIN32 OR CMAKE_CROSSCOMPILING)
FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable")
MARK_AS_ADVANCED(CAT_EXECUTABLE)
ENDIF()
IF(CAT_EXECUTABLE)
SET(CAT_COMMAND COMMAND
${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql >
${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
)
ELSEIF(WIN32)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
native_outfile )
SET(CAT_COMMAND
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql
${native_outfile} )
ELSE()
MESSAGE(FATAL_ERROR "Cannot concatenate files")
ENDIF()
# Build mysql_fix_privilege_tables.h
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables_sql.h
${CAT_COMMAND}
COMMAND comp_sql
mysql_fix_privilege_tables
mysql_fix_privilege_tables.sql
mysql_fix_privilege_tables_sql.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_fix.sql
)
# Add target for the above to be built
MY_ADD_CUSTOM_TARGET(GenFixPrivs
ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables_sql.h
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_commands_sys_schema.h
COMMAND comp_sql
mysql_sys_schema
${CMAKE_CURRENT_SOURCE_DIR}/mysql_sys_schema.sql
sql_commands_sys_schema.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_sys_schema.sql
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_commands_system_data.h
COMMAND comp_sql
mysql_system_data
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
sql_commands_system_data.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_commands_system_tables_data_fix.h
COMMAND comp_sql
mysql_system_tables_data_fix
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data_fix.sql
sql_commands_system_tables_data_fix.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data_fix.sql
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_commands_system_tables.h
COMMAND comp_sql
mysql_system_tables
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
sql_commands_system_tables.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_commands_system_users.h
COMMAND comp_sql
mysql_system_users
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_users.sql
sql_commands_system_users.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_users.sql
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_commands_help_data.h
COMMAND comp_sql
fill_help_tables
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
sql_commands_help_data.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_firewall_stored_procedures.h
COMMAND comp_sql
firewall_stored_procedures
${CMAKE_CURRENT_SOURCE_DIR}/firewall_stored_procedures.sql
sql_firewall_stored_procedures.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/firewall_stored_procedures.sql
)
# Add target for the above to be built
IF(NOT WITHOUT_SERVER)
MY_ADD_CUSTOM_TARGET(GenBootstrapPriv
ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/sql_commands_system_data.h
${CMAKE_CURRENT_BINARY_DIR}/sql_commands_system_tables.h
${CMAKE_CURRENT_BINARY_DIR}/sql_commands_system_users.h
${CMAKE_CURRENT_BINARY_DIR}/sql_commands_help_data.h
${CMAKE_CURRENT_BINARY_DIR}/sql_commands_system_tables_data_fix.h
${CMAKE_CURRENT_BINARY_DIR}/sql_firewall_stored_procedures.h
)
ENDIF()
IF(UNIX)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/make_binary_distribution
"cd ${CMAKE_BINARY_DIR} && '${CMAKE_CPACK_COMMAND}' -G TGZ --config CPackConfig.cmake\n" )
EXECUTE_PROCESS(
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/make_binary_distribution
)
ENDIF()
SET(COMPILE_DEFINITIONS_WHITELIST
)
# In practice: only in use on Solaris
SET(CMAKE_C_FLAGS_WHITELIST
"-m32"
"-m64"
)
SET(CFLAGS "")
SET(CXXFLAGS "")
GET_PROPERTY(cwd_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS)
FOREACH(white_flag ${COMPILE_DEFINITIONS_WHITELIST})
FOREACH(flag ${cwd_definitions})
IF (${flag} MATCHES ${white_flag})
SET(CFLAGS "-D${white_flag} ${CFLAGS}")
SET(CXXFLAGS "-D${white_flag} ${CXXFLAGS}")
ENDIF()
ENDFOREACH()
ENDFOREACH()
IF(CMAKE_BUILD_TYPE AND BUILD_IS_SINGLE_CONFIG)
SET(CMAKEBT_FLAGS
"${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}} ${CMAKE_C_FLAGS}")
SEPARATE_ARGUMENTS(CMAKEBT_FLAGS)
ENDIF()
FOREACH(white_flag ${CMAKE_C_FLAGS_WHITELIST})
FOREACH(flag ${CMAKEBT_FLAGS})
IF (${flag} STREQUAL ${white_flag})
SET(CFLAGS "${white_flag} ${CFLAGS}")
SET(CXXFLAGS "${white_flag} ${CXXFLAGS}")
ENDIF()
ENDFOREACH()
ENDFOREACH()
# Do not remove -std=c++14 for Oracle Studio as it is required to get
# the correct libraries. Only remove for GCC/Clang
IF(MY_COMPILER_IS_GNU_OR_CLANG)
STRING(REGEX REPLACE "-std=c..[0-9]+" "" CXXFLAGS "${CXXFLAGS}")
ENDIF()
IF(FREEBSD)
SET (PERL_PATH "/usr/local/bin/perl")
ELSE()
SET (PERL_PATH "/usr/bin/perl")
ENDIF()
IF(UNIX)
# SHELL_PATH, FIND_PROC, CHECK_PID are used by mysqld_safe
IF(SOLARIS)
SET (SHELL_PATH "/bin/bash")
ELSE()
SET (SHELL_PATH "/bin/sh")
ENDIF()
IF(LINUX)
SET (FIND_PROC
"ps wwwp $PID | grep -v mysqld_safe | grep -- $MYSQLD > /dev/null")
ENDIF()
IF(SOLARIS)
SET (FIND_PROC
"ps -p $PID | grep -v mysqld_safe | grep -- $MYSQLD > /dev/null")
ENDIF()
IF(NOT FIND_PROC)
# BSD style
EXECUTE_PROCESS(COMMAND ps -uaxww
OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
IF(result MATCHES 0)
SET( FIND_PROC
"ps -uaxww | grep -v mysqld_safe | grep -- $MYSQLD | grep $PID > /dev/null")
ENDIF()
ENDIF()
IF(NOT FIND_PROC)
# SysV style
EXECUTE_PROCESS(COMMAND ps -ef
OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
IF(result MATCHES 0)
SET( FIND_PROC "ps -ef | grep -v mysqld_safe | grep -- $MYSQLD | grep $PID > /dev/null")
ENDIF()
ENDIF()
EXECUTE_PROCESS(COMMAND sh -c "kill -0 $$"
OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
IF(result MATCHES 0)
SET(CHECK_PID "kill -0 $PID > /dev/null 2> /dev/null")
ELSE()
SET(CHECK_PID "kill -s SIGCONT $PID > /dev/null 2> /dev/null")
ENDIF()
SET(MYSQLD_USER "mysql")
SET(MYSQLROUTER_USER "mysqlrouter")
ENDIF(UNIX)
SET(prefix "${CMAKE_INSTALL_PREFIX}")
SET(sysconfdir ${prefix})
SET(bindir ${prefix}/${INSTALL_BINDIR})
SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
SET(datadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
SET(libsubdir ${INSTALL_LIBDIR})
SET(pkgincludedir ${prefix}/${INSTALL_INCLUDEDIR})
SET(pkglibdir ${prefix}/${INSTALL_LIBDIR})
SET(pkgplugindir ${prefix}/${INSTALL_PLUGINDIR})
SET(localstatedir ${MYSQL_DATADIR})
IF(SOLARIS)
SET(RPATH_OPTION " -R$pkglibdir")
ENDIF()
IF(LINUX_INSTALL_RPATH_ORIGIN)
SET(RPATH_OPTION " -Wl,-R,$pkglibdir") # for mysql_config
SET(RPATH_OPTION_PC " -Wl,-R,\${libdir}") # for pkg_config
# Do not use STRING_APPEND, it may eval the $.
SET(RPATH_OPTION "${RPATH_OPTION} -L$pkglibdir/private")
SET(RPATH_OPTION_PC "${RPATH_OPTION_PC} -L\${libdir}/private")
SET(RPATH_OPTION "${RPATH_OPTION} -Wl,-R,$pkglibdir/private")
SET(RPATH_OPTION_PC "${RPATH_OPTION_PC} -Wl,-R,\${libdir}/private")
ENDIF()
# some scripts use @TARGET_LINUX@
IF(LINUX)
SET(TARGET_LINUX "true")
ELSE()
SET(TARGET_LINUX "false")
ENDIF()
# Use cmake variables to inspect dependencies for
# mysqlclient library (add -l stuff)
SET(CLIENT_LIBS "")
SET(LIBS "")
# Extract dependencies using CMake's LINK_LIBRARIES property.
# Returned string in ${var} is can be passed to linker's command line
MACRO(EXTRACT_LINK_LIBRARIES target var)
GET_TARGET_PROPERTY(TARGET_LIB_DEPENDS ${target} LINK_LIBRARIES)
IF(TARGET_LIB_DEPENDS)
LIST(REMOVE_DUPLICATES TARGET_LIB_DEPENDS)
FOREACH(lib ${TARGET_LIB_DEPENDS})
IF (lib MATCHES "^\\-l")
SET(${var} "${${var}} ${lib} ")
ELSEIF (lib MATCHES "^ext::")
STRING(REGEX MATCH "ext::([a-z]+)" MATCH_LIB "${lib}")
SET(SYSTEM_LIB ${CMAKE_MATCH_1})
SET(${var} "${${var}} -l${SYSTEM_LIB} ")
ELSEIF (lib MATCHES "^\\-L")
# Search directory. Test on FreeBSD: -L/usr/local/lib -lunwind
SET(${var} "${${var}} ${lib} ")
ELSEIF(lib MATCHES "^/")
# Full path, convert to just filename, strip "lib" prefix and extension
GET_FILENAME_COMPONENT(dir "${lib}" DIRECTORY)
GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
STRING(REGEX REPLACE "^lib" "" lib "${lib}")
# Add -L/usr/local/opt/openssl/lib for ssl (and crypto).
IF(APPLE AND WITH_SSL STREQUAL "system" AND ${lib} STREQUAL "ssl")
SET(${var} "${${var}}-L${dir} " )
ENDIF()
# Add -L/usr/local/lib for zstd
IF(APPLE AND WITH_ZSTD STREQUAL "system" AND ${lib} STREQUAL "zstd")
SET(${var} "${${var}}-L${dir} " )
ENDIF()
SET(${var} "${${var}}-l${lib} " )
ELSE()
SET(${var} "${${var}}-l${lib} " )
ENDIF()
ENDFOREACH()
ENDIF()
IF(MSVC)
STRING(REPLACE "-l" "" ${var} "${${var}}")
ENDIF()
STRING(REGEX REPLACE "^[ ]+" "" ${var} "${${var}}")
STRING(REGEX REPLACE "[ ]+$" "" ${var} "${${var}}")
ENDMACRO()
EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS)
IF(MSVC)
GET_TARGET_PROPERTY(LIBMYSQL_OS_SHLIB_VERSION mysqlclient VERSION)
GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME mysqlclient OUTPUT_NAME)
ELSE()
GET_TARGET_PROPERTY(LIBMYSQL_OS_SHLIB_VERSION libmysql VERSION)
GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME libmysql OUTPUT_NAME)
ENDIF()
SET(CONFIG_CLIENT_LIBS "${CLIENT_LIBS}")
SET(CONFIG_LIBS_PRIVATE "${CLIENT_LIBS}")
SET(CONFIG_REQUIRES_PRIVATE "")
# ssl.cmake should have used pkg-config rather than cmake to locate ssl
IF (WITH_SSL STREQUAL "system")
# We have implemented "system" for other platforms as well, but those
# are non-native packages.
IF(LINUX OR SOLARIS OR FREEBSD)
SET(CONFIG_REQUIRES_PRIVATE "openssl")
STRING(REPLACE "-lssl" "" CONFIG_LIBS_PRIVATE "${CONFIG_LIBS_PRIVATE}")
STRING(REPLACE "-lcrypto" "" CONFIG_LIBS_PRIVATE "${CONFIG_LIBS_PRIVATE}")
STRING(REGEX REPLACE "[ ]+" " " CONFIG_LIBS_PRIVATE
"${CONFIG_LIBS_PRIVATE}")
ENDIF()
ENDIF()
MESSAGE(STATUS "CONFIG_CLIENT_LIBS ${CONFIG_CLIENT_LIBS}")
MESSAGE(STATUS "CONFIG_LIBS_PRIVATE ${CONFIG_LIBS_PRIVATE}")
IF(WIN32)
SET(BIN_SCRIPTS
mysqld_multi
mysqldumpslow
)
FOREACH(file ${BIN_SCRIPTS})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.pl.in
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY
)
INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl
COMPONENT Server_Scripts
)
ENDFOREACH()
ELSE()
SET(PKGCONFIG_FILE ${LIBMYSQL_OS_OUTPUT_NAME}.pc)
STRING(REGEX REPLACE "/mysql$" "" PKGCONFIG_DIR "${INSTALL_LIBDIR}")
SET(PKGCONFIG_DIR "${PKGCONFIG_DIR}/pkgconfig")
# Update the cache, to make it visible in cmake-gui.
SET(INSTALL_PKGCONFIGDIR ${INSTALL_PKGCONFIGDIR} CACHE PATH
"Where to install ${PKGCONFIG_FILE}, defaults to ${PKGCONFIG_DIR}")
IF(NOT INSTALL_PKGCONFIGDIR)
SET(INSTALL_PKGCONFIGDIR "${PKGCONFIG_DIR}")
ENDIF()
CONFIGURE_FILE(mysqlclient.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILE}
ESCAPE_QUOTES @ONLY)
IF(INSTALL_PKGCONFIGDIR)
MESSAGE(STATUS "INSTALL ${PKGCONFIG_FILE} ${INSTALL_PKGCONFIGDIR}")
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILE}
DESTINATION ${INSTALL_PKGCONFIGDIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT Development
)
ENDIF()
# mysqld_safe used in mtr even for systemd platforms
IF(WITH_SYSTEMD)
SET(BIN_SCRIPTS
mysql_config
mysqldumpslow
mysqld_safe
)
ELSE()
SET(BIN_SCRIPTS
mysql_config
mysqldumpslow
mysqld_multi
mysqld_safe
)
ENDIF()
FOREACH(file ${BIN_SCRIPTS})
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY
)
ELSEIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.pl.in)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.pl.in
${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY
)
ELSE()
MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file}.pl.in in "
"${CMAKE_CURRENT_SOURCE_DIR}"
)
ENDIF()
EXECUTE_PROCESS(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${file})
IF(${file} STREQUAL "mysql_config")
SET(file_COMPONENT Development)
ELSE()
SET(file_COMPONENT Server)
ENDIF()
INSTALL_SCRIPT(
${CMAKE_CURRENT_BINARY_DIR}/${file}
DESTINATION ${INSTALL_BINDIR}
COMPONENT ${file_COMPONENT}
)
ENDFOREACH()
# Systemd files
IF(WITH_SYSTEMD)
IF(SYSTEMD_HAS_PLUS)
SET(SYSTEMD_EXE_PREFIX "+")
SET(SYSTEMD_START_ONLY "# hence, + prefix is used")
ELSE()
SET(SYSTEMD_EXE_PREFIX "")
SET(SYSTEMD_START_ONLY "PermissionsStartOnly=true")
ENDIF()
CONFIGURE_FILE(systemd/mysqld_pre_systemd.in
${CMAKE_CURRENT_BINARY_DIR}/mysqld_pre_systemd ESCAPE_QUOTES @ONLY)
CONFIGURE_FILE(systemd/mysqld.service.in
${CMAKE_CURRENT_BINARY_DIR}/${SYSTEMD_SERVICE_NAME}.service
ESCAPE_QUOTES @ONLY)
CONFIGURE_FILE(systemd/[email protected]
${CMAKE_CURRENT_BINARY_DIR}/${SYSTEMD_SERVICE_NAME}@.service
ESCAPE_QUOTES @ONLY)
CONFIGURE_FILE(systemd/mysqld.tmpfiles.d.in
${CMAKE_CURRENT_BINARY_DIR}/mysql.conf ESCAPE_QUOTES @ONLY)
INSTALL_SCRIPT(
${CMAKE_CURRENT_BINARY_DIR}/mysqld_pre_systemd
DESTINATION ${INSTALL_BINDIR}
COMPONENT Server
)
IF(INSTALL_LAYOUT MATCHES "STANDALONE")
SET(SYSTEMD_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
ELSE()
SET(SYSTEMD_INSTALL_PREFIX "")
ENDIF()
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SYSTEMD_SERVICE_NAME}.service
DESTINATION ${SYSTEMD_INSTALL_PREFIX}${SYSTEMD_SERVICES_DIR}
COMPONENT Server
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SYSTEMD_SERVICE_NAME}@.service
DESTINATION ${SYSTEMD_INSTALL_PREFIX}${SYSTEMD_SERVICES_DIR}
COMPONENT Server
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql.conf
DESTINATION ${SYSTEMD_INSTALL_PREFIX}${SYSTEMD_TMPFILES_DIR}
COMPONENT Server
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
# MySQL Router
IF(WITH_ROUTER)
CONFIGURE_FILE(systemd/mysqlrouter.service.in
${CMAKE_CURRENT_BINARY_DIR}/mysqlrouter.service
ESCAPE_QUOTES @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysqlrouter.service
DESTINATION ${SYSTEMD_INSTALL_PREFIX}${SYSTEMD_SERVICES_DIR}
COMPONENT Router
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
CONFIGURE_FILE(systemd/mysqlrouter.tmpfiles.d.in
${CMAKE_CURRENT_BINARY_DIR}/mysqlrouter.conf ESCAPE_QUOTES @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysqlrouter.conf
DESTINATION ${SYSTEMD_INSTALL_PREFIX}${SYSTEMD_TMPFILES_DIR}
COMPONENT Router
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
ENDIF()
ENDIF()
ENDIF()