-
Notifications
You must be signed in to change notification settings - Fork 95
/
CMakeLists.txt
2574 lines (2239 loc) · 71.9 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
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
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
## CMakeLists.txt
##
## Copyright (C) 2006-2024 Christian Schenk
##
## This file is free software; the copyright holder gives
## unlimited permission to copy and/or distribute it, with or
## without modifications, as long as this notice is preserved.
###############################################################################
## CMake controls
cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_COLOR_MAKEFILE FALSE)
#set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
set(CMAKE_LINK_DEPENDS_NO_SHARED 1)
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET
"10.12"
CACHE STRING
"The earliest version of MacOS X that MiKTeX will run on."
)
#set(CMAKE_EXE_LINKER_FLAGS "-Wl,-no_weak_imports")
endif()
###############################################################################
## CMake policies
# CMP0071: Let AUTOMOC and AUTOUIC process GENERATED files.
list(APPEND cmake_policies_new
CMP0071
)
foreach(p ${cmake_policies_new})
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
###############################################################################
## the name of the game
set(MIKTEX_PRODUCT_NAME "MiKTeX")
string(TOLOWER ${MIKTEX_PRODUCT_NAME} MIKTEX_PRODUCT_TAG)
include(miktex-version.cmake)
include(miktex-local-version.cmake OPTIONAL)
if(MIKTEX_PATCH_VERSION EQUAL 0)
set(miktex_project_version ${MIKTEX_MAJOR_VERSION}.${MIKTEX_MINOR_VERSION})
else()
set(miktex_project_version ${MIKTEX_MAJOR_VERSION}.${MIKTEX_MINOR_VERSION}.${MIKTEX_PATCH_VERSION})
endif()
project(${MIKTEX_PRODUCT_TAG}
VERSION ${miktex_project_version}
)
###############################################################################
## global C/C++ options
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
###############################################################################
## system type
if(WIN32 AND NOT UNIX)
set(MIKTEX_NATIVE_WINDOWS TRUE)
else()
set(MIKTEX_UNIX_ALIKE TRUE)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "BSD/OS")
set(system_name "openbsd")
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
set(system_name "hpux")
elseif(CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD")
set(MIKTEX_FREEBSD TRUE)
set(system_name "freebsd")
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(MIKTEX_FREEBSD TRUE)
set(system_name "freebsd")
elseif(CMAKE_SYSTEM_NAME MATCHES "SCO_SV")
set(system_name "scosv")
elseif(CMAKE_SYSTEM_NAME MATCHES "UNIX_SV")
set(system_name "unixsv")
elseif(CMAKE_SYSTEM_NAME MATCHES "CYGWIN_NT-.+")
set(system_name "cygwin")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(MIKTEX_LINUX TRUE)
set(system_name "linux")
else()
string(TOLOWER "${CMAKE_SYSTEM_NAME}" system_name)
endif()
if(MIKTEX_NATIVE_WINDOWS)
if(CMAKE_CL_64)
set(system_cpu "x64")
set(MIKTEX_MANIFEST_PROCESSOR_ARCHITECTURE "amd64")
else()
set(system_cpu "x86")
set(MIKTEX_MANIFEST_PROCESSOR_ARCHITECTURE "x86")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86")
set(system_cpu "x86")
else()
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" system_cpu)
endif()
#set(MIKTEX_TARGET_SYSTEM_TAG "${system_cpu}-${system_name}")
set(MIKTEX_TARGET_SYSTEM_TAG "${system_name}-${system_cpu}")
if(MIKTEX_NATIVE_WINDOWS)
set(MIKTEX_MIN_TARGET_SYSTEM_VERSION "6.1.7601")
endif()
set(MIKTEX_SHORTEST_TARGET_SYSTEM_TAG_WIN "win")
set(MIKTEX_SHORTEST_TARGET_SYSTEM_TAG_UNX "unx")
if(MIKTEX_NATIVE_WINDOWS)
set(MIKTEX_SHORTEST_TARGET_SYSTEM_TAG ${MIKTEX_SHORTEST_TARGET_SYSTEM_TAG_WIN})
else()
set(MIKTEX_SHORTEST_TARGET_SYSTEM_TAG ${MIKTEX_SHORTEST_TARGET_SYSTEM_TAG_UNX})
endif()
###############################################################################
## macOS: bundle vs Homebrew detection
string(SUBSTRING ${CMAKE_INSTALL_PREFIX} 0 17 homebrew_cellar)
if(homebrew_cellar STREQUAL "/usr/local/Cellar")
set(MIKTEX_HOMEBREW TRUE)
endif()
if(APPLE AND NOT MIKTEX_HOMEBREW)
set(MIKTEX_MACOS_BUNDLE TRUE)
endif()
###############################################################################
## handle install prefix standards
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
set(MIKTEX_SELF_CONTAINED_DEFAULT FALSE)
elseif(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
set(MIKTEX_SELF_CONTAINED_DEFAULT FALSE)
elseif(MIKTEX_HOMEBREW)
set(MIKTEX_SELF_CONTAINED_DEFAULT FALSE)
elseif(MIKTEX_UNIX_ALIKE AND NOT MIKTEX_MACOS_BUNDLE)
set(MIKTEX_SELF_CONTAINED_DEFAULT TRUE)
endif()
###############################################################################
## user options
option(
MIKTEX_SELF_CONTAINED
"Build and install a self-contained MiKTeX distribution."
${MIKTEX_SELF_CONTAINED_DEFAULT}
)
option(
MIKTEX_CORE_AUTO_ADMIN
"Turn on adminstrator mode for shared installations and elevated programs."
FALSE
)
option(
MIKTEX_MPM_AUTO_ADMIN
"Install packages for all users."
FALSE
)
option(
MIKTEX_MPM_AUTO_INSTALL
"Install missing packages automatically (on-the-fly)."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_APR
"Use the system Apache Portable Runtime (APR) library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_APRUTIL
"Use the system Apache Portable Runtime (APR-util) library."
${MIKTEX_UNIX_ALIKE}
)
# we always depend on the system Boost development files
set(
USE_SYSTEM_BOOST
TRUE
)
option(
USE_SYSTEM_BZIP2
"Use the system bzip2 compression library."
${MIKTEX_UNIX_ALIKE}
)
if(MIKTEX_MACOS_BUNDLE)
set(use_system_cairo_default FALSE)
elseif(MIKTEX_UNIX_ALIKE)
set(use_system_cairo_default TRUE)
endif()
option(
USE_SYSTEM_CAIRO
"Use the system Cairo 2D graphics library."
${use_system_cairo_default}
)
option(
USE_SYSTEM_CURL
"Use the system libcurl URL transfer library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_EXPAT
"Use the system Expat XML parser library."
${MIKTEX_UNIX_ALIKE}
)
if(MIKTEX_MACOS_BUNDLE)
set(use_system_fontconfig_default FALSE)
elseif(MIKTEX_UNIX_ALIKE)
set(use_system_fontconfig_default TRUE)
endif()
option(
USE_SYSTEM_FMT
"Use the system fmt library."
FALSE
)
option(
USE_SYSTEM_FONTCONFIG
"Use the system Fontconfig library."
${use_system_fontconfig_default}
)
option(
USE_SYSTEM_FREETYPE2
"Use the system FreeType2 font engine library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_FRIBIDI
"Use the system GNU FriBiDi library."
${MIKTEX_UNIX_ALIKE}
)
if(MIKTEX_MACOS_BUNDLE)
set(use_system_gd_default FALSE)
elseif(MIKTEX_UNIX_ALIKE)
set(use_system_gd_default TRUE)
endif()
option(
USE_SYSTEM_GD
"Use the system GD graphics library."
${use_system_gd_default}
)
option(
USE_SYSTEM_GMP
"Use the system GNU Multiple Precision Arithmetic library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_GRAPHITE2
"Use the system Graphite2 library."
${MIKTEX_UNIX_ALIKE}
)
if(MIKTEX_HOMEBREW OR MIKTEX_MACOS_BUNDLE)
set(use_system_harfbuzz_default FALSE)
elseif(MIKTEX_UNIX_ALIKE)
set(use_system_harfbuzz_default TRUE)
endif()
option(
USE_SYSTEM_HARFBUZZ
"Use the system Harfbuzz text shaping library."
${use_system_harfbuzz_default}
)
if(MIKTEX_HOMEBREW OR MIKTEX_MACOS_BUNDLE)
set(use_system_harfbuzz_icu_default FALSE)
elseif(MIKTEX_UNIX_ALIKE)
set(use_system_harfbuzz_icu_default TRUE)
endif()
option(
USE_SYSTEM_HARFBUZZ_ICU
"Use the system Harfbuzz (ICU) text shaping library."
${use_system_harfbuzz_icu_default}
)
option(
USE_SYSTEM_HUNSPELL
"Use the system Hunspell spell checker library."
${MIKTEX_UNIX_ALIKE}
)
# we always depend on the system ICU development files
set(
USE_SYSTEM_ICU
TRUE
)
option(
USE_SYSTEM_JPEG
"Use the system JPEG library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_LOG4CXX
"Use the system Log4cxx logging framework library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_LZMA
"Use the system LZMA compression library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_MPFI
"Use the system Multiple Precision Floating-Point Interval Library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_MPFR
"Use the system GNU Multiple Precision Floating-Point Reliably (MPFR) library."
${MIKTEX_UNIX_ALIKE}
)
if(MIKTEX_HOMEBREW OR MIKTEX_MACOS_BUNDLE)
set(use_system_mspack_default FALSE)
elseif(MIKTEX_UNIX_ALIKE)
set(use_system_mspack_default TRUE)
endif()
option(
USE_SYSTEM_MSPACK
"Use the system mspack compression library."
${use_system_mspack_default}
)
option(
USE_SYSTEM_OPENSSL_CRYPTO
"Use the system OpenSSL/LibreSSL crypto library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_PIXMAN
"Use the system Pixman pixel manipulation library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_PNG
"Use the system PNG library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_POPPLER
"Use the system Poppler PDF Rendering library."
FALSE
)
option(
USE_SYSTEM_POPPLER_QT
"Use the system Poppler PDF Rendring (Qt Wrapper) library."
FALSE
)
option(
USE_SYSTEM_POPT
"Use the system popt (command-line options parser) library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_URIPARSER
"Use the system uriparser (URI parser) library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_ZLIB
"Use the system zlib compression library."
${MIKTEX_UNIX_ALIKE}
)
option(
USE_SYSTEM_ZZIP
"Use the system Zzip compression library."
${MIKTEX_UNIX_ALIKE}
)
option(
WITH_ASYMPTOTE
"Build asymptote."
${MIKTEX_NATIVE_WINDOWS}
)
option(
WITH_BOOTSTRAPPING
"Install files necessary for initializing a bare MiKTeX installation."
${MIKTEX_UNIX_ALIKE}
)
option(
WITH_CODE_SIGNING
"Sign MiKTeX executables."
FALSE
)
option(
WITH_PACKAGE_DB_SIGNING
"MiKTeX package database files must be signed."
TRUE
)
option(
WITH_LIBRESSL_CRYPTO
"Use the LibreSSL crypto library supplied with MiKTeX."
${WIN32}
)
option(
WITH_TRAPMF
"Build trapmf."
FALSE
)
option(
WITH_TRIPTEX
"Build triptex."
FALSE
)
option(
WITH_UI_QT
"Build Qt components."
TRUE
)
option(
WITH_STANDALONE_SETUP
"Build standalone setup programs."
${MIKTEX_NATIVE_WINDOWS}
)
option(
WITH_UI_MFC
"Build MFC components."
${MSVC}
)
option(
WITH_COM
"Build COM components."
${MSVC}
)
option(
WITH_MPC
"Build mpc (MiKTeX Package Composer)."
TRUE
)
option(
WITH_SYNCTEX
"Enable SyncTeX extensions."
TRUE
)
option(
WITH_LEGACY_WINDOWS_SUPPORT
"Wether to support Windows 7/8."
TRUE
)
option(
INSTALL_MIKTEX_HEADERS
"Install the MiKTeX header files."
FALSE
)
option(
INSTALL_STATIC_LIBRARIES
"Install static libraries."
FALSE
)
option(
WITH_CONTEXT_SUPPORT
"Enable ConTeXt support."
FALSE
)
option(
WITH_TPMS
"Build package manifest files."
${WIN32}
)
option(
WITH_CONFIG_FILES
"Build configuration files."
${WIN32}
)
option(
WITH_MIKTEX_DOC
"Build miktex-doc package."
${WIN32}
)
option(
WITH_MIKTEX_API_DOC
"Build API documentation."
${WIN32}
)
option(
WITH_SCRIPTS
"Build script files."
${WIN32}
)
option(
WITH_MAN_PAGES
"Build man pages."
${MIKTEX_UNIX_ALIKE}
)
option(
WITH_RUNGS
"Create rungs, a symbolic link to the miktex-rungs executable."
TRUE
)
option(
WITH_KPSEWHICH
"Create kpsewhich, a symbolic link to the miktex-kpsewhich executable."
TRUE
)
option(
WITH_MKTEXLSR
"Create mktexlsr, a symbolic link to One MiKTeX Utility."
TRUE
)
option(
WITH_TEXHASH
"Create texhash, a symbolic link to One MiKTeX Utility."
TRUE
)
option(
WITH_TEXLINKS
"Create texlinks, a symbolic link to One MiKTeX Utility."
TRUE
)
option(
WITH_TEXDOC
"Create texdoc, a symbolic link to MiKTeX Help Utility."
TRUE
)
option(
WITH_UPDMAP
"Create updmap, a symbolic link to One MiKTeX Utility."
TRUE
)
if(WITH_ASYMPTOTE AND MIKTEX_NATIVE_WINDOWS)
set(USE_SYSTEM_OPENGL TRUE)
endif()
set(QT_SERIES "6" CACHE STRING "The Qt series to be used.")
###############################################################################
## fixed values
set(MIKTEX_HQ_BASE_URL_NO_SLASH "https://miktex.org")
set(MIKTEX_HQ_BASE_URL "${MIKTEX_HQ_BASE_URL_NO_SLASH}/")
set(MIKTEX_DOC_BASE_URL_NO_SLASH "https://docs.miktex.org")
set(MIKTEX_DOC_BASE_URL "${MIKTEX_DOC_BASE_URL_NO_SLASH}/")
set(MIKTEX_PREFIX "miktex-")
set(MIKTEX_ADMIN_SUFFIX "_admin")
set(MIKTEX_STANDALONE_SUFFIX "_standalone")
## autotools compatibility names
set(PACKAGE_NAME ${MIKTEX_PRODUCT_NAME})
set(top_srcdir "${CMAKE_SOURCE_DIR}")
if(MIKTEX_NATIVE_WINDOWS)
set(MIKTEX_DEV_NULL "nul")
else()
set(MIKTEX_DEV_NULL "/dev/null")
endif()
if(MIKTEX_MACOS_BUNDLE)
set(MIKTEX_CODESIGN_IDENTITY "Developer ID")
endif()
###############################################################################
## version information
string(TIMESTAMP MIKTEX_DATETIME_STR UTC)
if(MIKTEX_MONTH_VERSION EQUAL 1)
set(MIKTEX_MONTH_NAME_VERSION "January")
elseif(MIKTEX_MONTH_VERSION EQUAL 2)
set(MIKTEX_MONTH_NAME_VERSION "February")
elseif(MIKTEX_MONTH_VERSION EQUAL 3)
set(MIKTEX_MONTH_NAME_VERSION "March")
elseif(MIKTEX_MONTH_VERSION EQUAL 4)
set(MIKTEX_MONTH_NAME_VERSION "April")
elseif(MIKTEX_MONTH_VERSION EQUAL 5)
set(MIKTEX_MONTH_NAME_VERSION "May")
elseif(MIKTEX_MONTH_VERSION EQUAL 6)
set(MIKTEX_MONTH_NAME_VERSION "June")
elseif(MIKTEX_MONTH_VERSION EQUAL 7)
set(MIKTEX_MONTH_NAME_VERSION "July")
elseif(MIKTEX_MONTH_VERSION EQUAL 8)
set(MIKTEX_MONTH_NAME_VERSION "August")
elseif(MIKTEX_MONTH_VERSION EQUAL 9)
set(MIKTEX_MONTH_NAME_VERSION "September")
elseif(MIKTEX_MONTH_VERSION EQUAL 10)
set(MIKTEX_MONTH_NAME_VERSION "October")
elseif(MIKTEX_MONTH_VERSION EQUAL 11)
set(MIKTEX_MONTH_NAME_VERSION "November")
elseif(MIKTEX_MONTH_VERSION EQUAL 12)
set(MIKTEX_MONTH_NAME_VERSION "December")
endif()
if(MIKTEX_LINUX)
set(MIKTEX_LINUX_DIST
"ubuntu"
CACHE STRING
"The Linux distribution (ubuntu, debian, fedora, ...)."
)
set(MIKTEX_LINUX_DIST_VERSION
"16.04"
CACHE STRING
"The Linux distribution version (16.04, 9, 28, ...)."
)
set(MIKTEX_LINUX_DIST_CODE_NAME
"xenial"
CACHE STRING
"The Linux distribution code name (xenial, stretch, ...)."
)
endif()
## the release state; one of:
## 0 (stable)
## 1 (next)
## 4 (debug)
set(MIKTEX_RELEASE_STATE
0
CACHE STRING
"The MiKTeX release state."
)
## sanity check
if(MIKTEX_RELEASE_STATE EQUAL 0)
elseif(MIKTEX_RELEASE_STATE EQUAL 1)
elseif(MIKTEX_RELEASE_STATE EQUAL 4)
else()
message("${MIKTEX_RELEASE_STATE} is an unknown release state.")
message("Falling back to release state 4 (debug).")
set(MIKTEX_RELEASE_STATE
4
CACHE STRING
"MiKTeX release state; one of 0 (stable), 1 (next), 4 (debug)."
FORCE
)
endif()
find_package(Git)
add_custom_target(gen-git-info
COMMAND ${CMAKE_COMMAND}
-D GIT_FOUND=${Git_FOUND}
-D GIT_EXECUTABLE=${GIT_EXECUTABLE}
-D SOURCE_DIR=${CMAKE_SOURCE_DIR}
-D GITINFO_H_IN=${CMAKE_SOURCE_DIR}/include/miktex/GitInfo.h.in
-D GITINFO_H=${CMAKE_BINARY_DIR}/include/miktex/GitInfo.h
-P ${CMAKE_CURRENT_SOURCE_DIR}/gen-git-info.cmake
)
set(MIKTEX_MAJOR_MINOR_STR
"${MIKTEX_MAJOR_VERSION}.${MIKTEX_MINOR_VERSION}"
)
set(MIKTEX_MAJOR_MINOR_PATCH_STR
"${MIKTEX_MAJOR_VERSION}.${MIKTEX_MINOR_VERSION}.${MIKTEX_PATCH_VERSION}"
)
set(MIKTEX_PACKAGES_MAJOR_MINOR_STR
"${MIKTEX_PACKAGES_MAJOR_VERSION}.${MIKTEX_PACKAGES_MINOR_VERSION}"
)
if(MIKTEX_NATIVE_WINDOWS)
set(MIKTEX_COM_MAJOR_MINOR_STR
"${MIKTEX_COM_MAJOR_VERSION}.${MIKTEX_COM_MINOR_VERSION}"
)
set(MIKTEX_COM_MAJOR_MINOR_ID_STR
"${MIKTEX_COM_MAJOR_VERSION}_${MIKTEX_COM_MINOR_VERSION}"
)
math(
EXPR
MIKTEX_COM_MAJOR_MINOR_INT
"(100 * ${MIKTEX_COM_MAJOR_VERSION}) + ${MIKTEX_COM_MINOR_VERSION}"
)
endif()
math(
EXPR
MIKTEX_MAJOR_MINOR_INT
"(100 * ${MIKTEX_MAJOR_VERSION}) + ${MIKTEX_MINOR_VERSION}"
)
math(
EXPR
MIKTEX_MAJOR_MINOR_PATCH_INT
"(10000 * ${MIKTEX_MAJOR_VERSION}) + (100 * ${MIKTEX_MINOR_VERSION}) + ${MIKTEX_PATCH_VERSION}"
)
if(MIKTEX_RELEASE_STATE EQUAL 0)
if(MIKTEX_PATCH_VERSION EQUAL 0)
set(default_miktex_display_version_str "${MIKTEX_MAJOR_MINOR_STR}")
set(default_miktex_version_str "${MIKTEX_MAJOR_MINOR_STR}")
else()
set(default_miktex_display_version_str "${MIKTEX_MAJOR_MINOR_PATCH_STR}")
set(default_miktex_version_str "${MIKTEX_MAJOR_MINOR_PATCH_STR}")
endif()
elseif(MIKTEX_RELEASE_STATE EQUAL 1)
if(MIKTEX_PATCH_VERSION EQUAL 0)
set(default_miktex_display_version_str "${MIKTEX_MAJOR_MINOR_STR} NEXT")
set(default_miktex_version_str "${MIKTEX_MAJOR_MINOR_STR}-next")
else()
set(default_miktex_display_version_str "${MIKTEX_MAJOR_MINOR_PATCH_STR} NEXT")
set(default_miktex_version_str "${MIKTEX_MAJOR_MINOR_PATCH_STR}-next")
endif()
elseif(MIKTEX_RELEASE_STATE EQUAL 4)
if(MIKTEX_PATCH_VERSION EQUAL 0)
set(default_miktex_display_version_str "${MIKTEX_MAJOR_MINOR_STR} debug")
set(default_miktex_version_str "${MIKTEX_MAJOR_MINOR_STR}-debug")
else()
set(default_miktex_display_version_str "${MIKTEX_MAJOR_MINOR_PATCH_STR} debug")
set(default_miktex_version_str "${MIKTEX_MAJOR_MINOR_PATCH_STR}-debug")
endif()
endif()
set(MIKTEX_DISPLAY_VERSION_STR
"${default_miktex_display_version_str}"
CACHE STRING
"The MiKTeX version presented to the user."
FORCE
)
set(MIKTEX_VERSION_STR
"${default_miktex_version_str}"
CACHE STRING
"The MiKTeX version."
FORCE
)
if(MIKTEX_RELEASE_STATE EQUAL 1)
set(MIKTEX_DEFAULT_PACKAGE_STREAM "next")
else()
set(MIKTEX_DEFAULT_PACKAGE_STREAM "stable")
endif()
set(MIKTEX_LEGACY_MAJOR_MINOR_STR "${MIKTEX_LEGACY_MAJOR_VERSION}.${MIKTEX_LEGACY_MINOR_VERSION}")
###############################################################################
## Localization
set(MIKTEX_INTERNAL_LOCALE "en")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "af")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "ar")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "ca")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "cs")
LIST(APPEND MIKTEX_TRANSLATION_LOCALES "de")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "es")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "fa")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "fo")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "fr")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "it")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "ja")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "ko")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "nl")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "nn")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "pl")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "pt")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "ru")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "sk")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "sl")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "sr")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "tr")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "uk")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "vi")
LIST(APPEND MIKTEX_TRANSLATION_LOCALES "zh_CN")
#LIST(APPEND MIKTEX_TRANSLATION_LOCALES "zh_TW")
set(MIKTEX_TRANSLATION_THRESHOLD 50)
set(MIKTEX_TRANSLATION_PROGRESS__af 0)
set(MIKTEX_TRANSLATION_PROGRESS__ar 0)
set(MIKTEX_TRANSLATION_PROGRESS__ca 0)
set(MIKTEX_TRANSLATION_PROGRESS__cs 0)
set(MIKTEX_TRANSLATION_PROGRESS__de 51)
set(MIKTEX_TRANSLATION_PROGRESS__es 0)
set(MIKTEX_TRANSLATION_PROGRESS__fa 0)
set(MIKTEX_TRANSLATION_PROGRESS__fo 0)
set(MIKTEX_TRANSLATION_PROGRESS__fr 0)
set(MIKTEX_TRANSLATION_PROGRESS__it 0)
set(MIKTEX_TRANSLATION_PROGRESS__ja 0)
set(MIKTEX_TRANSLATION_PROGRESS__ko 0)
set(MIKTEX_TRANSLATION_PROGRESS__nl 0)
set(MIKTEX_TRANSLATION_PROGRESS__nn 0)
set(MIKTEX_TRANSLATION_PROGRESS__pl 0)
set(MIKTEX_TRANSLATION_PROGRESS__pt 0)
set(MIKTEX_TRANSLATION_PROGRESS__ru 0)
set(MIKTEX_TRANSLATION_PROGRESS__sk 0)
set(MIKTEX_TRANSLATION_PROGRESS__sl 0)
set(MIKTEX_TRANSLATION_PROGRESS__sr 0)
set(MIKTEX_TRANSLATION_PROGRESS__tr 0)
set(MIKTEX_TRANSLATION_PROGRESS__uk 0)
set(MIKTEX_TRANSLATION_PROGRESS__vi 0)
set(MIKTEX_TRANSLATION_PROGRESS__zh_CN 51)
set(MIKTEX_TRANSLATION_PROGRESS__zh_TW 0)
foreach(l ${MIKTEX_TRANSLATION_LOCALES})
if(MIKTEX_TRANSLATION_PROGRESS__${l} GREATER_EQUAL MIKTEX_TRANSLATION_THRESHOLD)
list(APPEND MIKTEX_TRANSLATION_DONE_LOCALES ${l})
endif()
endforeach()
###############################################################################
## Endianess
include(TestBigEndian)
test_big_endian(MIKTEX_WORDS_BIGENDIAN)
###############################################################################
## CMake modules
include(Admin/COM/guids.cmake)
include(FindPackageHandleStandardArgs)
include(GNUInstallDirs)
include(AddLinkFlags)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckFunctionExists)
include(CheckIncludeFileCXX)
include(CheckIncludeFiles)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckTypeSize)
include(CheckVariableExists)
include(ConfigNames)
include(CreateDllWrapper)
include(CreateWebApp)
include(DefaultCharTypeIsUnsigned)
include(DelayLoad)
include(ExecutableNames)
include(InstallPaths)
include(GenerateExportHeader)
include(LibraryNames)
include(RuntimePaths)
include(SetSharedLibraryVersion)
include(SourcePaths)
include(UseStaticCRT)
include(IgnoreWarnings)
###############################################################################
## build sandbox
set(MIKTEX_SANDBOX_SOURCE_DIR "${CMAKE_SOURCE_DIR}/sandbox")
set(MIKTEX_SANDBOX_BINARY_DIR "${CMAKE_BINARY_DIR}/sandbox")
set(MIKTEX_SANDBOX_USER_CONFIG_DIR "${MIKTEX_SANDBOX_BINARY_DIR}" CACHE PATH "MiKTeX user config root.")
set(MIKTEX_SANDBOX_USER_DATA_DIR "${MIKTEX_SANDBOX_BINARY_DIR}" CACHE PATH "MiKTeX user data root.")
set(MIKTEX_SANDBOX_USER_INSTALL_DIR "${MIKTEX_SANDBOX_BINARY_DIR}" CACHE PATH "MiKTeX user install root.")
set(MIKTEX_SANDBOX_USER_ROOTS "" CACHE PATH "MiKTeX user roots")
configure_file(
sandbox/miktex/config/miktexstartup.ini.in
${MIKTEX_SANDBOX_BINARY_DIR}/miktex/config/miktexstartup.ini
)
configure_file(
sandbox/miktex/config/miktex.ini.in
${MIKTEX_SANDBOX_BINARY_DIR}/miktex/config/miktex.ini
)
configure_file(
Admin/ConfigFiles/win/log4cxx.win.xml
${MIKTEX_SANDBOX_BINARY_DIR}/miktex/config/win/log4cxx.win.xml
COPYONLY
)
configure_file(
Admin/ConfigFiles/unx/log4cxx.unx.xml
${MIKTEX_SANDBOX_BINARY_DIR}/miktex/config/unx/log4cxx.unx.xml
COPYONLY
)
set(MIKTEX_AUTO_MAINTENANCE_LOCK "A6D646EE9FBF44D6A3E6C1A3A72FF7E3.lock")
# disable maintenance tasks while building
file(WRITE
${MIKTEX_SANDBOX_BINARY_DIR}/${MIKTEX_REL_MIKTEX_LOCK_DIR}/${MIKTEX_AUTO_MAINTENANCE_LOCK}
"-1\npermanently-locked\n"
)
set(outdir "${MIKTEX_SANDBOX_BINARY_DIR}/${MIKTEX_REL_MIKTEX_BIN_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${outdir}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${outdir}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${outdir}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${outdir}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${outdir}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${outdir}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${outdir}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${outdir}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${outdir}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${outdir}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${outdir}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${outdir}")
###############################################################################
## bootstrapping packages
if(WITH_BOOTSTRAPPING)
list(APPEND MIKTEX_BOOTSTRAPPING_PACKAGES
miktex-config-${MIKTEX_LEGACY_MAJOR_MINOR_STR}
miktex-dvips
miktex-fontconfig
miktex-misc
tetex
)
endif()
###############################################################################
## RPATH handling
if (NOT CMAKE_INSTALL_RPATH)
if(APPLE)
set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}")
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
endif()
endif()
###############################################################################
## find/check stuff
if(MIKTEX_NATIVE_WINDOWS)
if(WITH_LEGACY_WINDOWS_SUPPORT)
add_definitions(
-DMIKTEX_SUPPORT_LEGACY_WINDOWS
)
add_definitions(
-DWINVER=0x0600