-
-
Notifications
You must be signed in to change notification settings - Fork 211
/
Copy pathCMakeLists.txt
2110 lines (1995 loc) · 69.8 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
# ##############################################################################
# General CMake setup.
# ##############################################################################
cmake_minimum_required(VERSION 3.13)
project(tinyspline)
# Turn on folders. https://cmake.org/cmake/help/v3.0/prop_gbl/USE_FOLDERS.html
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Add additional CMake modules.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# ##############################################################################
# Project-related constants.
#
# TINYSPLINE_PACKAGE_NAME Name of the package.
#
# TINYSPLINE_AUTHOR Author's full name.
#
# TINYSPLINE_MAIL Contact email address.
#
# TINYSPLINE_URL URL of homepage.
#
# TINYSPLINE_ISSUE_TRACKER URL of issue tracker.
#
# TINYSPLINE_REPOSITORY URL of repository.
#
# TINYSPLINE_LICENSE TinySpline's license.
#
# TINYSPLINE_VERSION Current version.
#
# TINYSPLINE_SUMMARY Short description.
#
# TINYSPLINE_DESCRIPTION Long description.
# ##############################################################################
set(TINYSPLINE_PACKAGE_NAME
"tinyspline"
CACHE INTERNAL ""
)
set(TINYSPLINE_AUTHOR
"Marcel Steinbeck"
CACHE INTERNAL ""
)
set(TINYSPLINE_MAIL
"tinyspline@retux.de"
CACHE INTERNAL ""
)
set(TINYSPLINE_URL
"https://github.com/msteinbeck/tinyspline"
CACHE INTERNAL ""
)
set(TINYSPLINE_ISSUE_TRACKER
"https://github.com/msteinbeck/tinyspline/issues"
CACHE INTERNAL ""
)
set(TINYSPLINE_REPOSITORY
"https://github.com/msteinbeck/tinyspline.git"
CACHE INTERNAL ""
)
set(TINYSPLINE_SCM
"scm:git:git://github.com/msteinbeck/tinyspline.git"
CACHE INTERNAL ""
)
set(TINYSPLINE_SCM_CONNECTION
"scm:git:git@github.com:msteinbeck/tinyspline.git"
CACHE INTERNAL ""
)
set(TINYSPLINE_LICENSE
"MIT"
CACHE INTERNAL ""
)
set(TINYSPLINE_LICENSE_URL
"https://opensource.org/licenses/mit-license"
CACHE INTERNAL ""
)
set(TINYSPLINE_VERSION
"0.7.0"
CACHE INTERNAL ""
)
set(TINYSPLINE_SUMMARY
"Spline Library for a Multitude of Programming Languages"
CACHE INTERNAL ""
)
set(TINYSPLINE_DESCRIPTION
"TinySpline is a small, yet powerful library for interpolating, transforming, and querying arbitrary NURBS, B-Splines, and Bézier curves. The core of the library is written in ANSI C (C89) with a C++ wrapper for an object-oriented programming model. Based on the C++ wrapper, auto-generated bindings for C#, D, Go, Java, Javascript, Lua, Octave, PHP, Python, R, and Ruby are provided."
CACHE INTERNAL ""
)
# ##############################################################################
# Location-related constants. The default output directories will be restored at
# the end of this script.
#
# CMAKE_RUNTIME_OUTPUT_DIRECTORY_BACKUP Backup of
# CMAKE_RUNTIME_OUTPUT_DIRECTORY.
#
# CMAKE_LIBRARY_OUTPUT_DIRECTORY_BACKUP Backup of
# CMAKE_LIBRARY_OUTPUT_DIRECTORY.
#
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY_BACKUP Backup of
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY.
#
# CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG>_BACKUP Backup of config specific
# CMAKE_RUNTIME_OUTPUT_DIRECTORY.
#
# CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG>_BACKUP Backup of config specific
# CMAKE_LIBRARY_OUTPUT_DIRECTORY.
#
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>_BACKUP Backup of config specific
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY.
#
# TINYSPLINE_OUTPUT_DIRECTORY Output directory of build artifacts.
#
# TINYSPLINE_BINARY_DIR Parent directory of TINYSPLINE_OUTPUT_DIRECTORY.
#
# TINYSPLINE_<LANG>_SOURCE_DIRECTORY Location of the source code of binding
# <LANG>.
#
# TINYSPLINE_<LANG>_INTERFACE_FILE Full path of the interface file of binding
# <LANG> (if any).
#
# TINYSPLINE_DLANG_INTERMEDIATE_FILE Full path of D intermediate file.
# ##############################################################################
if(NOT DEFINED TINYSPLINE_OUTPUT_DIRECTORY)
set(TINYSPLINE_OUTPUT_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/lib"
CACHE INTERNAL ""
)
endif()
get_filename_component(
TINYSPLINE_BINARY_DIR ${TINYSPLINE_OUTPUT_DIRECTORY} DIRECTORY
)
# Generic no-config case (e.g. MinGW)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_BACKUP ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_BACKUP ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_BACKUP ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${TINYSPLINE_OUTPUT_DIRECTORY})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${TINYSPLINE_OUTPUT_DIRECTORY})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${TINYSPLINE_OUTPUT_DIRECTORY})
# Multi-config builds (e.g. MSVC)
foreach(TINYSPLINE_CONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${TINYSPLINE_CONFIG} TINYSPLINE_CONFIG)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}_BACKUP
${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}}
)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}_BACKUP
${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}}
)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}_BACKUP
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}}
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}
${TINYSPLINE_OUTPUT_DIRECTORY}
)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}
${TINYSPLINE_OUTPUT_DIRECTORY}
)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${TINYSPLINE_CONFIG}
${TINYSPLINE_OUTPUT_DIRECTORY}
)
endforeach()
set(TINYSPLINE_CSHARP_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/csharp"
CACHE INTERNAL ""
)
set(TINYSPLINE_DLANG_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/dlang"
CACHE INTERNAL ""
)
set(TINYSPLINE_GO_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/go"
CACHE INTERNAL ""
)
set(TINYSPLINE_JAVA_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/java"
CACHE INTERNAL ""
)
set(TINYSPLINE_LUA_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/lua"
CACHE INTERNAL ""
)
set(TINYSPLINE_OCTAVE_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/octave"
CACHE INTERNAL ""
)
set(TINYSPLINE_PHP_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/php"
CACHE INTERNAL ""
)
set(TINYSPLINE_PYTHON_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/python"
CACHE INTERNAL ""
)
set(TINYSPLINE_R_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/r"
CACHE INTERNAL ""
)
set(TINYSPLINE_RUBY_SOURCE_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/ruby"
CACHE INTERNAL ""
)
set(TINYSPLINE_CSHARP_INTERFACE_FILE
"${TINYSPLINE_OUTPUT_DIRECTORY}/TinySpline.dll"
CACHE INTERNAL ""
)
set(TINYSPLINE_DLANG_INTERFACE_FILE
"${TINYSPLINE_OUTPUT_DIRECTORY}/tinyspline.d"
CACHE INTERNAL ""
)
set(TINYSPLINE_GO_INTERFACE_FILE
"${TINYSPLINE_OUTPUT_DIRECTORY}/tinyspline.go"
CACHE INTERNAL ""
)
set(TINYSPLINE_JAVA_INTERFACE_FILE
"${TINYSPLINE_OUTPUT_DIRECTORY}/tinyspline.jar"
CACHE INTERNAL ""
)
set(TINYSPLINE_PYTHON_INTERFACE_FILE
"${TINYSPLINE_OUTPUT_DIRECTORY}/tinyspline.py"
CACHE INTERNAL ""
)
set(TINYSPLINE_R_INTERFACE_FILE
"${TINYSPLINE_OUTPUT_DIRECTORY}/tinyspline.R"
CACHE INTERNAL ""
)
set(TINYSPLINE_DLANG_INTERMEDIATE_FILE
"${TINYSPLINE_OUTPUT_DIRECTORY}/tinyspline_im.d"
CACHE INTERNAL ""
)
# Add additional files and directories to delete with 'cmake --build . --target
# clean'.
list(
APPEND
TINYSPLINE_ADDITIONAL_MAKE_CLEAN_FILES
${TINYSPLINE_CSHARP_SOURCE_DIRECTORY}
${TINYSPLINE_CSHARP_INTERFACE_FILE}
${TINYSPLINE_DLANG_SOURCE_DIRECTORY}
${TINYSPLINE_DLANG_INTERFACE_FILE}
${TINYSPLINE_DLANG_INTERMEDIATE_FILE}
${TINYSPLINE_GO_SOURCE_DIRECTORY}
${TINYSPLINE_GO_INTERFACE_FILE}
${TINYSPLINE_JAVA_SOURCE_DIRECTORY}
${TINYSPLINE_JAVA_INTERFACE_FILE}
${TINYSPLINE_LUA_SOURCE_DIRECTORY}
${TINYSPLINE_OCTAVE_SOURCE_DIRECTORY}
${TINYSPLINE_PHP_SOURCE_DIRECTORY}
${TINYSPLINE_PYTHON_SOURCE_DIRECTORY}
${TINYSPLINE_PYTHON_INTERFACE_FILE}
${TINYSPLINE_R_SOURCE_DIRECTORY}
${TINYSPLINE_R_INTERFACE_FILE}
${TINYSPLINE_RUBY_SOURCE_DIRECTORY}
)
set_directory_properties(
PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
"${TINYSPLINE_ADDITIONAL_MAKE_CLEAN_FILES}"
)
# ##############################################################################
# Host- and platform-related constants.
# ~~~
#
# TINYSPLINE_HOST_IS_WINDOWS
# True if host is Windows. False otherwise.
#
# TINYSPLINE_PLATFORM_NAME
# Name of target platform in lowercase. Supported values are: 'android',
# 'linux', 'macosx', 'windows', 'uwp' (Universal Windows Platform), 'wasm'
# (WebAssembly), and 'undefined' (fallback).
#
# TINYSPLINE_PLATFORM_IS_WINDOWS
# True if target platform is Windows. False otherwise.
#
# TINYSPLINE_PLATFORM_ARCH
# Architecture of target platform. Supported values are: 'arm', 'arm64',
# 'x86', 'x86_64', 'ia64', 'universal2', 'any' (usually only with 'wasm'),
# and 'unknown' (fallback).
#
# TINYSPLINE_PLATFORM
# Platform (target) specific identifier, e.g., 'linux-x86_64'.
#
# TINYSPLINE_MACOSX_TO_MACOSX
# True if host and target is macosx. False otherwise.
# ~~~
# ##############################################################################
# Host
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(TINYSPLINE_HOST_IS_WINDOWS
True
CACHE INTERNAL ""
)
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "WindowsStore")
set(TINYSPLINE_HOST_IS_WINDOWS
True
CACHE INTERNAL ""
)
else()
set(TINYSPLINE_HOST_IS_WINDOWS
False
CACHE INTERNAL ""
)
endif()
# Platform
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(TINYSPLINE_PLATFORM_NAME
"android"
CACHE INTERNAL ""
)
set(TINYSPLINE_PLATFORM_IS_WINDOWS
False
CACHE INTERNAL ""
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(TINYSPLINE_PLATFORM_NAME
"linux"
CACHE INTERNAL ""
)
set(TINYSPLINE_PLATFORM_IS_WINDOWS
False
CACHE INTERNAL ""
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(TINYSPLINE_PLATFORM_NAME
"macosx"
CACHE INTERNAL ""
)
set(TINYSPLINE_PLATFORM_IS_WINDOWS
False
CACHE INTERNAL ""
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(TINYSPLINE_PLATFORM_NAME
"windows"
CACHE INTERNAL ""
)
set(TINYSPLINE_PLATFORM_IS_WINDOWS
True
CACHE INTERNAL ""
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
set(TINYSPLINE_PLATFORM_NAME
"uwp"
CACHE INTERNAL ""
)
set(TINYSPLINE_PLATFORM_IS_WINDOWS
True
CACHE INTERNAL ""
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
set(TINYSPLINE_PLATFORM_NAME
"wasm"
CACHE INTERNAL ""
)
set(TINYSPLINE_PLATFORM_IS_WINDOWS
False
CACHE INTERNAL ""
)
else()
message(WARNING "Undefined platform name: ${CMAKE_SYSTEM_NAME}"
" -- Builds might be broken"
)
set(TINYSPLINE_PLATFORM_NAME
"undefined"
CACHE INTERNAL ""
)
set(TINYSPLINE_PLATFORM_IS_WINDOWS
False
CACHE INTERNAL ""
)
endif()
include(TargetArch)
target_architecture(TINYSPLINE_PLATFORM_ARCH)
if(${TINYSPLINE_PLATFORM_ARCH} STREQUAL "unknown")
message(WARNING "Unknown platform architecture" " -- Builds might be broken")
endif()
set(TINYSPLINE_PLATFORM
"${TINYSPLINE_PLATFORM_NAME}-${TINYSPLINE_PLATFORM_ARCH}"
CACHE INTERNAL ""
)
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin" AND ${CMAKE_SYSTEM_NAME}
STREQUAL "Darwin"
)
set(TINYSPLINE_MACOSX_TO_MACOSX
True
CACHE INTERNAL ""
)
else()
set(TINYSPLINE_MACOSX_TO_MACOSX
False
CACHE INTERNAL ""
)
endif()
# ##############################################################################
# CMake-related constants.
#
# TINYSPLINE_C_LIBRARY_OUTPUT_NAME Output name of the C library without
# prefix/postfix.
#
# TINYSPLINE_CXX_LIBRARY_OUTPUT_NAME Output name of the C++ library without
# prefix/postfix.
#
# TINYSPLINE_JS_LIBRARY_OUTPUT_NAME Output name of the JavaScript library
# without prefix/postfix.
#
# TINYSPLINE_<LANG>_CMAKE_TARGET CMake build target of binding <LANG>.
# ##############################################################################
set(TINYSPLINE_C_LIBRARY_OUTPUT_NAME "tinyspline")
set(TINYSPLINE_CXX_LIBRARY_OUTPUT_NAME "tinysplinecxx")
set(TINYSPLINE_JS_LIBRARY_OUTPUT_NAME "tinyspline")
set(TINYSPLINE_CSHARP_CMAKE_TARGET
"tinysplinecsharp"
CACHE INTERNAL ""
)
set(TINYSPLINE_DLANG_CMAKE_TARGET
"tinysplinedlang"
CACHE INTERNAL ""
)
set(TINYSPLINE_GO_CMAKE_TARGET
"tinysplinego"
CACHE INTERNAL ""
)
set(TINYSPLINE_JAVA_CMAKE_TARGET
"tinysplinejava"
CACHE INTERNAL ""
)
set(TINYSPLINE_JS_CMAKE_TARGET
"tinysplinejs"
CACHE INTERNAL ""
)
set(TINYSPLINE_LUA_CMAKE_TARGET
"tinysplinelua"
CACHE INTERNAL ""
)
set(TINYSPLINE_OCTAVE_CMAKE_TARGET
"tinysplineoctave"
CACHE INTERNAL ""
)
set(TINYSPLINE_PHP_CMAKE_TARGET
"tinysplinephp"
CACHE INTERNAL ""
)
set(TINYSPLINE_PYTHON_CMAKE_TARGET
"tinysplinepython"
CACHE INTERNAL ""
)
set(TINYSPLINE_R_CMAKE_TARGET
"tinyspliner"
CACHE INTERNAL ""
)
set(TINYSPLINE_RUBY_CMAKE_TARGET
"tinysplineruby"
CACHE INTERNAL ""
)
# ##############################################################################
# Add different options to this script.
#
# BUILD_SHARED_LIBS Build the C/C++ interface as shared library.
#
# TINYSPLINE_INSTALL_INCLUDE_DIR Installation directory of header files.
#
# TINYSPLINE_INSTALL_LIBRARY_DIR Installation directory of library files.
#
# TINYSPLINE_INSTALL_BINARY_DIR Installation directory of binary files.
#
# TINYSPLINE_INSTALL_CMAKE_CONFIG_DIR Installation directory of CMake config
# files.
#
# TINYSPLINE_INSTALL_PKGCONFIG_DIR Installation directory of pkg-config files.
#
# TINYSPLINE_FLOAT_PRECISION - default: OFF Build with float instead of double
# precision.
#
# TINYSPLINE_WARNINGS_AS_ERRORS - default: ON Treat compiler warnings as errors
# by adding /WX or -Werror to the compiler flags.
#
# TINYSPLINE_PYTHON_VERSION - default: ANY Force Python version.
#
# TINYSPLINE_ENABLE_<LANG> - default: TRUE for CXX, FALSE otherwise Enables
# interface <LANG>.
#
# TINYSPLINE_ENABLE_ALL_INTERFACES If set, all interfaces are enabled
# automatically.
#
# TINYSPLINE_RUNTIME_LIBRARIES List of compiler specific runtime libraries that
# mus be included into distribution artifacts.
# ##############################################################################
option(BUILD_SHARED_LIBS "Build the C/C++ interface as shared library." FALSE)
set(TINYSPLINE_BINDING_LINK_LIBRARIES
""
CACHE
STRING
"Additional libraries to link against when building one of the bindings"
)
set(TINYSPLINE_INSTALL_INCLUDE_DIR
"include"
CACHE
STRING
"Installation directory of header files (relative to CMAKE_INSTALL_PREFIX)."
)
set(TINYSPLINE_INSTALL_LIBRARY_DIR
""
CACHE
STRING
"Installation directory of library files (relative to CMAKE_INSTALL_PREFIX). If empty, the directory is determined automatically."
)
if(TINYSPLINE_INSTALL_LIBRARY_DIR STREQUAL "")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TINYSPLINE_INSTALL_LIBRARY_DIR
"lib64"
CACHE STRING "Autodetected." FORCE
)
else()
set(TINYSPLINE_INSTALL_LIBRARY_DIR
"lib"
CACHE STRING "Autodetected." FORCE
)
endif()
endif()
set(TINYSPLINE_INSTALL_BINARY_DIR
"bin"
CACHE
STRING
"Installation directory of binary files (relative to CMAKE_INSTALL_PREFIX)."
)
set(TINYSPLINE_INSTALL_CMAKE_CONFIG_DIR
"cmake"
CACHE
STRING
"Installation directory of CMake config files (relative to TINYSPLINE_INSTALL_LIBRARY_DIR)."
)
set(TINYSPLINE_INSTALL_PKGCONFIG_DIR
"pkgconfig"
CACHE
STRING
"Installation directory of pkg-config files (relative to TINYSPLINE_INSTALL_LIBRARY_DIR)."
)
option(TINYSPLINE_FLOAT_PRECISION "Build TinySpline with float precision." OFF)
option(TINYSPLINE_WARNINGS_AS_ERRORS "Treat warnings as errors" ON)
set(TINYSPLINE_PYTHON_VERSION
"ANY"
CACHE
STRING
"Force Python version. Supported values are: '2', '3', and 'ANY' (fallback for unknown values)."
)
option(TINYSPLINE_ENABLE_CXX "Enable the C++ interface." TRUE)
option(TINYSPLINE_ENABLE_CSHARP "Enable the C# interface." FALSE)
option(TINYSPLINE_ENABLE_DLANG "Enable the D interface." FALSE)
option(TINYSPLINE_ENABLE_GO "Enable the Go interface." FALSE)
option(TINYSPLINE_ENABLE_JAVA "Enable the Java interface." FALSE)
option(TINYSPLINE_ENABLE_LUA "Enable the Lua interface." FALSE)
option(TINYSPLINE_ENABLE_OCTAVE "Enable the Octave interface." FALSE)
option(TINYSPLINE_ENABLE_PHP "Enable the PHP interface." FALSE)
option(TINYSPLINE_ENABLE_PYTHON "Enable the Python interface." FALSE)
option(TINYSPLINE_ENABLE_R "Enable the R interface." FALSE)
option(TINYSPLINE_ENABLE_RUBY "Enable the Ruby interface." FALSE)
option(TINYSPLINE_ENABLE_ALL_INTERFACES "Enable all interfaces." FALSE)
if(TINYSPLINE_ENABLE_ALL_INTERFACES)
set(TINYSPLINE_ENABLE_CXX TRUE)
set(TINYSPLINE_ENABLE_CSHARP TRUE)
set(TINYSPLINE_ENABLE_DLANG TRUE)
set(TINYSPLINE_ENABLE_GO TRUE)
set(TINYSPLINE_ENABLE_JAVA TRUE)
set(TINYSPLINE_ENABLE_LUA TRUE)
set(TINYSPLINE_ENABLE_OCTAVE TRUE)
set(TINYSPLINE_ENABLE_PHP TRUE)
set(TINYSPLINE_ENABLE_PYTHON TRUE)
set(TINYSPLINE_ENABLE_R TRUE)
set(TINYSPLINE_ENABLE_RUBY TRUE)
endif()
set(TINYSPLINE_RUNTIME_LIBRARIES
""
CACHE
FILEPATH
"Compiler specific runtime libraries that must be included into distribution artifacts. If empty, the necessary files are determined automatically."
)
# ##############################################################################
# Map supported environment variables to CMake variables.
#
# BUILD_SHARED_LIBS See corresponding option above.
#
# TINYSPLINE_FLOAT_PRECISION See corresponding option above.
#
# TINYSPLINE_PYTHON_VERSION See corresponding option above.
# ##############################################################################
if(DEFINED ENV{BUILD_SHARED_LIBS})
message(STATUS "Using environment variable 'BUILD_SHARED_LIBS'")
set(BUILD_SHARED_LIBS $ENV{BUILD_SHARED_LIBS})
endif()
if(DEFINED ENV{TINYSPLINE_FLOAT_PRECISION})
message(STATUS "Using environment variable 'TINYSPLINE_FLOAT_PRECISION'")
set(TINYSPLINE_FLOAT_PRECISION $ENV{TINYSPLINE_FLOAT_PRECISION})
endif()
if(DEFINED ENV{TINYSPLINE_PYTHON_VERSION})
message(STATUS "Using environment variable 'TINYSPLINE_PYTHON_VERSION'")
set(TINYSPLINE_PYTHON_VERSION $ENV{TINYSPLINE_PYTHON_VERSION})
endif()
# ##############################################################################
# Set up the compiler suite.
# ~~~
#
# TINYSPLINE_C_DEFINITIONS
# C preprocessor definitions (as list).
#
# TINYSPLINE_CXX_DEFINITIONS
# C++ preprocessor definitions (as list).
#
# TINYSPLINE_BINDING_CXX_DEFINITIONS
# C++ binding preprocessor definitions (as list).
#
# TINYSPLINE_C_LINK_LIBRARIES
# Additional libraries to link against when building TinySpline's C interface
# from source or when linking against it statically (as list).
#
# TINYSPLINE_CXX_LINK_LIBRARIES
# Additional libraries to link against when building TinySpline's C++
# interface from source or when linking against it statically (as list).
#
# TINYSPLINE_LIBRARY_C_FLAGS
# C library flags.
#
# TINYSPLINE_LIBRARY_CXX_FLAGS
# C++ library flags.
#
# TINYSPLINE_BINDING_CXX_FLAGS
# C++ binding flags.
#
# TINYSPLINE_BINDING_LINKER_FLAGS
# Flags to be used when linking the bindings.
#
# TINYSPLINE_PKGCONFIG_C_FLAGS
# Cflags added to the pkg-config file of the C library.
#
# TINYSPLINE_PKGCONFIG_CXX_FLAGS
# Cflags added to the pkg-config file of the C++ library.
#
# TINYSPLINE_RUNTIME_LIBS
# Stores the names of the files that are copied (and stripped) from
# `TINYSPLINE_RUNTIME_LIBRARIES' to `TINYSPLINE_OUTPUT_DIRECTORY'.
# ~~~
# ##############################################################################
# Set C++ standard globally.
if(EMSCRIPTEN)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# TINYSPLINE_C_DEFINITIONS TINYSPLINE_CXX_DEFINITIONS
# TINYSPLINE_BINDING_CXX_DEFINITIONS TINYSPLINE_C_LINK_LIBRARIES
# TINYSPLINE_CXX_LINK_LIBRARIES TINYSPLINE_LIBRARY_C_FLAGS
# TINYSPLINE_LIBRARY_CXX_FLAGS TINYSPLINE_BINDING_CXX_FLAGS
if(BUILD_SHARED_LIBS AND ${TINYSPLINE_PLATFORM_IS_WINDOWS})
# Add TINYSPLINE_SHARED to the list of compiler definitions in order to export
# it to the install targets (CMake, pkg-config etc.). This ensures that that
# clients set this definition when linking against the C/C++ library (which is
# necessary to properly import the symbols of the shared library; see
# __declspec(dllimport)).
list(APPEND TINYSPLINE_C_DEFINITIONS "TINYSPLINE_SHARED")
list(APPEND TINYSPLINE_CXX_DEFINITIONS "TINYSPLINE_SHARED")
endif()
if(TINYSPLINE_FLOAT_PRECISION)
list(APPEND TINYSPLINE_C_DEFINITIONS "TINYSPLINE_FLOAT_PRECISION")
list(APPEND TINYSPLINE_CXX_DEFINITIONS "TINYSPLINE_FLOAT_PRECISION")
list(APPEND TINYSPLINE_BINDING_CXX_DEFINITIONS "TINYSPLINE_FLOAT_PRECISION")
endif()
list(APPEND TINYSPLINE_BINDING_CXX_DEFINITIONS "SWIG")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
# TINYSPLINE_C_LINK_LIBRARIES TINYSPLINE_CXX_LINK_LIBRARIES
set(TINYSPLINE_C_LINK_LIBRARIES "${TINYSPLINE_C_LINK_LIBRARIES} m")
set(TINYSPLINE_CXX_LINK_LIBRARIES "${TINYSPLINE_CXX_LINK_LIBRARIES} m")
# TINYSPLINE_LIBRARY_C_FLAGS
list(
APPEND
TINYSPLINE_LIBRARY_C_FLAGS
"-std=c89"
"-pedantic"
"-Wall"
"-Wextra"
"-Wstrict-prototypes"
"-Wfloat-equal"
)
if(TINYSPLINE_WARNINGS_AS_ERRORS)
list(APPEND TINYSPLINE_LIBRARY_C_FLAGS "-Werror")
endif()
list(JOIN TINYSPLINE_LIBRARY_C_FLAGS " " TINYSPLINE_LIBRARY_C_FLAGS)
# TINYSPLINE_LIBRARY_CXX_FLAGS
list(APPEND TINYSPLINE_LIBRARY_CXX_FLAGS "-Wall" "-Wextra" "-Wfloat-equal")
if(TINYSPLINE_WARNINGS_AS_ERRORS)
list(APPEND TINYSPLINE_LIBRARY_CXX_FLAGS "-Werror")
endif()
list(JOIN TINYSPLINE_LIBRARY_CXX_FLAGS " " TINYSPLINE_LIBRARY_CXX_FLAGS)
# TINYSPLINE_BINDING_CXX_FLAGS
set(TINYSPLINE_BINDING_CXX_FLAGS "${TINYSPLINE_BINDING_CXX_FLAGS} -w")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# TINYSPLINE_C_LINK_LIBRARIES TINYSPLINE_CXX_LINK_LIBRARIES
set(TINYSPLINE_C_LINK_LIBRARIES "${TINYSPLINE_C_LINK_LIBRARIES} m")
set(TINYSPLINE_CXX_LINK_LIBRARIES "${TINYSPLINE_CXX_LINK_LIBRARIES} m")
# TINYSPLINE_LIBRARY_C_FLAGS
if(EMSCRIPTEN)
# error: 'long long' is an extension when C99 mode is not enabled
# [-Werror,-Wlong-long] (from Parson)
list(APPEND TINYSPLINE_LIBRARY_C_FLAGS "-std=c99")
else()
list(APPEND TINYSPLINE_LIBRARY_C_FLAGS "-std=c89")
endif()
list(
APPEND
TINYSPLINE_LIBRARY_C_FLAGS
"-pedantic"
"-Wall"
"-Wextra"
"-Wstrict-prototypes"
"-Wfloat-equal"
)
if(TINYSPLINE_WARNINGS_AS_ERRORS)
list(APPEND TINYSPLINE_LIBRARY_C_FLAGS "-Werror")
endif()
list(JOIN TINYSPLINE_LIBRARY_C_FLAGS " " TINYSPLINE_LIBRARY_C_FLAGS)
# TINYSPLINE_LIBRARY_CXX_FLAGS
list(APPEND TINYSPLINE_LIBRARY_CXX_FLAGS "-Wall" "-Wextra" "-Wfloat-equal")
if(TINYSPLINE_WARNINGS_AS_ERRORS)
list(APPEND TINYSPLINE_LIBRARY_CXX_FLAGS "-Werror")
endif()
list(JOIN TINYSPLINE_LIBRARY_CXX_FLAGS " " TINYSPLINE_LIBRARY_CXX_FLAGS)
# TINYSPLINE_BINDING_CXX_FLAGS TINYSPLINE_BINDING_LINKER_FLAGS
set(TINYSPLINE_BINDING_CXX_FLAGS "${TINYSPLINE_BINDING_CXX_FLAGS} -w")
if(${TINYSPLINE_PLATFORM_NAME} STREQUAL "macosx")
set(TINYSPLINE_BINDING_LINKER_FLAGS
"${TINYSPLINE_BINDING_LINKER_FLAGS} -undefined dynamic_lookup -Wl,-no_fixup_chains"
)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# TINYSPLINE_LIBRARY_C_FLAGS
list(APPEND TINYSPLINE_LIBRARY_C_FLAGS "/W4")
if(TINYSPLINE_WARNINGS_AS_ERRORS)
list(APPEND TINYSPLINE_LIBRARY_C_FLAGS "/WX")
endif()
list(JOIN TINYSPLINE_LIBRARY_C_FLAGS " " TINYSPLINE_LIBRARY_C_FLAGS)
# TINYSPLINE_LIBRARY_CXX_FLAGS
list(APPEND TINYSPLINE_LIBRARY_CXX_FLAGS "/W4")
if(TINYSPLINE_WARNINGS_AS_ERRORS)
list(APPEND TINYSPLINE_LIBRARY_CXX_FLAGS "/WX")
endif()
list(JOIN TINYSPLINE_LIBRARY_CXX_FLAGS " " TINYSPLINE_LIBRARY_CXX_FLAGS)
# TINYSPLINE_BINDING_CXX_FLAGS
set(TINYSPLINE_BINDING_CXX_FLAGS "${TINYSPLINE_BINDING_CXX_FLAGS} /w /wd4996")
endif()
string(STRIP "${TINYSPLINE_C_LINK_LIBRARIES}" TINYSPLINE_C_LINK_LIBRARIES)
string(STRIP "${TINYSPLINE_CXX_LINK_LIBRARIES}" TINYSPLINE_CXX_LINK_LIBRARIES)
string(STRIP "${TINYSPLINE_LIBRARY_C_FLAGS}" TINYSPLINE_LIBRARY_C_FLAGS)
string(STRIP "${TINYSPLINE_LIBRARY_CXX_FLAGS}" TINYSPLINE_LIBRARY_CXX_FLAGS)
string(STRIP "${TINYSPLINE_BINDING_CXX_FLAGS}" TINYSPLINE_BINDING_CXX_FLAGS)
string(STRIP "${TINYSPLINE_BINDING_LINKER_FLAGS}"
TINYSPLINE_BINDING_LINKER_FLAGS
)
# TINYSPLINE_PKGCONFIG_C_FLAGS
foreach(def ${TINYSPLINE_C_DEFINITIONS})
set(TINYSPLINE_PKGCONFIG_C_FLAGS "${TINYSPLINE_PKGCONFIG_C_FLAGS} -D${def}")
endforeach()
string(STRIP "${TINYSPLINE_PKGCONFIG_C_FLAGS}" TINYSPLINE_PKGCONFIG_C_FLAGS)
# TINYSPLINE_PKGCONFIG_CXX_FLAGS
foreach(def ${TINYSPLINE_CXX_DEFINITIONS})
set(TINYSPLINE_PKGCONFIG_CXX_FLAGS
"${TINYSPLINE_PKGCONFIG_CXX_FLAGS} -D${def}"
)
endforeach()
string(STRIP "${TINYSPLINE_PKGCONFIG_CXX_FLAGS}" TINYSPLINE_PKGCONFIG_CXX_FLAGS)
# TINYSPLINE_RUNTIME_LIBS
set(TINYSPLINE_RUNTIME_LIBS "")
if(TINYSPLINE_RUNTIME_LIBRARIES STREQUAL "")
if(${TINYSPLINE_PLATFORM_NAME} STREQUAL "windows")
# Store relevant files in CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS. This allows to
# reuse CMake's InstallRequiredSystemLibraries module.
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS "")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
get_filename_component(basedir ${CMAKE_CXX_COMPILER} DIRECTORY)
if(NOT EXISTS "${basedir}/libstdc++-6.dll")
set(basedir "${CMAKE_INSTALL_PREFIX}/bin")
if(NOT EXISTS "${basedir}/libstdc++-6.dll")
set(basedir "${CMAKE_INSTALL_PREFIX}/lib")
if(NOT EXISTS "${basedir}/libstdc++-6.dll")
message(FATAL_ERROR "Cannot find libstdc++-6.dll")
endif()
endif()
endif()
list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
"${basedir}/libstdc++-6.dll"
)
# Detecting the used exception model is not quite as easy as one would
# suspect. Thus, we simply add all existing DLL files that may be used for
# exception handling.
list(APPEND TINYSPLINE_EXCEPTION_RUNTIME_LIBRARIES
"${basedir}/libgcc_s_seh-1.dll" "${basedir}/libgcc_s_dw2-1.dll"
"${basedir}/libgcc_s_sjlj-1.dll"
)
foreach(file ${TINYSPLINE_EXCEPTION_RUNTIME_LIBRARIES})
if(EXISTS ${file})
list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${file})
endif()
endforeach()
# Add libwinpthread if it exists, indicating that libstdc++ is linked
# against POSIX threads.
if(EXISTS "${basedir}/libwinpthread-1.dll")
list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
"${basedir}/libwinpthread-1.dll"
)
endif()
endif()
# Override cached variable.
set(TINYSPLINE_RUNTIME_LIBRARIES
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
CACHE FILEPATH "Autodetected." FORCE
)
endif()
endif()
foreach(file ${TINYSPLINE_RUNTIME_LIBRARIES})
if(NOT EXISTS ${file})
message(FATAL_ERROR "'${file}' does not exist")
endif()
file(COPY ${file} DESTINATION ${TINYSPLINE_OUTPUT_DIRECTORY})
get_filename_component(name ${file} NAME)
list(APPEND TINYSPLINE_RUNTIME_LIBS ${name})
if(CMAKE_STRIP AND NOT TINYSPLINE_MACOSX_TO_MACOSX)
execute_process(
COMMAND ${CMAKE_COMMAND} -E echo "Stripping ${name}"
COMMAND "${CMAKE_STRIP}" --strip-unneeded ${name}
WORKING_DIRECTORY "${TINYSPLINE_OUTPUT_DIRECTORY}"
)
endif()
endforeach()
# ##############################################################################
# Create the C/C++ libraries.
#
# TINYSPLINE_C_INCLUDE_DIR Include directory (absolute path) of the C library.
#
# TINYSPLINE_CXX_INCLUDE_DIR Include directory (absolute path) of the C++
# library.
#
# TINYSPLINE_C_SOURCE_FILES List of source files (absolute paths) that are
# required to build the C library. Does not contain header files.
#
# TINYSPLINE_CXX_SOURCE_FILES List of source files (absolute paths) that are
# required to build the C++ library. Does not contain header files, but all
# source files listed in TINYSPLINE_C_SOURCE_FILES.
# ##############################################################################
# TINYSPLINE_C_INCLUDE_DIR TINYSPLINE_CXX_INCLUDE_DIR
set(TINYSPLINE_C_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(TINYSPLINE_CXX_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# TINYSPLINE_C_SOURCE_FILES
list(APPEND TINYSPLINE_C_SOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/tinyspline.c"
"${CMAKE_CURRENT_SOURCE_DIR}/parson.c"
)
# TINYSPLINE_CXX_SOURCE_FILES
list(APPEND TINYSPLINE_CXX_SOURCE_FILES ${TINYSPLINE_C_SOURCE_FILES}
"${CMAKE_CURRENT_SOURCE_DIR}/tinysplinecxx.cxx"
)
include(CMakePackageConfigHelpers)
list(APPEND TINYSPLINE_INSTALL_PKGCONFIG_PATH
"${TINYSPLINE_INSTALL_LIBRARY_DIR}" "${TINYSPLINE_INSTALL_PKGCONFIG_DIR}"
)
list(JOIN TINYSPLINE_INSTALL_PKGCONFIG_PATH "/"
TINYSPLINE_INSTALL_PKGCONFIG_PATH
)
# C library
list(
APPEND TINYSPLINE_C_INSTALL_CMAKE_CONFIG_DIR
"${TINYSPLINE_INSTALL_LIBRARY_DIR}" "${TINYSPLINE_INSTALL_CMAKE_CONFIG_DIR}"
"${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}"
)
list(JOIN TINYSPLINE_C_INSTALL_CMAKE_CONFIG_DIR "/"
TINYSPLINE_C_INSTALL_CMAKE_CONFIG_DIR
)
add_library(tinyspline ${TINYSPLINE_C_SOURCE_FILES})
target_compile_definitions(tinyspline PUBLIC ${TINYSPLINE_C_DEFINITIONS})
set_target_properties(
tinyspline
PROPERTIES OUTPUT_NAME "${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}"
DEFINE_SYMBOL TINYSPLINE_SHARED
C_VISIBILITY_PRESET hidden
COMPILE_FLAGS "${TINYSPLINE_LIBRARY_C_FLAGS}"
PUBLIC_HEADER "tinyspline.h"
)
target_link_libraries(tinyspline PRIVATE ${TINYSPLINE_C_LINK_LIBRARIES})
target_include_directories(
tinyspline PUBLIC $<BUILD_INTERFACE:${TINYSPLINE_C_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${TINYSPLINE_INSTALL_INCLUDE_DIR}>
)
install(
TARGETS tinyspline
EXPORT tinyspline
RUNTIME DESTINATION ${TINYSPLINE_INSTALL_BINARY_DIR}
LIBRARY DESTINATION ${TINYSPLINE_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${TINYSPLINE_INSTALL_LIBRARY_DIR}
PUBLIC_HEADER DESTINATION ${TINYSPLINE_INSTALL_INCLUDE_DIR}
)
install(
EXPORT tinyspline
DESTINATION "${TINYSPLINE_C_INSTALL_CMAKE_CONFIG_DIR}"
NAMESPACE "tinyspline::"
FILE "${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}-targets.cmake"
)
configure_package_config_file(
"pkg/tinyspline-config.cmake.in"
"${TINYSPLINE_BINARY_DIR}/${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}-config.cmake"
INSTALL_DESTINATION "${TINYSPLINE_C_INSTALL_CMAKE_CONFIG_DIR}"
PATH_VARS TINYSPLINE_INSTALL_INCLUDE_DIR TINYSPLINE_INSTALL_LIBRARY_DIR
TINYSPLINE_INSTALL_BINARY_DIR
)
write_basic_package_version_file(
"${TINYSPLINE_BINARY_DIR}/${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}-config-version.cmake"
VERSION ${TINYSPLINE_VERSION}
COMPATIBILITY ExactVersion
)
install(
FILES
"${TINYSPLINE_BINARY_DIR}/${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}-config.cmake"
"${TINYSPLINE_BINARY_DIR}/${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}-config-version.cmake"
DESTINATION "${TINYSPLINE_C_INSTALL_CMAKE_CONFIG_DIR}"
)
list(APPEND TINYSPLINE_PKGCONFIG_C_LINK_LIBRARIES
"${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}"
)
if(NOT BUILD_SHARED_LIBS)
list(APPEND TINYSPLINE_PKGCONFIG_C_LINK_LIBRARIES
"${TINYSPLINE_C_LINK_LIBRARIES}"
)
endif()
list(JOIN TINYSPLINE_PKGCONFIG_C_LINK_LIBRARIES " -l"
TINYSPLINE_PKGCONFIG_C_LINK_LIBRARIES
)
set(TINYSPLINE_PKGCONFIG_C_LINK_LIBRARIES
"-l${TINYSPLINE_PKGCONFIG_C_LINK_LIBRARIES}"
)
configure_file(
"pkg/tinyspline.pc.in"
"${TINYSPLINE_BINARY_DIR}/${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}.pc" @ONLY
)
install(FILES "${TINYSPLINE_BINARY_DIR}/${TINYSPLINE_C_LIBRARY_OUTPUT_NAME}.pc"
DESTINATION "${TINYSPLINE_INSTALL_PKGCONFIG_PATH}"