Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BareosSetVariableDefaults.cmake « cmake - github.com/bareos/bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eb7c56087ec02fa202502bb34705de99dc6518df (plain)
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
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
#   BAREOS® - Backup Archiving REcovery Open Sourced
#
#   Copyright (C) 2017-2022 Bareos GmbH & Co. KG
#
#   This program is Free Software; you can redistribute it and/or
#   modify it under the terms of version three of the GNU Affero General Public
#   License as published by the Free Software Foundation and included
#   in the file LICENSE.
#
#   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
#   Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#   02110-1301, USA.

# check if variables are set via cmdline else set them to default values

# configure variables
#
# strings - directories

# prefix
if(NOT DEFINED prefix)
  set(prefix ${CMAKE_DEFAULT_PREFIX})
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
  set(HAVE_EXTENDED_ACL 1)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

  # libdir
  if(NOT DEFINED libdir)
    set(libdir ${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME})
  endif()

  # includedir
  if(NOT DEFINED includedir)
    set(includedir ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME})
  endif()

  # bindir
  if(NOT DEFINED bindir)
    set(bindir ${CMAKE_INSTALL_BINDIR})
    message(STATUS "set bindir to default ${bindir}")
  endif()

  # sbindir
  if(NOT DEFINED sbindir)
    set(sbindir ${CMAKE_INSTALL_SBINDIR})
    message(STATUS "set sbindir to default ${sbindir}")
  endif()

  # sysconfdir
  if(NOT DEFINED sysconfdir)
    set(sysconfdir ${CMAKE_INSTALL_SYSCONFDIR})
  endif()
  set(SYSCONFDIR "\"${sysconfdir}\"")

  # confdir
  if(NOT DEFINED confdir)
    set(confdir "${sysconfdir}/${CMAKE_PROJECT_NAME}")
  endif()

  # configtemplatedir
  if(NOT DEFINED configtemplatedir)
    set(configtemplatedir "lib/${CMAKE_PROJECT_NAME}/defaultconfigs")
  endif()

  # mandir
  if(NOT DEFINED mandir)
    set(mandir ${CMAKE_INSTALL_MANDIR})
  endif()

  # docdir
  if(NOT DEFINED docdir)
    set(docdir default_for_docdir)
  endif()

  # archivedir
  if(NOT DEFINED archivedir)
    if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
      # windows install scripts replace the string "/var/lib/bareos/storage"
      set(archivedir "/var/lib/${CMAKE_PROJECT_NAME}/storage")
    else()
      set(archivedir
          "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/${CMAKE_PROJECT_NAME}/storage"
      )
    endif()
  endif()

  # backenddir
  if(NOT DEFINED backenddir)
    set(backenddir ${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME}/backends)
  endif()

  # scriptdir
  if(NOT DEFINED scriptdir)
    set(scriptdir "lib/${CMAKE_PROJECT_NAME}/scripts")
  endif()

  # workingdir
  if(NOT DEFINED workingdir)
    set(workingdir
        "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/${CMAKE_PROJECT_NAME}"
    )
  endif()
  set(working_dir "${workingdir}")

  # plugindir
  if(NOT DEFINED plugindir)
    set(plugindir ${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME}/plugins)
  endif()

  # bsrdir
  if(NOT DEFINED bsrdir)
    set(bsrdir ${workingdir})
  endif()

  # logdir
  if(NOT DEFINED logdir)
    set(logdir "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/${CMAKE_PROJECT_NAME}")
  endif()

  # datarootdir
  if(NOT DEFINED datarootdir)
    set(datarootdir "${CMAKE_INSTALL_DATAROOTDIR}")
  endif()

  # subsysdir
  if(NOT DEFINED subsysdir)
    set(subsysdir "${workingdir}")
  endif()

else() # IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

  # libdir
  if(NOT DEFINED libdir)
    set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_PROJECT_NAME})
  endif()

  # includedir
  if(NOT DEFINED includedir)
    set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}/${CMAKE_PROJECT_NAME})
  endif()

  # bindir
  if(NOT DEFINED bindir)
    set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
    message(STATUS "set bindir to default ${bindir}")
  endif()

  # sbindir
  if(NOT DEFINED sbindir)
    set(sbindir ${CMAKE_INSTALL_FULL_SBINDIR})
    message(STATUS "set sbindir to default ${sbindir}")
  endif()

  # sysconfdir
  if(NOT DEFINED sysconfdir)
    set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR})
  endif()
  set(SYSCONFDIR "\"${sysconfdir}\"")

  # confdir
  if(NOT DEFINED confdir)
    set(confdir "${sysconfdir}/${CMAKE_PROJECT_NAME}")
  endif()

  # configtemplatedir
  if(NOT DEFINED configtemplatedir)
    set(configtemplatedir "${confdir}")
  endif()

  # mandir
  if(NOT DEFINED mandir)
    set(mandir ${CMAKE_INSTALL_FULL_MANDIR})
  endif()

  # docdir
  if(NOT DEFINED docdir)
    set(docdir default_for_docdir)
  endif()

  # archivedir
  if(NOT DEFINED archivedir)
    set(archivedir
        "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/${CMAKE_PROJECT_NAME}/storage"
    )
  endif()

  # backenddir
  if(NOT DEFINED backenddir)
    set(backenddir ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_PROJECT_NAME}/backends)
  endif()

  # scriptdir
  if(NOT DEFINED scriptdir)
    set(scriptdir "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_PROJECT_NAME}/scripts")
  endif()

  # workingdir
  if(NOT DEFINED workingdir)
    set(workingdir
        "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/${CMAKE_PROJECT_NAME}"
    )
  endif()
  set(working_dir "${workingdir}")

  # plugindir
  if(NOT DEFINED plugindir)
    set(plugindir ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_PROJECT_NAME}/plugins)
  endif()

  # bsrdir
  if(NOT DEFINED bsrdir)
    set(bsrdir ${workingdir})
  endif()

  # logdir
  if(NOT DEFINED logdir)
    set(logdir "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/${CMAKE_PROJECT_NAME}")
  endif()

  # datarootdir
  if(NOT DEFINED datarootdir)
    set(datarootdir "${CMAKE_INSTALL_FULL_DATAROOTDIR}")
  endif()

  # subsysdir
  if(NOT DEFINED subsysdir)
    set(subsysdir "${workingdir}")
  endif()

endif() # IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

set(PYTHON_MODULE_PATH
    "${plugindir}"
    CACHE STRING "Default path for Bareos Python modules"
)

# db_name
if(NOT DEFINED db_name)
  set(db_name "bareos")
endif()

# db_user
if(NOT DEFINED db_user)
  set(db_user "bareos")
endif()

# db_password
if(NOT DEFINED db_password)
  set(db_password "")
endif()

set(systemtest_db_user
    "regress"
    CACHE STRING "Database user for the systemtests"
)

set(systemtest_db_password
    ""
    CACHE STRING "Database password for the systemtests"
)

# dir-user
if(NOT DEFINED dir-user)
  set(dir-user "")
endif()
set(dir_user "${dir-user}")

# dir-group
if(NOT DEFINED dir-group)
  set(dir-group "")
endif()
set(dir_group ${dir-group})

# sd-user
if(NOT DEFINED sd-user)
  set(sd-user "")
endif()
set(sd_user ${sd-user})

# sd-group
if(NOT DEFINED sd-group)
  set(sd-group "")
endif()
set(sd_group ${sd-group})

# fd-user
if(NOT DEFINED fd-user)
  set(fd-user "")
endif()
set(fd_user ${fd-user})

# fd-group
if(NOT DEFINED fd-group)
  set(fd-group "")
endif()
set(fd_group ${fd-group})

# dir-password
if(NOT DEFINED dir-password)
  set(dir-password "bareos")
endif()
set(dir_password ${dir-password})

# fd-password
if(NOT DEFINED fd-password)
  set(fd-password "")
endif()
set(fd_password ${fd-password})

# sd-password
if(NOT DEFINED sd-password)
  set(sd-password "")
endif()
set(sd_password ${sd-password})

# mon-dir-password
if(NOT DEFINED mon-dir-password)
  set(mon-dir-password "")
endif()
set(mon_dir_password ${mon-dir-password})

# mon-fd-password
if(NOT DEFINED mon-fd-password)
  set(mon-fd-password "")
endif()
set(mon_fd_password ${mon-fd-password})

# mon-sd-password
if(NOT DEFINED mon-sd-password)
  set(mon-sd-password "")
endif()
set(mon_sd_password ${mon-sd-password})

# basename
if(NOT DEFINED basename)
  set(basename localhost)
endif()

# hostname
if(NOT DEFINED hostname)
  set(hostname localhost)
endif()

# ##############################################################################
# rights
# ##############################################################################
# sbin-perm
if(NOT DEFINED sbin-perm)
  set(sbin-perm 755)
endif()

# ##############################################################################
# bool
# ##############################################################################
# python
if(NOT DEFINED python)
  set(python ON)
endif()

# lockmgr
if(NOT DEFINED lockmgr)
  set(lockmgr OFF)
  set(LOCKMGR 0)
endif()

# readline
if(NOT DEFINED readline)
  set(readline ON)
endif()

# batch-insert
if((NOT DEFINED batch-insert) OR (${batch-insert}))
  set(batch-insert ON)
  set(HAVE_POSTGRESQL_BATCH_FILE_INSERT 1)
  set(USE_BATCH_FILE_INSERT 1)
endif()

# dynamic-cats-backends
option(dynamic-cats-backends "enable dynamic catalog backends" ON)
if(dynamic-cats-backends)
  set(HAVE_DYNAMIC_CATS_BACKENDS 1)
else()
  set(HAVE_DYNAMIC_CATS_BACKENDS 0)
endif()

# dynamic-storage-backends
if(NOT DEFINED dynamic-storage-backends OR dynamic-storage-backends)
  set(dynamic-storage-backends ON)
  set(HAVE_DYNAMIC_SD_BACKENDS
      1
      CACHE INTERNAL ""
  )
else()
  set(HAVE_DYNAMIC_SD_BACKENDS
      0
      CACHE INTERNAL ""
  )
endif()

# scsi-crypto
if(NOT DEFINED scsi-crypto)
  set(scsi-crypto OFF)
endif()

# lmdb
if(NOT DEFINED lmdb)
  set(lmdb ON)
endif()

# ndmp
if(NOT DEFINED ndmp)
  set(ndmp ON)
endif()

# acl
if(NOT DEFINED acl)
  set(acl ON)
endif()

# xattr
if(NOT DEFINED xattr)
  set(xattr ON)
endif()

# build_ndmjob
if(NOT DEFINED build_ndmjob)
  set(build_ndmjob OFF)
endif()

# traymonitor
if(NOT DEFINED traymonitor)
  set(HAVE_TRAYMONITOR 0)
endif()

# client-only
if(NOT DEFINED client-only)
  set(client-only OFF)
  set(build_client_only OFF)
  set(postgresql ON)
else()
  set(client-only ON)
  set(build_client_only ON)
  set(postgresql OFF)
endif()

if(NOT postgresql)
  set(PostgreSQL_INCLUDE_DIR "")
endif()

if(NOT Readline_LIBRARY)
  set(Readline_LIBRARY "")
endif()

if(NOT LIBZ_FOUND)
  set(ZLIB_LIBRARY "")
endif()

set(db_backends "")

if(NOT client-only)

  if(${postgresql})
    set(HAVE_POSTGRESQL 1)
    list(APPEND db_backends postgresql)
  endif()

  if(NOT DEFINED default_db_backend)
    # set first entry as default db backend if not already defined
    list(GET db_backends 0 default_db_backend)
  endif()
  # set first backend to be tested by systemtests
  list(GET db_backends 0 db_backend_to_test)
  get_directory_property(hasParent PARENT_DIRECTORY)
  if(hasParent)
    set(db_backend_to_test
        ${db_backend_to_test}
        PARENT_SCOPE
    )
    set(DEFAULT_DB_TYPE
        ${default_db_backend}
        PARENT_SCOPE
    )
  endif()
  set(DEFAULT_DB_TYPE ${default_db_backend})
endif()

# systemd
if(NOT DEFINED systemd)
  set(systemd OFF)
endif()

# includes
if(NOT DEFINED includes)
  set(includes ON)
endif()

# openssl
if(NOT DEFINED openssl)
  set(openssl ON)
endif()

# ports
if(NOT DEFINED dir_port)
  set(dir_port "9101")
endif()

if(NOT DEFINED fd_port)
  set(fd_port "9102")
endif()

if(NOT DEFINED sd_port)
  set(sd_port "9103")
endif()

if(DEFINED baseport)
  math(EXPR dir_port "${baseport}+0")
  math(EXPR fd_port "${baseport}+1")
  math(EXPR sd_port "${baseport}+2")
endif()

if(NOT DEFINED job_email)
  set(job_email "root")
endif()

if(NOT DEFINED dump_email)
  set(dump_email "root")
endif()

if(NOT DEFINED smtp_host)
  set(smtp_host "localhost")
endif()

if(DEFINED traymonitor)
  set(HAVE_TRAYMONITOR 1)
endif()

if(DEFINED test-plugin)
  set(HAVE_TEST_PLUGIN 1)
endif()

if(NOT DEFINED developer)
  set(developer OFF)
endif()

if(NOT DEFINED coverage)
  set(coverage OFF)
endif()

# do not destroy bareos-config-lib.sh
set(DB_NAME "@DB_NAME@")
set(DB_USER "@DB_USER@")
set(DB_PASS "@DB_PASS@")
set(DB_VERSION "@DB_VERSION@")

if(${CMAKE_COMPILER_IS_GNUCC})
  set(HAVE_GCC 1)
endif()

set(HAVE_MYSQL_THREAD_SAFE 1)
set(HAVE_SHA2 1)
set(HAVE_PQISTHREADSAFE 1)

set(_LARGEFILE_SOURCE 1)
set(_LARGE_FILES 1)
set(_FILE_OFFSET_BITS 64)
set(HAVE_COMPRESS_BOUND 1)
set(HAVE_SQLITE3_THREADSAFE 1)

set(PACKAGE_NAME "\"${CMAKE_PROJECT_NAME}\"")
set(PACKAGE_STRING "\"${CMAKE_PROJECT_NAME} ${BAREOS_NUMERIC_VERSION}\"")
set(PACKAGE_VERSION "\"${BAREOS_NUMERIC_VERSION}\"")

set(ENABLE_NLS 1)

if(HAVE_WIN32)

  if(NOT DEFINED WINDOWS_VERSION)
    set(WINDOWS_VERSION 0x600)
  endif()

  if(NOT DEFINED WINDOWS_BITS)
    set(WINDOWS_BITS 64)
  endif()

endif()

if(DEFINED do-static-code-checks)
  set(DO_STATIC_CODE_CHECKS ${do-static-code-checks})
else()
  set(DO_STATIC_CODE_CHECKS OFF)
endif()

if(DEFINED changer-device AND NOT DEFINED tape-devices)
  message(STATUS "Error: Changer device defined but no tape device defined")
  set(error_odd_devices TRUE)
elseif(NOT DEFINED changer-device AND DEFINED tape-devices)
  message(STATUS "Error: Tape device defined but no changer device defined")
  set(error_odd_devices TRUE)
endif()

if(DEFINED changer-device)
  execute_process(
    COMMAND ls "${changer-device}"
    RESULT_VARIABLE changer_device0_exists
    OUTPUT_QUIET ERROR_QUIET
  )
endif()

if(NOT ${changer_device0_exists} EQUAL 0)
  message(STATUS "Error: Could not find changer-device \"${changer-device}\"")
  set(error_changer0 TRUE)
endif()

if(DEFINED tape-devices)
  list(LENGTH tape-devices number_of_tape_devices)
  if(number_of_tape_devices EQUAL 0)
    message(STATUS "Error: list of tape-devices is empty")
    set(error_tape_devices0 TRUE)
  else()
    foreach(device ${tape-devices})
      execute_process(
        COMMAND ls "${device}"
        RESULT_VARIABLE tape_device_exists
        OUTPUT_QUIET ERROR_QUIET
      )
      if(NOT ${tape_device_exists} EQUAL 0)
        message(STATUS "Error: Could not find tape-device \"${device}\"")
        set(error_tape_devices0 TRUE)
      endif()
    endforeach()
  endif()
endif()

if(error_changer0
   OR error_tape_devices0
   OR error_odd_devices
)
  set(changer_example
      "-D changer-device=\"/dev/tape/by-id/scsi-SSTK_L700_XYZZY_A\""
  )
  set(tape_example
      "-D tape-devices=\"/dev/tape/by-id/scsi-XYZZY_A1-nst;/dev/tape/by-id/scsi-XYZZY_A2-nst;/dev/tape/by-id/scsi-XYZZY_A3-nst;/dev/tape/by-id/scsi-XYZZY_A4-nst\""
  )
  message(
    FATAL_ERROR
      "Errors occurred during cmake run for autochanger test (see above).\n\nUse this Example as guideline:
    ${changer_example} ${tape_example}\n"
  )
else() # no error
  if(DEFINED changer-device AND DEFINED tape-devices)
    set(autochanger_devices_found TRUE)
  endif()
endif()
if(autochanger_devices_found)
  set(AUTOCHANGER_DEVICES_FOUND
      TRUE
      PARENT_SCOPE
  )
  set(CHANGER_DEVICE0
      ${changer-device}
      PARENT_SCOPE
  )

  list(JOIN tape-devices "\" \"" joined_tape_devices_0)
  set(TAPE_DEVICES0
      "\"${joined_tape_devices_0}\""
      PARENT_SCOPE
  )

  message(
    STATUS
      "Found these devices for autochanger test: \"${changer-device}\" \"${joined_tape_devices_0}\""
  )
endif()

# gfapi-fd
if(NOT DEFINED gfapi_fd_testvolume)
  set(gfapi_fd_testvolume
      testvol
      PARENT_SCOPE
  )
endif()