-
Notifications
You must be signed in to change notification settings - Fork 0
/
modboost.cmake
2313 lines (1971 loc) · 91.4 KB
/
modboost.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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
#######################################################################
## CMake Macros for an embeddable project
##
## Author: Denis Arnaud
## Date: July 2011
#######################################################################
###################################################################
## Project Configuration ##
###################################################################
##
# Set the project names
macro (set_project_names _project_name_param)
# Set the pretty name
string (TOUPPER ${_project_name_param} _pretty_name_tmp)
if (${ARGC} GREATER 1)
set (_pretty_name_tmp ${ARGV1})
endif (${ARGC} GREATER 1)
set (PACKAGE_PRETTY_NAME "${_pretty_name_tmp}" CACHE INTERNAL "Description")
# Set the lowercase project name
string (TOLOWER "${_project_name_param}" _package_tmp)
set (PACKAGE "${_package_tmp}" CACHE INTERNAL "Description")
# Set the uppercase project name
string (TOUPPER "${_project_name_param}" _package_name_tmp)
set (PACKAGE_NAME "${_package_name_tmp}" CACHE INTERNAL "Description")
# Set the project name
project (${PACKAGE})
endmacro (set_project_names)
##
# Set the project brief
macro (set_project_brief _project_brief)
set (PACKAGE_BRIEF ${_project_brief})
endmacro (set_project_brief)
##
# Set the project versions
macro (set_project_versions _major _minor _patch)
set (_full_version ${_major}.${_minor}.${_patch})
#
set (${PROJECT_NAME}_VERSION_MAJOR ${_major})
set (${PROJECT_NAME}_VERSION_MINOR ${_minor})
set (${PROJECT_NAME}_VERSION_PATCH ${_patch})
set (${PROJECT_NAME}_VERSION ${_full_version})
#
set (PACKAGE_VERSION ${_full_version})
# Note that the soname can be different from the version. The soname
# should change only when the ABI compatibility is no longer guaranteed.
set (GENERIC_LIB_VERSION ${_full_version})
set (GENERIC_LIB_SOVERSION ${_major}.${_minor})
endmacro (set_project_versions)
##
# Set a few options:
# * BUILD_SHARED_LIBS - Whether or not to build shared libraries
# * CMAKE_BUILD_TYPE - Debug or release
# * CMAKE_INSTALL_PREFIX - Where to install the deliverable parts
# * CMAKE_INSTALL_RPATH - The list of paths to be used by the linker
# * CMAKE_INSTALL_RPATH_USE_LINK_PATH
# - Whether or not to set the run-path/rpath within
# the (executable and library) binaries
# * ENABLE_TEST - Whether or not to build and check the unit tests
# * INSTALL_DOC - Whether or not to build and install the documentation
# * INSTALL_LIB_DIR - Installation directory for the libraries
# * INSTALL_BIN_DIR - Installation directory for the binaries
# * INSTALL_INCLUDE_DIR - Installation directory for the header files
# * INSTALL_DATA_DIR - Installation directory for the data files
# * INSTALL_SAMPLE_DIR - Installation directory for the (CSV) sample files
#
macro (set_project_options _build_doc _enable_tests)
# Shared libraries
option (BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
# Set default cmake build type to Debug (None Debug Release RelWithDebInfo
# MinSizeRel)
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Debug")
endif()
# Set default install prefix to project root directory
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
set (CMAKE_INSTALL_PREFIX "/usr")
endif()
# Unit tests (thanks to CMake/CTest)
option (ENABLE_TEST "Set to OFF to skip build/check unit tests"
${_enable_tests})
# Documentation
option (INSTALL_DOC "Set to OFF to skip build/install Documentation"
${_build_doc})
# Set the library installation directory (either 32 or 64 bits)
set (LIBDIR "lib${LIB_SUFFIX}" CACHE PATH
"Library directory name, either lib or lib64")
# Offer the user the choice of overriding the installation directories
set (INSTALL_LIB_DIR ${LIBDIR} CACHE PATH
"Installation directory for libraries")
set (INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
set (INSTALL_INCLUDE_DIR include CACHE PATH
"Installation directory for header files")
set (INSTALL_DATA_DIR share CACHE PATH
"Installation directory for data files")
set (INSTALL_SAMPLE_DIR share/${PROJECT_NAME}/samples CACHE PATH
"Installation directory for (CSV) sample files")
# Make relative paths absolute (needed later on)
foreach (_path_type LIB BIN INCLUDE DATA SAMPLE)
set (var INSTALL_${_path_type}_DIR)
if (NOT IS_ABSOLUTE "${${var}}")
set (${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif ()
endforeach (_path_type)
# When the install directory is the canonical one (i.e., /usr), the
# run-path/rpath must be set in all the (executable and library)
# binaries, so that the dynamic loader can find the dependencies
# without the user having to set the LD_LIBRARY_PATH environment
# variable.
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
set (CMAKE_INSTALL_RPATH "")
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF)
else()
set (CMAKE_INSTALL_RPATH ${INSTALL_LIB_DIR})
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
endif()
# Define CORE_SAMPLE_DIR if the project is CORE
if ("${PROJECT_NAME}" STREQUAL "core")
set (CORE_SAMPLE_DIR ${INSTALL_SAMPLE_DIR})
endif ("${PROJECT_NAME}" STREQUAL "core")
##
# Basic documentation (i.e., AUTHORS, NEWS, README, INSTALL)
set (DOC_INSTALL_FILE INSTALL)
if (NOT EXISTS ${DOC_INSTALL_FILE})
unset (DOC_INSTALL_FILE)
endif (NOT EXISTS ${DOC_INSTALL_FILE})
set (DOC_NEWS_FILE NEWS)
if (NOT EXISTS ${DOC_NEWS_FILE})
unset (DOC_NEWS_FILE)
endif (NOT EXISTS ${DOC_NEWS_FILE})
set (BASICDOC_FILES AUTHORS ${DOC_NEWS_FILE} README ${DOC_INSTALL_FILE})
set (BASICDOC_PATH "share/doc/${PACKAGE}-${PACKAGE_VERSION}")
endmacro (set_project_options)
#
macro (install_basic_documentation)
install (FILES ${BASICDOC_FILES} DESTINATION ${BASICDOC_PATH})
endmacro (install_basic_documentation)
#
macro (store_in_cache)
# Force some variables that could be defined in the command line to be
# written to cache
set (PACKAGE_VERSION "${PACKAGE_VERSION}" CACHE STRING
"Version of the project/package")
set (BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}" CACHE BOOL
"Set to OFF to build static libraries" FORCE)
set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH
"Where to install ${PROJECT_NAME}" FORCE)
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}" CACHE PATH
"Run-path for the library/executable binaries" FORCE)
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH "${CMAKE_INSTALL_RPATH_USE_LINK_PATH}"
CACHE BOOL
"Whether to set the run-path for the library/executable binaries" FORCE)
set (CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING
"C++ compilation flags" FORCE)
set (COMPILE_FLAGS "${COMPILE_FLAGS}" CACHE STRING
"Supplementary C++ compilation flags" FORCE)
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" CACHE PATH
"Path to custom CMake Modules" FORCE)
set (ENABLE_TEST "${ENABLE_TEST}" CACHE BOOL
"Set to OFF to skip build/check unit tests" FORCE)
set (INSTALL_DOC "${INSTALL_DOC}" CACHE BOOL
"Set to OFF to skip build/install Documentation" FORCE)
endmacro (store_in_cache)
#####################################
## Packaging ##
#####################################
#
macro (packaging_init _project_name)
set (CPACK_PACKAGE_NAME "${_project_name}")
set (CPACK_PACKAGE_DESCRIPTION "${PACKAGE_BRIEF}")
endmacro (packaging_init)
#
macro (packaging_set_summary _project_summary)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${_project_summary}")
endmacro (packaging_set_summary)
#
macro (packaging_set_contact _project_contact)
set (CPACK_PACKAGE_CONTACT "${_project_contact}")
endmacro (packaging_set_contact)
#
macro (packaging_set_vendor _project_vendor)
set (CPACK_PACKAGE_VENDOR "${_project_vendor}")
endmacro (packaging_set_vendor)
# Both parameters are semi-colon sepetated lists of the types of
# packages to generate, e.g., "TGZ;TBZ2"
macro (packaging_set_other_options _package_type_list _source_package_type_list)
#
set (CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR})
#set (CPACK_PACKAGE_VERSION_PATCH ${${PROJECT_NAME}_VERSION_PATCH})
set (CPACK_PACKAGE_VERSION_PATCH ${GIT_REVISION})
set (CPACK_PACKAGE_VERSION ${${PROJECT_NAME}_VERSION})
# Basic documentation
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/README)
message (FATAL_ERROR "A README file must be defined and located at the root directory")
endif (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/README)
set (CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
set (CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README)
# Licence
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
message (FATAL_ERROR "A licence file, namely COPYING, must be defined and located at the root directory")
endif (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
##
# Reset the generators for the binary packages
# Available types of package: DEB, RPM, STGZ, TZ, TGZ, TBZ2
set (CPACK_GENERATOR "${_package_type_list}")
#set (CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.6), libgcc1 (>= 1:4.1)")
##
# Source packages
# Available types of package: TZ, TGZ, TBZ2
set (CPACK_SOURCE_GENERATOR "${_source_package_type_list}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}"
CACHE INTERNAL "tarball basename")
set (AUTOTOOLS_IGNRD "/tmp/;/tmp2/;/autom4te\\\\.cache/;autogen\\\\.sh$")
set (PACK_IGNRD "${CMAKE_CURRENT_BINARY_DIR};${CPACK_PACKAGE_NAME}\\\\.spec;\\\\.gz$;\\\\.bz2$")
set (EDIT_IGNRD "\\\\.swp$;\\\\.#;/#;~$")
set (SCM_IGNRD
"/CVS/;/\\\\.svn/;/\\\\.bzr/;/\\\\.hg/;/\\\\.git/;\\\\.gitignore$")
set (CPACK_SOURCE_IGNORE_FILES
"${AUTOTOOLS_IGNRD};${SCM_IGNRD};${EDIT_IGNRD};${PACK_IGNRD}"
CACHE STRING "CPACK will ignore these files")
#set (CPACK_SOURCE_IGNORE_DIRECTORY ${CPACK_SOURCE_IGNORE_FILES} .git)
# Initialise the source package generator with the variables above
include (InstallRequiredSystemLibraries)
include (CPack)
# Add a 'dist' target, similar to what is given by GNU Autotools
add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
##
# Reset the generator types for the binary packages. Indeed, the variable
# has been reset by "include (CPack)".
set (CPACK_GENERATOR "${_package_type_list}")
endmacro (packaging_set_other_options)
###################################################################
## Dependencies ##
###################################################################
# ~~~~~~~~ Wrapper ~~~~~~~~
macro (get_external_libs)
# CMake scripts, to find some dependencies (e.g., Boost, MySQL, SOCI)
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/config/)
#
set (PROJ_DEP_LIBS_FOR_LIB "")
set (PROJ_DEP_LIBS_FOR_BIN "")
set (PROJ_DEP_LIBS_FOR_TST "")
foreach (_arg ${ARGV})
string (TOLOWER ${_arg} _arg_lower_full)
# Extract the name of the external dependency
string (REGEX MATCH "^[a-z]+" _arg_lower ${_arg_lower_full})
# Extract the required version of the external dependency
string (REGEX MATCH "[0-9._-]+$" _arg_version ${_arg_lower_full})
if (${_arg_lower} STREQUAL "git")
get_git (${_arg_version})
endif (${_arg_lower} STREQUAL "git")
if (${_arg_lower} STREQUAL "python")
get_python (${_arg_version})
endif (${_arg_lower} STREQUAL "python")
if (${_arg_lower} STREQUAL "zeromq")
get_zeromq (${_arg_version})
endif (${_arg_lower} STREQUAL "zeromq")
if (${_arg_lower} STREQUAL "boost")
get_boost (${_arg_version})
endif (${_arg_lower} STREQUAL "boost")
if (${_arg_lower} STREQUAL "xapian")
get_xapian (${_arg_version})
endif (${_arg_lower} STREQUAL "xapian")
if (${_arg_lower} STREQUAL "readline")
get_readline (${_arg_version})
endif (${_arg_lower} STREQUAL "readline")
if (${_arg_lower} STREQUAL "mysql")
get_mysql (${_arg_version})
endif (${_arg_lower} STREQUAL "mysql")
if (${_arg_lower} STREQUAL "soci")
get_soci (${_arg_version})
endif (${_arg_lower} STREQUAL "soci")
if (${_arg_lower} STREQUAL "core")
get_core (${_arg_version})
endif (${_arg_lower} STREQUAL "core")
if (${_arg_lower} STREQUAL "doxygen")
get_doxygen (${_arg_version})
endif (${_arg_lower} STREQUAL "doxygen")
endforeach (_arg)
endmacro (get_external_libs)
# ~~~~~~~~~~ Git ~~~~~~~~~~
macro (get_git)
message (STATUS "Requires Git without specifying any version")
find_package (Git)
if (Git_FOUND)
Git_WC_INFO (${CMAKE_CURRENT_SOURCE_DIR} PROJ)
set (GIT_REVISION ${PROJ_WC_REVISION_HASH})
message (STATUS "Current Git revision name: ${PROJ_WC_REVISION_NAME}")
endif (Git_FOUND)
endmacro (get_git)
# ~~~~~~~~~~ Python ~~~~~~~~~
macro (get_python)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires PythonLibs-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires PythonLibs without specifying any version")
endif (${ARGC} GREATER 0)
# The first check searches for the libraries and include paths.
# However, on some older versions (e.g., on RedHat/CentOS 5.x),
# only the static library is searched.
find_package (PythonLibs ${_required_version} REQUIRED)
# The second check is to get the dynamic library for sure.
find_package (PythonLibsWrapper ${_required_version} REQUIRED)
if (PYTHONLIBS_FOUND)
# Derive the version of Python (for whatever reason, FindPythonLibs
# does not seem to provide that version variable.
get_filename_component (PYTHONLIBS_LIB_FILENAME ${PYTHON_LIBRARIES} NAME)
string (REGEX REPLACE "^libpython([0-9]+.[0-9]+).*$" "\\1"
PYTHONLIBS_VERSION "${PYTHONLIBS_LIB_FILENAME}")
message (STATUS "Found PythonLibs ${PYTHONLIBS_VERSION}")
# Update the list of include directories for the project
include_directories (${PYTHON_INCLUDE_DIRS})
# Update the list of dependencies for the project
list (APPEND PROJ_DEP_LIBS_FOR_LIB ${PYTHON_LIBRARIES})
else (PYTHONLIBS_FOUND)
message (FATAL_ERROR "Python libraries are missing. Please install them (e.g., 'python-devel' for the Fedora/RedHat package)")
endif (PYTHONLIBS_FOUND)
endmacro (get_python)
# ~~~~~~~~~~ ZeroMQ ~~~~~~~~~
macro (get_zeromq)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires ZeroMQ-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires ZeroMQ without specifying any version")
endif (${ARGC} GREATER 0)
find_package (ZeroMQ ${_required_version} REQUIRED)
if (ZEROMQ_FOUND)
# Update the list of include directories for the project
include_directories (${ZeroMQ_INCLUDE_DIR})
# Update the list of dependencies for the project
list (APPEND PROJ_DEP_LIBS_FOR_LIB ${ZeroMQ_LIBRARIES})
endif (ZEROMQ_FOUND)
endmacro (get_zeromq)
# ~~~~~~~~~~ BOOST ~~~~~~~~~~
macro (get_boost)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires Boost-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires Boost without specifying any version")
endif (${ARGC} GREATER 0)
#
# Note: ${Boost_DATE_TIME_LIBRARY} and ${Boost_PROGRAM_OPTIONS_LIBRARY}
# are already set by ${SOCIMYSQL_LIBRARIES} and/or ${SOCI_LIBRARIES}.
#
set (Boost_USE_STATIC_LIBS OFF)
set (Boost_USE_MULTITHREADED ON)
set (Boost_USE_STATIC_RUNTIME OFF)
set (BOOST_REQUIRED_COMPONENTS
regex program_options date_time iostreams serialization filesystem
unit_test_framework python)
# The first check is for the required components.
find_package (Boost COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
# The second check is for the required version (FindBoostWrapper.cmake is
# provided by us). Indeed, the Fedora/RedHat FindBoost.cmake does not seem
# to provide version enforcement.
find_package (BoostWrapper ${_required_version} REQUIRED)
if (Boost_FOUND)
# Update the list of include directories for the project
include_directories (${Boost_INCLUDE_DIRS})
# Update the list of dependencies for the project
list (APPEND PROJ_DEP_LIBS_FOR_LIB
${Boost_REGEX_LIBRARY} ${Boost_IOSTREAMS_LIBRARY}
${Boost_SERIALIZATION_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
${Boost_DATE_TIME_LIBRARY} ${Boost_PYTHON_LIBRARY})
list (APPEND PROJ_DEP_LIBS_FOR_BIN
${Boost_REGEX_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
list (APPEND PROJ_DEP_LIBS_FOR_TST ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
# For display purposes
set (BOOST_REQUIRED_LIBS
${Boost_REGEX_LIBRARY} ${Boost_IOSTREAMS_LIBRARY}
${Boost_SERIALIZATION_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_PYTHON_LIBRARY})
endif (Boost_FOUND)
endmacro (get_boost)
# ~~~~~~~~~~ Xapian ~~~~~~~~~
macro (get_xapian)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires Xapian-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires Xapian without specifying any version")
endif (${ARGC} GREATER 0)
# The first check is to get Xapian installation details
find_package (Xapian)
# The second check is for the required version (FindXapianWrapper.cmake is
# provided by us). Indeed, the Fedora/RedHat xapian-config.cmake does not seem
# to provide version enforcement.
find_package (XapianWrapper ${_required_version} REQUIRED)
if (XAPIAN_FOUND)
# Update the list of include directories for the project
include_directories (${XAPIAN_INCLUDE_DIR})
# Update the list of dependencies for the project
list (APPEND PROJ_DEP_LIBS_FOR_LIB ${XAPIAN_LIBRARIES})
endif (XAPIAN_FOUND)
endmacro (get_xapian)
# ~~~~~~~~~~ Readline ~~~~~~~~~
macro (get_readline)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires Readline-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires Readline without specifying any version")
endif (${ARGC} GREATER 0)
set (READLINE_FOUND False)
find_package (Readline ${_required_version} REQUIRED)
if (READLINE_LIBRARY)
set (READLINE_FOUND True)
endif (READLINE_LIBRARY)
if (READLINE_FOUND)
# Update the list of include directories for the project
include_directories (${READLINE_INCLUDE_DIR})
# Update the list of dependencies for the project
list (APPEND PROJ_DEP_LIBS_FOR_LIB ${READLINE_LIBRARY})
endif (READLINE_FOUND)
endmacro (get_readline)
# ~~~~~~~~~~ MySQL ~~~~~~~~~
macro (get_mysql)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires MySQL-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires MySQL without specifying any version")
endif (${ARGC} GREATER 0)
find_package (MySQL ${_required_version} REQUIRED)
if (MYSQL_FOUND)
# Update the list of include directories for the project
include_directories (${MYSQL_INCLUDE_DIR})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${MYSQL_LIBRARIES})
endif (MYSQL_FOUND)
endmacro (get_mysql)
# ~~~~~~~~~~ SOCI ~~~~~~~~~~
macro (get_soci)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires SOCI-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires SOCI without specifying any version")
endif (${ARGC} GREATER 0)
find_package (SOCIMySQL ${_required_version} REQUIRED)
if (SOCIMYSQL_FOUND)
#
message (STATUS "Found SOCI with MySQL back-end support version:"
" ${SOCI_HUMAN_VERSION}")
# Update the list of include directories for the project
include_directories (${SOCI_INCLUDE_DIR})
include_directories (${SOCIMYSQL_INCLUDE_DIR})
# Update the list of dependencies for the project
list (APPEND PROJ_DEP_LIBS_FOR_LIB ${SOCI_LIBRARIES} ${SOCIMYSQL_LIBRARIES})
endif (SOCIMYSQL_FOUND)
endmacro (get_soci)
# ~~~~~~~~~~ Doxygen ~~~~~~~~~
macro (get_doxygen)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires Doxygen-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires Doxygen without specifying any version")
endif (${ARGC} GREATER 0)
# The first check is to get Doxygen installation details
find_package (Doxygen)
# The second check is for the required version (FindDoxygenWrapper.cmake is
# provided by us). Indeed, the Fedora/RedHat FindDoxygen.cmake does not seem
# to provide version enforcement.
find_package (DoxygenWrapper ${_required_version} REQUIRED)
endmacro (get_doxygen)
# ~~~~~~~~~~ Boost.Core ~~~~~~~~~
macro (get_core)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires Core-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires Core without specifying any version")
endif (${ARGC} GREATER 0)
find_package (Core ${_required_version} REQUIRED
HINTS ${WITH_CORE_PREFIX})
if (Core_FOUND)
#
message (STATUS "Found Core version: ${CORE_VERSION}")
# Update the list of include directories for the project
include_directories (${CORE_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${CORE_LIBRARIES})
else (Core_FOUND)
set (ERROR_MSG "The Core library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_CORE_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<Core install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (Core_FOUND)
endmacro (get_core)
# ~~~~~~~~~~ SEvMgr ~~~~~~~~~
macro (get_sevmgr)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires SEvMgr-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires SEvMgr without specifying any version")
endif (${ARGC} GREATER 0)
find_package (SEvMgr ${_required_version} REQUIRED
HINTS ${WITH_SEVMGR_PREFIX})
if (SEvMgr_FOUND)
#
message (STATUS "Found SEvMgr version: ${SEVMGR_VERSION}")
# Update the list of include directories for the project
include_directories (${SEVMGR_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${SEVMGR_LIBRARIES})
else (SEvMgr_FOUND)
set (ERROR_MSG "The SEvMgr library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_SEVMGR_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<SEvMgr install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (SEvMgr_FOUND)
endmacro (get_sevmgr)
# ~~~~~~~~~~ TraDemGen ~~~~~~~~~
macro (get_trademgen)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires TraDemGen-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires TraDemGen without specifying any version")
endif (${ARGC} GREATER 0)
find_package (TraDemGen ${_required_version} REQUIRED
HINTS ${WITH_TRADEMGEN_PREFIX})
if (TraDemGen_FOUND)
#
message (STATUS "Found TraDemGen version: ${TRADEMGEN_VERSION}")
# Update the list of include directories for the project
include_directories (${TRADEMGEN_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${TRADEMGEN_LIBRARIES})
else (TraDemGen_FOUND)
set (ERROR_MSG "The TraDemGen library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_TRADEMGEN_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<TraDemGen install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (TraDemGen_FOUND)
endmacro (get_trademgen)
# ~~~~~~~~~~ TravelCCM ~~~~~~~~~
macro (get_travelccm)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires TravelCCM-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires TravelCCM without specifying any version")
endif (${ARGC} GREATER 0)
find_package (TravelCCM ${_required_version} REQUIRED
HINTS ${WITH_TRAVELCCM_PREFIX})
if (TravelCCM_FOUND)
#
message (STATUS "Found TravelCCM version: ${TRAVELCCM_VERSION}")
# Update the list of include directories for the project
include_directories (${TRAVELCCM_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${TRAVELCCM_LIBRARIES})
else (TravelCCM_FOUND)
set (ERROR_MSG "The TravelCCM library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_TRAVELCCM_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<TravelCCM install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (TravelCCM_FOUND)
endmacro (get_travelccm)
# ~~~~~~~~~~ AirSched ~~~~~~~~~
macro (get_airsched)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires AirSched-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires AirSched without specifying any version")
endif (${ARGC} GREATER 0)
find_package (AirSched ${_required_version} REQUIRED
HINTS ${WITH_AIRSCHED_PREFIX})
if (AirSched_FOUND)
#
message (STATUS "Found AirSched version: ${AIRSCHED_VERSION}")
# Update the list of include directories for the project
include_directories (${AIRSCHED_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${AIRSCHED_LIBRARIES})
else (AirSched_FOUND)
set (ERROR_MSG "The AirSched library cannot be found. If it is installed")
set (ERROR_MSG "${ERROR_MSG} in a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_AIRSCHED_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<AirSched install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (AirSched_FOUND)
endmacro (get_airsched)
# ~~~~~~~~~~ AirRAC ~~~~~~~~~
macro (get_airrac)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires AirRAC-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires AirRAC without specifying any version")
endif (${ARGC} GREATER 0)
find_package (AirRAC ${_required_version} REQUIRED
HINTS ${WITH_AIRRAC_PREFIX})
if (AirRAC_FOUND)
#
message (STATUS "Found AirRAC version: ${AIRRAC_VERSION}")
# Update the list of include directories for the project
include_directories (${AIRRAC_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${AIRRAC_LIBRARIES})
else (AirRAC_FOUND)
set (ERROR_MSG "The AirRAC library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_AIRRAC_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<AirRAC install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (AirRAC_FOUND)
endmacro (get_airrac)
# ~~~~~~~~~~ RMOL ~~~~~~~~~
macro (get_rmol)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires RMOL-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires RMOL without specifying any version")
endif (${ARGC} GREATER 0)
find_package (RMOL ${_required_version} REQUIRED
HINTS ${WITH_RMOL_PREFIX})
if (RMOL_FOUND)
#
message (STATUS "Found RMOL version: ${RMOL_VERSION}")
# Update the list of include directories for the project
include_directories (${RMOL_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${RMOL_LIBRARIES})
else (RMOL_FOUND)
set (ERROR_MSG "The RMOL library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_RMOL_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<RMOL install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (RMOL_FOUND)
endmacro (get_rmol)
# ~~~~~~~~~~ AirInv ~~~~~~~~~
macro (get_airinv)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires AirInv-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires AirInv without specifying any version")
endif (${ARGC} GREATER 0)
find_package (AirInv ${_required_version} REQUIRED
HINTS ${WITH_AIRINV_PREFIX})
if (AirInv_FOUND)
#
message (STATUS "Found AirInv version: ${AIRINV_VERSION}")
# Update the list of include directories for the project
include_directories (${AIRINV_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${AIRINV_LIBRARIES})
else (AirInv_FOUND)
set (ERROR_MSG "The AirInv library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_AIRINV_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<AirInv install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (AirInv_FOUND)
endmacro (get_airinv)
# ~~~~~~~~~~ AvlCal ~~~~~~~~~
macro (get_avlcal)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires AvlCal-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires AvlCal without specifying any version")
endif (${ARGC} GREATER 0)
find_package (AvlCal ${_required_version} REQUIRED
HINTS ${WITH_AVLCAL_PREFIX})
if (AvlCal_FOUND)
#
message (STATUS "Found AvlCal version: ${AVLCAL_VERSION}")
# Update the list of include directories for the project
include_directories (${AVLCAL_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${AVLCAL_LIBRARIES})
else (AvlCal_FOUND)
set (ERROR_MSG "The AvlCal library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_AVLCAL_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<AvlCal install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (AvlCal_FOUND)
endmacro (get_avlcal)
# ~~~~~~~~~~ SimFQT ~~~~~~~~~
macro (get_simfqt)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires SimFQT-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires SimFQT without specifying any version")
endif (${ARGC} GREATER 0)
find_package (SimFQT ${_required_version} REQUIRED
HINTS ${WITH_SIMFQT_PREFIX})
if (SimFQT_FOUND)
#
message (STATUS "Found SimFQT version: ${SIMFQT_VERSION}")
# Update the list of include directories for the project
include_directories (${SIMFQT_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${SIMFQT_LIBRARIES})
else (SimFQT_FOUND)
set (ERROR_MSG "The SimFQT library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_SIMFQT_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<SimFQT install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (SimFQT_FOUND)
endmacro (get_simfqt)
# ~~~~~~~~~~ SimLFS ~~~~~~~~~
macro (get_simlfs)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires SimLFS-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires SimLFS without specifying any version")
endif (${ARGC} GREATER 0)
find_package (SimLFS ${_required_version} REQUIRED
HINTS ${WITH_SIMLFS_PREFIX})
if (SimLFS_FOUND)
#
message (STATUS "Found SimLFS version: ${SIMLFS_VERSION}")
# Update the list of include directories for the project
include_directories (${SIMLFS_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${SIMLFS_LIBRARIES})
else (SimLFS_FOUND)
set (ERROR_MSG "The SimLFS library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_SIMLFS_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<SimLFS install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (SimLFS_FOUND)
endmacro (get_simlfs)
# ~~~~~~~~~~ SimCRS ~~~~~~~~~
macro (get_simcrs)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires SimCRS-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires SimCRS without specifying any version")
endif (${ARGC} GREATER 0)
find_package (SimCRS ${_required_version} REQUIRED
HINTS ${WITH_SIMCRS_PREFIX})
if (SimCRS_FOUND)
#
message (STATUS "Found SimCRS version: ${SIMCRS_VERSION}")
# Update the list of include directories for the project
include_directories (${SIMCRS_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${SIMCRS_LIBRARIES})
else (SimCRS_FOUND)
set (ERROR_MSG "The SimCRS library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_SIMCRS_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<SimCRS install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (SimCRS_FOUND)
endmacro (get_simcrs)
# ~~~~~~~~~~ DSim ~~~~~~~~~
macro (get_dsim)
unset (_required_version)
if (${ARGC} GREATER 0)
set (_required_version ${ARGV0})
message (STATUS "Requires DSim-${_required_version}")
else (${ARGC} GREATER 0)
message (STATUS "Requires DSim without specifying any version")
endif (${ARGC} GREATER 0)
find_package (DSim ${_required_version} REQUIRED
HINTS ${WITH_DSIM_PREFIX})
if (DSim_FOUND)
#
message (STATUS "Found DSim version: ${DSIM_VERSION}")
# Update the list of include directories for the project
include_directories (${DSIM_INCLUDE_DIRS})
# Update the list of dependencies for the project
set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${DSIM_LIBRARIES})
else (DSim_FOUND)
set (ERROR_MSG "The DSim library cannot be found. If it is installed in")
set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_DSIM_PREFIX=")
set (ERROR_MSG "${ERROR_MSG}<DSim install path> variable.")
message (FATAL_ERROR "${ERROR_MSG}")
endif (DSim_FOUND)