forked from Unidata/netcdf-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1793 lines (1527 loc) · 56.1 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
## This is a CMake file, part of Unidata's netCDF package.
# Copyright 2012-2014, see the COPYRIGHT file for more information.
#
##################################
# Set Project Properties
##################################
#Minimum required CMake Version
cmake_minimum_required(VERSION 2.8.11)
#Project Name
project(netCDF C)
set(PACKAGE "netCDF" CACHE STRING "")
#####
# Version Info:
#
# Release Version
# Library Version
# SO Version
#
# SO Version is computed from library version. See:
# http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
#####
SET(NC_VERSION_MAJOR 4)
SET(NC_VERSION_MINOR 4)
SET(NC_VERSION_PATCH 1)
SET(NC_VERSION_NOTE "-development")
SET(netCDF_VERSION ${NC_VERSION_MAJOR}.${NC_VERSION_MINOR}.${NC_VERSION_PATCH}${NC_VERSION_NOTE})
SET(VERSION ${netCDF_VERSION})
SET(NC_VERSION ${netCDF_VERSION})
SET(netCDF_LIB_VERSION 11.2.0)
SET(netCDF_SO_VERSION 11)
SET(PACKAGE_VERSION ${VERSION})
# Get system configuration, Use it to determine osname, os release, cpu. These
# will be used when committing to CDash.
find_program(UNAME NAMES uname)
IF(UNAME)
macro(getuname name flag)
exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}")
endmacro(getuname)
getuname(osname -s)
getuname(osrel -r)
getuname(cpu -m)
set(TMP_BUILDNAME "${osname}-${osrel}-${cpu}")
ENDIF()
###
# Allow for some customization of the buildname.
# This will make it easier to identify different builds,
# based on values passed from command line/shell scripts.
#
# For ctest scripts, we can use CTEST_BUILD_NAME.
###
SET(BUILDNAME_PREFIX "" CACHE STRING "")
SET(BUILDNAME_SUFFIX "" CACHE STRING "")
IF(BUILDNAME_PREFIX)
SET(TMP_BUILDNAME "${BUILDNAME_PREFIX}-${TMP_BUILDNAME}")
ENDIF()
IF(BUILDNAME_SUFFIX)
SET(TMP_BUILDNAME "${TMP_BUILDNAME}-${BUILDNAME_SUFFIX}")
ENDIF()
IF(NOT BUILDNAME)
SET(BUILDNAME "${TMP_BUILDNAME}" CACHE STRING "Build name variable for CDash")
ENDIF()
###
# End BUILDNAME customization.
###
# For CMAKE_INSTALL_LIBDIR
INCLUDE(GNUInstallDirs)
IF(MSVC)
SET(GLOBAL PROPERTY USE_FOLDERS ON)
ENDIF()
#Add custom CMake Module
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
CACHE INTERNAL "Location of our custom CMake modules.")
# auto-configure style checks, other CMake modules.
INCLUDE(${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckCSourceCompiles.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckCSourceRuns.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/GetPrerequisites.cmake)
INCLUDE(CheckCCompilerFlag)
FIND_PACKAGE(PkgConfig QUIET)
# A macro to check if a C linker supports a particular flag.
MACRO(CHECK_C_LINKER_FLAG M_FLAG M_RESULT)
SET(T_REQ_FLAG "${CMAKE_REQUIRED_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS "${M_FLAG}")
CHECK_C_SOURCE_COMPILES("int main() {return 0;}" ${M_RESULT})
SET(CMAKE_REQUIRED_FLAGS "${T_REQ_FLAG}")
ENDMACRO()
# Enable 'dist and distcheck'.
# File adapted from http://ensc.de/cmake/FindMakeDist.cmake
FIND_PACKAGE(MakeDist)
# End 'enable dist and distcheck'
# Set the build type.
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None, Debug, Release."
FORCE)
ENDIF()
# Set build type uppercase
STRING(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
# Determine the configure date.
IF(DEFINED ENV{SOURCE_DATE_EPOCH})
EXECUTE_PROCESS(
COMMAND "date" "-u" "-d" "@$ENV{SOURCE_DATE_EPOCH}"
OUTPUT_VARIABLE CONFIG_DATE
)
ELSE()
EXECUTE_PROCESS(
COMMAND date
OUTPUT_VARIABLE CONFIG_DATE
)
ENDIF()
IF(CONFIG_DATE)
string(STRIP ${CONFIG_DATE} CONFIG_DATE)
ENDIF()
##
# Allow for extra dependencies.
##
SET(EXTRA_DEPS "")
################################
# End Project Properties
################################
################################
# Set CTest Properties
################################
ENABLE_TESTING()
INCLUDE(CTest)
# Copy the CTest customization file into binary directory, as required.
FILE(COPY ${CMAKE_SOURCE_DIR}/CTestCustom.cmake DESTINATION ${CMAKE_BINARY_DIR})
# Set Memory test program for non-MSVC based builds.
# Assume valgrind for now.
IF(NOT MSVC)
SET(CTEST_MEMORYCHECK_COMMAND valgrind CACHE STRING "")
ENDIF()
# Set variable to define the build type.
INCLUDE(GenerateExportHeader)
################################
# End CTest Properties
################################
################################
# Compiler and Linker Configuration
################################
##
# Default building shared libraries.
# BUILD_SHARED_LIBS is provided by/used by
# CMake directly.
##
OPTION(BUILD_SHARED_LIBS "Configure netCDF as a shared library." ON)
IF(BUILD_SHARED_LIBS)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()
OPTION(NC_FIND_SHARED_LIBS "Find dynamically-built versions of dependent libraries" ${BUILD_SHARED_LIBS})
##
# We've had a request to allow for non-versioned shared libraries.
# This seems reasonable enough to accomodate. See
# https://github.com/Unidata/netcdf-c/issues/228 for more info.
##
OPTION(ENABLE_SHARED_LIBRARY_VERSION "Encode the library SO version in the file name of the generated library file." ON)
# Set some default linux gcc & apple compiler options for
# debug builds.
IF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
OPTION(ENABLE_COVERAGE_TESTS "Enable compiler flags needed to perform coverage tests." OFF)
OPTION(ENABLE_CONVERSION_WARNINGS "Enable warnings for implicit conversion from 64 to 32-bit datatypes." ON)
OPTION(ENABLE_LARGE_FILE_TESTS "Enable large file tests." OFF)
# Debugging flags
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
# Check to see if -Wl,--no-undefined is supported.
CHECK_C_LINKER_FLAG("-Wl,--no-undefined" LIBTOOL_HAS_NO_UNDEFINED)
IF(LIBTOOL_HAS_NO_UNDEFINED)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--no-undefined")
ENDIF()
SET(CMAKE_REQUIRED_FLAGS "${TMP_CMAKE_REQUIRED_FLAGS}")
# Coverage tests need to have optimization turned off.
IF(ENABLE_COVERAGE_TESTS)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
MESSAGE(STATUS "Coverage Tests: On.")
ENDIF()
# Warnings for 64-to-32 bit conversions.
IF(ENABLE_CONVERSION_WARNINGS)
CHECK_C_COMPILER_FLAG(-Wconversion CC_HAS_WCONVERSION)
CHECK_C_COMPILER_FLAG(-Wshorten-64-to-32 CC_HAS_SHORTEN_64_32)
IF(CC_HAS_SHORTEN_64_32)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshorten-64-to-32")
ENDIF()
IF(CC_HAS_WCONVERSION)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wconversion")
ENDIF()
ENDIF(ENABLE_CONVERSION_WARNINGS)
ENDIF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
# End default linux gcc & apple compiler options.
ADD_DEFINITIONS()
# Suppress CRT Warnings.
# Only necessary for Windows
IF(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ENDIF()
#####
# System inspection checks
#####
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/oc2)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libsrc)
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_SOURCE_DIR}/libsrc)
################################
# End Compiler Configuration
################################
##
# Configuration for post-install RPath
# Adapted from http://www.cmake.org/Wiki/CMake_RPATH_handling
##
IF(NOT MSVC)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif(APPLE)
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing,
# but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
ENDIF("${isSystemDir}" STREQUAL "-1")
ENDIF()
##
# End configuration for post-install RPath
##
################################
# Option checks
################################
# HDF5 cache variables.
SET(DEFAULT_CHUNK_SIZE 4194304 CACHE STRING "Default Chunk Cache Size.")
SET(DEFAULT_CHUNKS_IN_CACHE 10 CACHE STRING "Default number of chunks in cache.")
SET(CHUNK_CACHE_SIZE 4194304 CACHE STRING "Default Chunk Cache Size.")
SET(CHUNK_CACHE_NELEMS 1009 CACHE STRING "Default maximum number of elements in cache.")
SET(CHUNK_CACHE_PREEMPTION 0.75 CACHE STRING "Default file chunk cache preemption policy for HDf5 files(a number between 0 and 1, inclusive.")
SET(MAX_DEFAULT_CACHE_SIZE 67108864 CACHE STRING "Default maximum cache size.")
SET(NETCDF_LIB_NAME "" CACHE STRING "Default name of the netcdf library.")
SET(TEMP_LARGE "." CACHE STRING "Where to put large temp files if large file tests are run.")
IF(NOT NETCDF_LIB_NAME STREQUAL "")
SET(MOD_NETCDF_NAME ON)
ENDIF()
# Set the appropriate compiler/architecture for universal OSX binaries.
IF(${CMAKE_SYSTEM_NAME} EQUAL "Darwin")
SET(CMAKE_OSX_ARCHITECTURES i386;x86_64)
ENDIF(${CMAKE_SYSTEM_NAME} EQUAL "Darwin")
# Option to use Static Runtimes in MSVC
IF(MSVC)
OPTION(NC_USE_STATIC_CRT "Use static CRT Libraries ('\\MT')." OFF)
IF(NC_USE_STATIC_CRT)
SET(USE_STATIC_CRT ON)
specify_static_crt_flag()
ENDIF()
ENDIF()
# Option to build netCDF Version 2
OPTION (ENABLE_V2_API "Build netCDF Version 2." ON)
SET(BUILD_V2 ${ENABLE_V2_API})
IF(NOT ENABLE_V2_API)
SET(NO_NETCDF_2 ON)
ENDIF()
# Option to build utilities
OPTION(BUILD_UTILITIES "Build ncgen, ncgen3, ncdump." ON)
# Option to use MMAP
OPTION(ENABLE_MMAP "Use MMAP." OFF)
IF(ENABLE_MMAP)
CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP)
IF(NOT HAVE_MREMAP)
MESSAGE(WARNING "mremap not found: disabling MMAP support.")
SET(ENABLE_MMAP OFF)
ELSE()
SET(HAVE_MMAP ON)
SET(BUILD_MMAP ON)
SET(USE_MMAP ON)
ENDIF()
ENDIF()
# Option to use examples.
OPTION(ENABLE_EXAMPLES "Build Examples" ON)
# Option to use Diskless
OPTION(ENABLE_DISKLESS "Build Diskless." ON)
IF(ENABLE_DISKLESS)
SET(BUILD_DISKLESS ON)
SET(USE_DISKLESS ON)
ENDIF()
# Option Logging, only valid for netcdf4.
OPTION(ENABLE_LOGGING "Enable Logging." OFF)
IF(ENABLE_LOGGING)
ADD_DEFINITIONS(-DLOGGING)
SET(LOGGING ON)
ENDIF()
# Option to automatically build netcdf-fortran.
IF(NOT MSVC)
OPTION(ENABLE_REMOTE_FORTRAN_BOOTSTRAP "Download and build netcdf-fortran automatically (EXPERIMENTAL)." OFF)
IF(ENABLE_REMOTE_FORTRAN_BOOTSTRAP)
SET(BUILD_FORTRAN ON)
ENDIF()
IF(BUILD_FORTRAN)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/postinstall.sh.in"
"${CMAKE_BINARY_DIR}/postinstall.sh"
@ONLY)
ADD_CUSTOM_TARGET(build-netcdf-fortran
COMMAND sh -c "${CMAKE_BINARY_DIR}/postinstall.sh -t cmake -a build"
DEPENDS netcdf
)
ADD_CUSTOM_TARGET(install-netcdf-fortran
COMMAND sh -c "${CMAKE_BINARY_DIR}/postinstall.sh -t cmake -a install"
DEPENDS build-netcdf-fortran
)
ENDIF(BUILD_FORTRAN)
ENDIF()
# Option to use HDF4
OPTION(ENABLE_HDF4 "Build netCDF-4 with HDF5 read capability(HDF4, HDF5 and Zlib required)." OFF)
IF(ENABLE_HDF4)
SET(USE_HDF4 ON)
# Check for include files, libraries.
FIND_PATH(MFHDF_H_INCLUDE_DIR mfhdf.h)
IF(NOT MFHDF_H_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "HDF4 Support specified, cannot find file mfhdf.h")
ELSE()
SET(HAVE_MFHDF_H ON CACHE BOOL "")
INCLUDE_DIRECTORIES(${MFHDF_H_INCLUDE_DIR})
ENDIF()
FIND_LIBRARY(HDF4_DF_LIB NAMES df libdf hdf)
IF(NOT HDF4_DF_LIB)
MESSAGE(FATAL_ERROR "Can't find or link to the hdf4 df library.")
ENDIF()
FIND_LIBRARY(HDF4_MFHDF_LIB NAMES mfhdf libmfhdf)
IF(NOT HDF4_MFHDF_LIB)
MESSAGE(FATAL_ERROR "Can't find or link to the hdf4 mfhdf library.")
ENDIF()
SET(HDF4_LIBRARIES ${HDF4_DF_LIB} ${HDF4_MFHDF_LIB})
# End include files, libraries.
MESSAGE(STATUS "HDF4 libraries: ${HDF4_DF_LIB}, ${HDF4_MFHDF_LIB}")
MESSAGE(STATUS "Seeking HDF4 jpeg dependency.")
# Look for the jpeglib.h header file.
FIND_PATH(JPEGLIB_H_INCLUDE_DIR jpeglib.h)
IF(NOT JPEGLIB_H_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "HDF4 Support enabled but cannot find jpeglib.h")
ELSE()
SET(HAVE_JPEGLIB_H ON CACHE BOOL "")
INCLUDE_DIRECTORIES(${JPEGLIB_H_INCLUDE_DIR})
ENDIF()
FIND_LIBRARY(JPEG_LIB NAMES jpeg libjpeg)
IF(NOT JPEG_LIB)
MESSAGE(FATAL_ERROR "HDF4 Support enabled but cannot find libjpeg")
ENDIF()
SET(HDF4_LIBRARIES ${JPEG_LIB} ${HDF4_LIBRARIES})
MESSAGE(STATUS "Found JPEG libraries: ${JPEG_LIB}")
# Option to enable HDF4 file tests.
OPTION(ENABLE_HDF4_FILE_TESTS "Run HDF4 file tests. This fetches sample HDF4 files from the Unidata ftp site to test with (requires curl)." ON)
IF(ENABLE_HDF4_FILE_TESTS)
FIND_PROGRAM(PROG_CURL NAMES curl)
IF(PROG_CURL)
SET(USE_HDF4_FILE_TESTS ON)
ELSE()
MESSAGE(STATUS "Unable to locate 'curl'. Disabling hdf4 file tests.")
SET(USE_HDF4_FILE_TESTS OFF)
ENDIF()
ENDIF()
ENDIF()
# Option to Build DLL
IF(WIN32)
OPTION(ENABLE_DLL "Build a Windows DLL." ${BUILD_SHARED_LIBS})
IF(ENABLE_DLL)
SET(BUILD_DLL ON CACHE BOOL "")
ADD_DEFINITIONS(-DDLL_NETCDF)
ADD_DEFINITIONS(-DDLL_EXPORT)
ENDIF()
ENDIF()
# Did the user specify a default minimum blocksize for posixio?
SET(NCIO_MINBLOCKSIZE 256 CACHE STRING "Minimum I/O Blocksize for netCDF classic and 64-bit offset format files.")
# Build netCDF4
OPTION(ENABLE_NETCDF_4 "Enable netCDF-4" ON)
IF(ENABLE_NETCDF_4)
SET(USE_NETCDF4 ON CACHE BOOL "")
SET(ENABLE_NETCDF_4 ON CACHE BOOL "")
SET(ENABLE_NETCDF4 ON CACHE BOOL "")
ENDIF()
# Option for building RPC
OPTION(ENABLE_RPC "Enable RPC Client and Server." OFF)
IF(ENABLE_RPC)
SET(BUILD_RPC ON CACHE BOOL "")
ENDIF()
##
# Option to Enable HDF5
#
# The HDF5 cmake variables differ between platform (linux/osx and Windows),
# as well as between HDF5 versions. As a result, this section is a bit convoluted.
#
# Note that the behavior seems much more stable across HDF5 versions under linux,
# so we do not have to do as much version-based tweaking.
#
# At the end of it, we should have the following defined:
#
# * HDF5_C_LIBRARY
# * HDF5_HL_LIBRARY
# * HDF5_LIBRARIES
# * HDF5_INCLUDE_DIR
# *
##
OPTION(USE_HDF5 "Use HDF5." ${ENABLE_NETCDF_4})
IF(USE_HDF5 OR ENABLE_NETCDF_4)
SET(USE_HDF5 ON)
SET(USE_NETCDF4 ON)
##
# Accommodate developers who have hdf5 libraries and
# headers on their system, but do not have a the hdf
# .cmake files. If this is the case, they should
# specify HDF5_HL_LIB, HDF5_LIB, HDF5_INCLUDE_DIR manually.
##
IF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)
SET(HDF5_LIBRARIES ${HDF5_C_LIBRARY} ${HDF5_HL_LIBRARY})
SET(HDF5_C_LIBRARIES ${HDF5_C_LIBRARY})
SET(HDF5_HL_LIBRARIES ${HDF5_HL_LIBRARY})
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR})
MESSAGE(STATUS "Using HDF5 C Library: ${HDF5_C_LIBRARY}")
MESSAGE(STATUS "Using HDF5 HL LIbrary: ${HDF5_HL_LIBRARY}")
ELSE(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR) # We are seeking out HDF5 with Find Package.
###
# For now we assume that if we are building netcdf
# as a shared library, we will use hdf5 as a shared
# library. If we are building netcdf statically,
# we will use a static library. This can be toggled
# by explicitely modifying NC_FIND_SHARED_LIBS.
##
IF(NC_FIND_SHARED_LIBS)
SET(NC_HDF5_LINK_TYPE "shared")
SET(NC_HDF5_LINK_TYPE_UPPER "SHARED")
ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB)
ELSE(NC_FIND_SHARED_LIBS)
SET(NC_HDF5_LINK_TYPE "static")
SET(NC_HDF5_LINK_TYPE_UPPER "STATIC")
ADD_DEFINITIONS(-DH5_BUILT_AS_STATIC_LIB)
ENDIF(NC_FIND_SHARED_LIBS)
#####
# First, find the C and HL libraries.
#
# This has been updated to reflect what is in the hdf5
# examples, even though the previous version of what we
# had worked.
#####
IF(MSVC)
SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL NO_MODULES REQUIRED ${NC_HDF5_LINK_TYPE})
ELSE(MSVC)
FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
ENDIF(MSVC)
##
# Next, check the HDF5 version. This will inform which
# HDF5 variables we need to munge.
##
##
# Assert HDF5 version meets minimum required version.
##
SET(HDF5_VERSION_REQUIRED 1.8.10)
IF(HDF5_VERSION_STRING AND NOT HDF5_VERSION)
SET(HDF5_VERSION ${HDF5_VERSION_STRING})
ENDIF()
IF("${HDF5_VERSION}" STREQUAL "")
MESSAGE(STATUS "Unable to determine hdf5 version. NetCDF requires at least version ${HDF5_VERSION_REQUIRED}")
ELSE()
IF(${HDF5_VERSION} VERSION_LESS ${HDF5_VERSION_REQUIRED})
MESSAGE(FATAL_ERROR
"netCDF requires at least HDF5 ${HDF5_VERSION_REQUIRED}. Found ${HDF5_VERSION}.")
ELSE()
MESSAGE(STATUS "Found HDF5 libraries version ${HDF5_VERSION}")
ENDIF()
ENDIF()
##
# Include the HDF5 include directory.
##
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR})
###
# This is the block where we figure out what the appropriate
# variables are, and we ensure that we end up with
# HDF5_C_LIBRARY, HDF5_HL_LIBRARY and HDF5_LIBRARIES.
###
IF(MSVC)
##
# HDF5 1.8.15 defined HDF5_LIBRARIES.
##
IF(${HDF5_VERSION} VERSION_LESS "1.8.16")
SET(HDF5_C_LIBRARY hdf5)
ENDIF(${HDF5_VERSION} VERSION_LESS "1.8.16")
IF(${HDF5_VERSION} VERSION_GREATER "1.8.15")
IF(NOT HDF5_LIBRARIES AND HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY AND HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY)
SET(HDF5_C_LIBRARY ${HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY})
SET(HDF5_HL_LIBRARY ${HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY})
SET(HDF5_LIBRARIES ${HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY} ${HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY})
ENDIF()
ENDIF(${HDF5_VERSION} VERSION_GREATER "1.8.15")
ELSE(MSVC)
# Depending on the install, either HDF5_hdf_library or
# HDF5_C_LIBRARIES may be defined. We must check for either.
IF(HDF5_C_LIBRARIES AND NOT HDF5_hdf5_LIBRARY)
SET(HDF5_hdf5_LIBRARY ${HDF5_C_LIBRARIES})
ENDIF()
ENDIF(MSVC)
ENDIF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)
###
# The following options are not used in Windows.
###
IF(NOT MSVC)
# Find out if HDF5 was built with parallel support.
# Do that by checking for the targets H5Pget_fapl_mpiposx and
# H5Pget_fapl_mpio in ${HDF5_LIB}.
CHECK_LIBRARY_EXISTS(hdf5 H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX)
CHECK_LIBRARY_EXISTS(hdf5 H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO)
IF(HDF5_IS_PARALLEL_MPIPOSIX OR HDF5_IS_PARALLEL_MPIO)
SET(HDF5_PARALLEL ON)
ELSE()
SET(HDF5_PARALLEL OFF)
ENDIF()
IF(HDF5_IS_PARALLEL_MPIO)
SET(USE_PARALLEL_MPIO ON)
ENDIF()
IF(HDF5_IS_PARALLEL_MPIPOSIX)
SET(USE_PARALLEL_POSIX ON)
ENDIF()
OPTION(ENABLE_DYNAMIC_LOADING "Enable Dynamic Loading" ON)
IF(ENABLE_DYNAMIC_LOADING)
SET(USE_LIBDL ON CACHE BOOL "")
ENDIF()
SET(HDF5_C_LIBRARY hdf5)
ENDIF(NOT MSVC)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5free_memory "" HDF5_HAS_H5FREE)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pset_libver_bounds "" HDF5_HAS_LIBVER_BOUNDS)
IF(HDF5_PARALLEL)
SET(HDF5_CC h5pcc)
ELSE()
SET(HDF5_CC h5cc)
ENDIF()
# execute_process(COMMAND sh -c "${HDF5_CC} -showconfig | grep -i 'HDF5 version' | cut -d: -f2 | tr -d ' '"
# OUTPUT_VARIABLE HDF5_VERSION
# ERROR_QUIET)
# It cannot be assumed that libhdf5.settings exists. If it doesn't,
# the call to h5cc will have failed. At this point we will have to
# trust the user that they have configured their system properly.
# Starting with hdf5 1.8.11, dynamic loading is an option.
# In case hdf5 has a dependency on libdl, the user must specify
# -DENABLE_DYNAMIC_LOADING=ON when configuring netcdf.
IF(USE_LIBDL)
FIND_LIBRARY(LIBDL NAMES dl dld)
FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h)
IF(NOT LIBDL)
MESSAGE(ERROR "Cannot find libdl, but dynamic loading was specified.")
ENDIF()
IF(NOT LIBDL_INCLUDE_DIR)
MESSAGE(ERROR "Cannot find dlfcn.h, but dynamic loading was specified.")
ENDIF()
MESSAGE(STATUS "Found libdl: ${LIBDL}")
SET(HAVE_LIBDL ON)
INCLUDE_DIRECTORIES(${LIBDL_INCLUDE_DIR})
ENDIF()
#Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip.
CHECK_LIBRARY_EXISTS(hdf5 H5Z_SZIP "" USE_SZIP)
IF(USE_SZIP)
FIND_LIBRARY(SZIP NAMES szip sz)
IF(SZIP)
SET(SZIP_LIBRARY ${SZIP})
ELSE()
MESSAGE(FATAL_ERROR "HDF5 Requires SZIP, but cannot find libszip or libsz.")
ENDIF()
#FIND_PACKAGE(SZIP NO_MODULE REQUIRED)
#INCLUDE_DIRECTORIES(${SZIP_INCLUDE_DIR})
ENDIF()
SET(H5_USE_16_API 1)
OPTION(NC_ENABLE_HDF_16_API "Enable HDF5 1.6.x Compatibility(Required)" ON)
IF(NOT NC_ENABLE_HDF_16_API)
SET(H5_USE_16_API 0)
ENDIF()
# Check for ZLib, but only if using HDF5.
FIND_PACKAGE(ZLIB)
IF(NOT ZLIB_LIBRARY)
MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find ZLib.")
ENDIF()
SET(USE_ZLIB ON)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
ENDIF(USE_HDF5 OR ENABLE_NETCDF_4)
# Option to Build DAP Client
OPTION(ENABLE_DAP "Enable DAP Client." ON)
IF(ENABLE_DAP)
SET(USE_DAP ON)
FIND_PACKAGE(CURL)
IF(NOT CURL_LIBRARY)
MESSAGE(FATAL_ERROR "DAP Support specified, CURL libraries are not found.")
ENDIF()
ADD_DEFINITIONS(-DCURL_STATICLIB=1)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
# Check to see if CURLOPT_USERNAME is defined.
# It is present starting version 7.19.1.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_USERNAME;}" HAVE_CURLOPT_USERNAME)
# Check to see if CURLOPT_PASSWORD is defined.
# It is present starting version 7.19.1.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_PASSWORD;}" HAVE_CURLOPT_PASSWORD)
# Check to see if CURLOPT_KEYPASSWD is defined.
# It is present starting version 7.16.4.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_KEYPASSWD;}" HAVE_CURLOPT_KEYPASSWD)
# Check to see if CURLINFO_RESPONSE_CODE is defined.
# It showed up in curl 7.10.7.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE)
# Check to see if CURLOPT_CHUNK_BGN_FUNCTION is defined.
# It showed up in curl 7.21.0.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_CHUNK_BGN_FUNCTION;}" HAVE_CURLOPT_CHUNK_BGN_FUNCTION)
ENDIF()
# Check to see if libtool supports
# Check for the math library so it can be explicitly linked.
IF(NOT WIN32)
FIND_LIBRARY(HAVE_LIBM NAMES math m libm)
MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}")
IF(NOT HAVE_LIBM)
MESSAGE(FATAL_ERROR "Unable to find the math library.")
ENDIF()
ENDIF()
# Option to Enable DAP long tests, remote tests.
OPTION(ENABLE_DAP_LONG_TESTS "Enable DAP long tests." OFF)
OPTION(ENABLE_DAP_REMOTE_TESTS "Enable DAP remote tests." ON)
IF(ENABLE_DAP_REMOTE_TESTS)
OPTION(ENABLE_DAP_AUTH_TESTS "Enable DAP remote authorization tests." OFF)
ENDIF()
# If netCDF4 and DAP, Option for DAP groups.
IF(ENABLE_NETCDF_4 AND USE_DAP)
OPTION(ENABLE_DAP_GROUPS "Whether netcdf4 group names should be enabled." ON)
ELSE()
SET(ENABLE_DAP_GROUPS OFF CACHE BOOL "Whether netcdf4 group names should be enabled.")
ENDIF()
# Enable some developer-only tests
OPTION(ENABLE_EXTRA_TESTS "Enable Extra tests. Some may not work because of known issues. Developers only." OFF)
IF(ENABLE_EXTRA_TESTS)
SET(EXTRA_TESTS ON)
ENDIF()
# Option to use bundled XGetopt in place of getopt(). This is mostly useful
# for MSVC builds. If not building utilities, getopt() isn't required at all.
IF(MSVC)
OPTION(ENABLE_XGETOPT "Enable bundled XGetOpt instead of external getopt()." ON)
IF(ENABLE_XGETOPT)
SET(USE_X_GETOPT ON CACHE BOOL "")
ENDIF()
ENDIF()
SET(MATH "")
IF(NOT WIN32)
# STDIO instead of posixio.
OPTION(ENABLE_STDIO "If true, use stdio instead of posixio (ex. on the Cray)" OFF)
IF(ENABLE_STDIO)
SET(USE_STDIO ON CACHE BOOL "")
ENDIF()
# FFIO insteaad of PosixIO
OPTION(ENABLE_FFIO "If true, use ffio instead of posixio" OFF)
IF(ENABLE_FFIO)
SET(USE_FFIO ON CACHE BOOL "")
ENDIF()
ENDIF()
##
# Enable Tests
##
OPTION(ENABLE_TESTS "Enable basic tests, run with 'make test'." ON)
IF(ENABLE_TESTS)
SET(BUILD_TESTSETS ON CACHE BOOL "")
# Options for CTest-based tests, dashboards.
SET(NC_CTEST_PROJECT_NAME "netcdf-c" CACHE STRING "Project Name for CTest-based testing purposes.")
SET(NC_CTEST_DROP_SITE "my.cdash.org" CACHE STRING "Dashboard location for CTest-based testing purposes.")
SET(NC_CTEST_DROP_LOC_PREFIX "" CACHE STRING "Prefix for Dashboard location on remote server when using CTest-based testing.")
FIND_PROGRAM(HOSTNAME_CMD NAMES hostname)
IF(NOT MSVC)
SET(HOSTNAME_ARG "-s")
ENDIF()
IF(HOSTNAME_CMD)
EXEC_PROGRAM(${HOSTNAME_CMD} ARGS "${HOSTNAME_ARG}" OUTPUT_VARIABLE HOSTNAME)
SET(NC_CTEST_SITE "${HOSTNAME}" CACHE STRING "Hostname of test machine.")
ENDIF()
IF(NC_CTEST_SITE)
SET(SITE "${NC_CTEST_SITE}" CACHE STRING "")
ENDIF()
# Create a CTestConfig file from the template.
CONFIGURE_FILE("${netCDF_SOURCE_DIR}/CTestConfig.cmake.in"
"${netCDF_SOURCE_DIR}/CTestConfig.cmake"
@ONLY
)
###
# This option dictates whether or not to turn on
# tests which are known to fail. This is not the
# same thing as an 'expected failure'. Rather, these
# are tests that will need to be fixed eventually.
#
# By placing them here, we can occasionaly turn this
# flag on and see if any known failures have been
# fixed in the course of code improvement/other bug
# fixes.
#
# To use this, simply add as a fencepost around tests
# which are known to fail.
###
OPTION(ENABLE_FAILING_TESTS "Run tests which are known to fail, check to see if any have been fixed." OFF)
###
# End known-failures.
###
MARK_AS_ADVANCED(ENABLE_FAILING_TESTS)
ENDIF()
###
# Allow the user to specify libraries
# to link against, similar to automakes 'LIBS' variable.
###
SET(NC_EXTRA_DEPS "" CACHE STRING "Additional libraries to link against.")
IF(NC_EXTRA_DEPS)
STRING(REPLACE " " ";" DEPS_LIST ${NC_EXTRA_DEPS})
FOREACH(_DEP ${DEPS_LIST})
STRING(REGEX REPLACE "^-l" "" _LIB ${_DEP})
FIND_LIBRARY("${_LIB}_DEP" NAMES "${_LIB}" "lib${_LIB}")
MESSAGE(${${_LIB}_DEP})
IF(NOT "${_LIB}_DEP")
MESSAGE(FATAL_ERROR "Error finding ${_LIB}.")
ELSE()
MESSAGE(STATUS "Found ${_LIB}: ${${_LIB}_DEP}")
ENDIF()
SET(EXTRA_DEPS ${EXTRA_DEPS} "${${_LIB}_DEP}")
ENDFOREACH()
MESSAGE("Extra deps: ${EXTRA_DEPS}")
LIST(REMOVE_DUPLICATES EXTRA_DEPS)
ENDIF()
###
# End user-specified dependent libraries.
###
# Enable Large file tests
IF(ENABLE_LARGE_FILE_TESTS)
SET(LARGE_FILE_TESTS ON)
ENDIF()
# Location for large file tests.
SET(TEMP_LARGE "." CACHE STRING "Location to store large file tests.")
OPTION(ENABLE_FSYNC "Enable experimental fsync code." OFF)
IF(ENABLE_FSYNC)
SET(USE_FSYNC ON)
ENDIF()
# Temporary
OPTION (ENABLE_JNA "Enable jna bug fix code." OFF)
IF(ENABLE_JNA)
SET(JNA ON)
ENDIF()
# Linux specific large file support flags.
# Modelled after check in CMakeLists.txt for hdf5.
OPTION(ENABLE_LARGE_FILE_SUPPORT "Enable large file support." ON)
IF(ENABLE_LARGE_FILE_SUPPORT)
IF(MSVC)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LARGEADDRESSAWARE")
ELSE()
SET(_FILE_OFFSET_BITS 64)
SET(_LARGEFILE64_SOURCE TRUE)
SET(_LARGEFILE_SOURCE TRUE)
ENDIF()
ENDIF()
OPTION(ENABLE_EXAMPLE_TESTS "Run extra example tests. Requires GNU Sed. Ignored if netCDF-4 is not Enabled" OFF)
IF(NOT ENABLE_NETCDF_4 AND ENABLE_EXAMPLE_TESTS)
SET(ENABLE_EXAMPLE_TESTS OFF)
ENDIF()
# Enable Parallel (different than pnetcdf).
SET(STATUS_PARALLEL "OFF")
OPTION(ENABLE_PARALLEL4 "Build netCDF-4 with parallel IO" "${HDF5_PARALLEL}")
IF(ENABLE_PARALLEL4 AND ENABLE_NETCDF_4)
IF(NOT HDF5_PARALLEL)
SET(USE_PARALLEL OFF CACHE BOOL "")
MESSAGE(STATUS "Cannot find HDF5 library built with parallel support. Disabling parallel build.")
ELSE()
SET(HDF5_PARALLEL ON CACHE BOOL "")
SET(USE_PARALLEL ON CACHE BOOL "")
SET(USE_PARALLEL4 ON CACHE BOOL "")
SET(STATUS_PARALLEL "ON")
ENDIF()
ENDIF()
# Options to enable parallel IO, tests.
SET(STATUS_PNETCDF "OFF")
OPTION(ENABLE_PNETCDF "Build with parallel I/O for classic and 64-bit offset files using parallel-netcdf." OFF)
IF(ENABLE_PNETCDF)
# Check for ncmpi_create in libpnetcdf, define USE_PNETCDF
# Does the user want to turn on PNETCDF read ability?
SET(USE_PNETCDF ON CACHE BOOL "")
FIND_LIBRARY(PNETCDF NAMES pnetcdf)
FIND_PATH(PNETCDF_INCLUDE_DIR pnetcdf.h)
IF(NOT PNETCDF)
MESSAGE(STATUS "Cannot find PNetCDF library. Disabling PNetCDF support.")
SET(USE_PNETCDF OFF CACHE BOOL "")
ELSE(NOT PNETCDF)
SET(USE_PARALLEL ON CACHE BOOL "")
# Check PNetCDF version. Must be >= 1.6.0
set(pnetcdf_h "${PNETCDF_INCLUDE_DIR}/pnetcdf.h" )
message(STATUS "PNetCDF include file ${pnetcdf_h} will be searched for version")
file(STRINGS "${pnetcdf_h}" pnetcdf_major_string REGEX "^#define PNETCDF_VERSION_MAJOR")
string(REGEX REPLACE "[^0-9]" "" pnetcdf_major "${pnetcdf_major_string}")
file(STRINGS "${pnetcdf_h}" pnetcdf_minor_string REGEX "^#define PNETCDF_VERSION_MINOR")
string(REGEX REPLACE "[^0-9]" "" pnetcdf_minor "${pnetcdf_minor_string}")
file(STRINGS "${pnetcdf_h}" pnetcdf_sub_string REGEX "^#define PNETCDF_VERSION_SUB")
string(REGEX REPLACE "[^0-9]" "" pnetcdf_sub "${pnetcdf_sub_string}")
set(pnetcdf_version "${pnetcdf_major}.${pnetcdf_minor}.${pnetcdf_sub}")
message(STATUS "Found PNetCDF version ${pnetcdf_version}")
if(${pnetcdf_version} VERSION_GREATER "1.6.0")
SET(STATUS_PNETCDF "ON")
INCLUDE_DIRECTORIES(${PNETCDF_INCLUDE_DIR})
SET(HAVE_LIBPNETCDF ON)
# pnetcdf => parallel
SET(STATUS_PARALLEL ON)
SET(USE_PARALLEL ON)
MESSAGE(STATUS "Using PNetCDF Library: ${PNETCDF}")
ELSE()
MESSAGE(WARNING "ENABLE_PNETCDF requires version 1.6.1 or later; found version ${pnetcdf_version}. PNetCDF is disabled")
ENDIF()
ENDIF(NOT PNETCDF)
ENDIF()
# Enable Parallel Tests.
OPTION(ENABLE_PARALLEL_TESTS "Enable Parallel IO Tests. Ignored if netCDF4 is not enabled, or if there is no parallel I/O Support." ${USE_PARALLEL})
IF(ENABLE_PARALLEL_TESTS AND USE_PARALLEL)
SET(TEST_PARALLEL ON CACHE BOOL "")
ENDIF()
# Determine whether or not to generate documentation.
OPTION(ENABLE_DOXYGEN "Enable generation of doxygen-based documentation." OFF)
IF(ENABLE_DOXYGEN)
FIND_PACKAGE(Doxygen REQUIRED)
# Offer the option to build internal documentation.
OPTION(ENABLE_INTERNAL_DOCS "Build internal documentation. This is of interest to developers only." OFF)
IF(ENABLE_INTERNAL_DOCS)
SET(BUILD_INTERNAL_DOCS YES CACHE STRING "")
ELSE()
SET(BUILD_INTERNAL_DOCS NO CACHE STRING "")