diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2017-01-10 23:09:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2017-01-10 23:10:03 (GMT) |
commit | e1bcae8a6a804490aa941a654e99b1dd18251411 (patch) | |
tree | ef2ea266500b5bfea473b15495d850c5640ab1ed /config/cmake | |
parent | a4cd30d418838bee49ca112fdfbcc199889b4a21 (diff) | |
download | hdf5-e1bcae8a6a804490aa941a654e99b1dd18251411.zip hdf5-e1bcae8a6a804490aa941a654e99b1dd18251411.tar.gz hdf5-e1bcae8a6a804490aa941a654e99b1dd18251411.tar.bz2 |
Update cmake min version and cmake command convention
Diffstat (limited to 'config/cmake')
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 86 | ||||
-rw-r--r-- | config/cmake/FindHDFJAVA.cmake.in | 12 | ||||
-rw-r--r-- | config/cmake/HDF518_Examples.cmake.in | 2 | ||||
-rw-r--r-- | config/cmake/HDF5Macros.cmake | 24 | ||||
-rw-r--r-- | config/cmake/HDF5UseFortran.cmake | 259 | ||||
-rw-r--r-- | config/cmake/HDF5_Examples.cmake.in | 2 | ||||
-rw-r--r-- | config/cmake/HDF5_Process_Flex_Files.cmake | 4 | ||||
-rw-r--r-- | config/cmake/HDFCompilerFlags.cmake | 165 | ||||
-rw-r--r-- | config/cmake/UserMacros/Windows_MT.cmake | 17 | ||||
-rw-r--r-- | config/cmake/cacheinit.cmake | 2 | ||||
-rw-r--r-- | config/cmake/hdf5-config-version.cmake.in | 22 | ||||
-rw-r--r-- | config/cmake/jrunTest.cmake | 152 | ||||
-rwxr-xr-x | config/cmake/scripts/CTestScript.cmake | 2 | ||||
-rwxr-xr-x | config/cmake/scripts/HDF5config.cmake | 2 | ||||
-rw-r--r-- | config/cmake/userblockTest.cmake | 32 | ||||
-rw-r--r-- | config/cmake/vfdTest.cmake | 15 |
16 files changed, 396 insertions, 402 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index ec0aecf..1745e6c 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -6,7 +6,7 @@ include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) if (HDF5_ENABLE_USING_MEMCHECKER) set (H5_USING_MEMCHECKER 1) -endif (HDF5_ENABLE_USING_MEMCHECKER) +endif () #----------------------------------------------------------------------------- # Option for --enable-strict-format-checks @@ -14,7 +14,7 @@ endif (HDF5_ENABLE_USING_MEMCHECKER) option (HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF) if (HDF5_STRICT_FORMAT_CHECKS) set (H5_STRICT_FORMAT_CHECKS 1) -endif (HDF5_STRICT_FORMAT_CHECKS) +endif () MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) #----------------------------------------------------------------------------- @@ -23,7 +23,7 @@ MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) option (HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF) if (HDF5_METADATA_TRACE_FILE) set (H5_METADATA_TRACE_FILE 1) -endif (HDF5_METADATA_TRACE_FILE) +endif () MARK_AS_ADVANCED (HDF5_METADATA_TRACE_FILE) # ---------------------------------------------------------------------- @@ -35,7 +35,7 @@ MARK_AS_ADVANCED (HDF5_METADATA_TRACE_FILE) option (HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON) if (HDF5_WANT_DATA_ACCURACY) set (H5_WANT_DATA_ACCURACY 1) -endif (HDF5_WANT_DATA_ACCURACY) +endif () MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) # ---------------------------------------------------------------------- @@ -47,7 +47,7 @@ MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) option (HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON) if (HDF5_WANT_DCONV_EXCEPTION) set (H5_WANT_DCONV_EXCEPTION 1) -endif (HDF5_WANT_DCONV_EXCEPTION) +endif () MARK_AS_ADVANCED (HDF5_WANT_DCONV_EXCEPTION) # ---------------------------------------------------------------------- @@ -56,7 +56,7 @@ MARK_AS_ADVANCED (HDF5_WANT_DCONV_EXCEPTION) option (HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF) if (HDF5_ENABLE_CODESTACK) set (H5_HAVE_CODESTACK 1) -endif (HDF5_ENABLE_CODESTACK) +endif () MARK_AS_ADVANCED (HDF5_ENABLE_CODESTACK) #----------------------------------------------------------------------------- @@ -65,7 +65,7 @@ MARK_AS_ADVANCED (HDF5_ENABLE_CODESTACK) option (HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON) if (HDF5_ENABLE_HSIZET) set (${HDF_PREFIX}_HAVE_LARGE_HSIZET 1) -endif (HDF5_ENABLE_HSIZET) +endif () # so far we have no check for this set (H5_HAVE_TMPFILE 1) @@ -79,10 +79,10 @@ set (H5_DEFAULT_VFD H5FD_SEC2) if (NOT DEFINED "H5_DEFAULT_PLUGINDIR") if (WINDOWS) set (H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%\\\\hdf5\\\\lib\\\\plugin") - else (WINDOWS) + else () set (H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin") - endif (WINDOWS) -endif (NOT DEFINED "H5_DEFAULT_PLUGINDIR") + endif () +endif () if (WINDOWS) set (H5_HAVE_WINDOWS 1) @@ -91,7 +91,7 @@ if (WINDOWS) # that is, "drive-letter:\" (e.g. "C:") or "drive-letter:/" (e.g. "C:/"). # (This flag should be _unset_ for all machines, except for Windows) set (H5_HAVE_WINDOW_PATH 1) -endif (WINDOWS) +endif () # ---------------------------------------------------------------------- # END of WINDOWS Hard code Values @@ -112,8 +112,8 @@ if (NOT WINDOWS) elseif (CLOCK_GETTIME_IN_LIBPOSIX4) set (H5_HAVE_CLOCK_GETTIME 1) list (APPEND LINK_LIBS posix4) - endif (CLOCK_GETTIME_IN_LIBC) -endif (NOT WINDOWS) + endif () +endif () #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- @@ -131,26 +131,26 @@ if (NOT WINDOWS) OUTPUT_VARIABLE OUTPUT ) if (TEST_DIRECT_VFD_WORKS_COMPILE) - if (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) + if (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) HDF_FUNCTION_TEST (HAVE_DIRECT) set (CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") add_definitions ("-D_GNU_SOURCE") - else (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) + else () set (TEST_DIRECT_VFD_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Test TEST_DIRECT_VFD_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" ) - endif (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) - else (TEST_DIRECT_VFD_WORKS_COMPILE ) + endif () + else ( ) set (TEST_DIRECT_VFD_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Test TEST_DIRECT_VFD_WORKS Compile failed with the following output:\n ${OUTPUT}\n" ) - endif (TEST_DIRECT_VFD_WORKS_COMPILE) - endif (HDF5_ENABLE_DIRECT_VFD) -endif (NOT WINDOWS) + endif () + endif () +endif () #----------------------------------------------------------------------------- # Check if C has __float128 extension @@ -159,10 +159,10 @@ endif (NOT WINDOWS) CHECK_TYPE_SIZE("__float128" SIZEOF___FLOAT128) if(${HAVE_SIZEOF___FLOAT128}) SET(H5_HAVE_FLOAT128 1) -else (${HAVE_SIZEOF___FLOAT128}) +else () SET(H5_HAVE_FLOAT128 0) SET(SIZEOF___FLOAT128 0) -endif(${HAVE_SIZEOF___FLOAT128}) +endif() #----------------------------------------------------------------------------- # Macro to determine the various conversion capabilities @@ -177,41 +177,41 @@ MACRO (H5ConversionTests TEST msg) OUTPUT_VARIABLE OUTPUT ) if (${TEST}_COMPILE) - if (${TEST}_RUN MATCHES 0) + if (${TEST}_RUN MATCHES 0) set (${TEST} 1 CACHE INTERNAL ${msg}) message (STATUS "${msg}... yes") - else (${TEST}_RUN MATCHES 0) + else () set (${TEST} "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n" ) - endif (${TEST}_RUN MATCHES 0) - else (${TEST}_COMPILE ) + endif () + else () set (${TEST} "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n" ) - endif (${TEST}_COMPILE) + endif () - endif ("${TEST}" MATCHES "^${TEST}$") -ENDMACRO (H5ConversionTests) + endif () +ENDMACRO () #----------------------------------------------------------------------------- # Macro to make some of the conversion tests easier to write/read #----------------------------------------------------------------------------- -MACRO (H5MiscConversionTest VAR TEST msg) +MACRO (H5MiscConversionTest VAR TEST msg) if ("${TEST}" MATCHES "^${TEST}$") if (${VAR}) set (${TEST} 1 CACHE INTERNAL ${msg}) message (STATUS "${msg}... yes") - else (${VAR}) + else () set (${TEST} "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") - endif (${VAR}) - endif ("${TEST}" MATCHES "^${TEST}$") -ENDMACRO (H5MiscConversionTest) + endif () + endif () +ENDMACRO () #----------------------------------------------------------------------------- # Check various conversion capabilities @@ -219,9 +219,9 @@ ENDMACRO (H5MiscConversionTest) # ---------------------------------------------------------------------- # Set the flag to indicate that the machine is using a special algorithm to convert -# 'long double' to '(unsigned) long' values. (This flag should only be set for -# the IBM Power6 Linux. When the bit sequence of long double is -# 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long +# 'long double' to '(unsigned) long' values. (This flag should only be set for +# the IBM Power6 Linux. When the bit sequence of long double is +# 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long # is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. # The machine's conversion gets the correct value. We define the macro and disable # this kind of test until we figure out what algorithm they use. @@ -229,10 +229,10 @@ ENDMACRO (H5MiscConversionTest) H5ConversionTests (H5_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine is using a special algorithm -# to convert some values of '(unsigned) long' to 'long double' values. -# (This flag should be off for all machines, except for IBM Power6 Linux, -# when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., -# ..., 7fffff..., the compiler uses a unknown algorithm. We define a +# to convert some values of '(unsigned) long' to 'long double' values. +# (This flag should be off for all machines, except for IBM Power6 Linux, +# when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., +# ..., 7fffff..., the compiler uses a unknown algorithm. We define a # macro and skip the test for now until we know about the algorithm. # H5ConversionTests (H5_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm") @@ -261,7 +261,7 @@ H5ConversionTests (H5_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restricti # ----------------------------------------------------------------------- # wrapper script variables -# +# set (prefix ${CMAKE_INSTALL_PREFIX}) set (exec_prefix "\${prefix}") set (libdir "${exec_prefix}/lib") @@ -272,4 +272,4 @@ set (CXX ${CMAKE_CXX_COMPILER}) set (FC ${CMAKE_Fortran_COMPILER}) foreach (LINK_LIB ${LINK_LIBS}) set (LIBS "${LIBS} -l${LINK_LIB}") -endforeach (LINK_LIB ${LINK_LIBS}) +endforeach () diff --git a/config/cmake/FindHDFJAVA.cmake.in b/config/cmake/FindHDFJAVA.cmake.in index b822280..25057e6 100644 --- a/config/cmake/FindHDFJAVA.cmake.in +++ b/config/cmake/FindHDFJAVA.cmake.in @@ -4,18 +4,18 @@ # # Find the HDFJAVA includes and get all installed hdf-java library settings from -# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later +# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later # for this feature to work. The following vars are set if hdf-java is found. # # HDFJAVA_FOUND - True if found, otherwise all other vars are undefined # HDFJAVA_VERSION_STRING - full version (e.g. @HDFJAVA_PACKAGE_VERSION@) # HDFJAVA_VERSION_MAJOR - major part of version (e.g. @HDFJAVA_PACKAGE_VERSION_MAJOR@) # HDFJAVA_VERSION_MINOR - minor part (e.g. @HDFJAVA_PACKAGE_VERSION_MINOR@) -# +# # Target names that are valid (depending on enabled options) # will be the following # -# +# # To aid in finding HDFJAVA as part of a subproject set # HDFJAVA_ROOT_DIR_HINT to the location where @HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies @@ -60,9 +60,9 @@ if (HDFJAVA_ROOT_DIR) set (HDFJAVA_FOUND "YES") INCLUDE (${HDFJAVA_ROOT_DIR}/@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake) set (HDFJAVA_LIBRARIES "${HDFJAVA_LIBRARY}") - set (HDFJAVA_INCLUDE_DIRS + set (HDFJAVA_INCLUDE_DIRS ${HDFJAVA_LIBRARY}/jarhdf-@HDFJAVA_PACKAGE_VERSION@.jar ${HDFJAVA_LIBRARY}/jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar ) - -endif (HDFJAVA_ROOT_DIR) + +endif () diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index e1cb781..cc78c2b 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR) ############################################################################################################### # This script will build and run the examples from a folder # Execute from a command line: diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index d88e672..747e043 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -5,21 +5,21 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) if (${libtype} MATCHES "SHARED") if (ARGN) set (PACKAGE_SOVERSION ${ARGN}) - else (ARGN) + else () set (PACKAGE_SOVERSION ${HDF5_PACKAGE_SOVERSION}) - endif (ARGN) + endif () if (WIN32) set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) - else (WIN32) + else () set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION}) - endif (WIN32) + endif () set_target_properties (${libtarget} PROPERTIES VERSION ${LIBHDF_VERSION}) if (WIN32) set (${LIB_OUT_NAME} "${LIB_OUT_NAME}-${PACKAGE_SOVERSION}") - else (WIN32) + else () set_target_properties (${libtarget} PROPERTIES SOVERSION ${PACKAGE_SOVERSION}) - endif (WIN32) - endif (${libtype} MATCHES "SHARED") + endif () + endif () HDF_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype}) #-- Apple Specific install_name for libraries @@ -31,7 +31,7 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} ) - endif (HDF5_BUILD_WITH_INSTALL_NAME) + endif () if (HDF5_BUILD_FRAMEWORKS) if (${libtype} MATCHES "SHARED") # adapt target to build frameworks instead of dylibs @@ -42,8 +42,8 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) MACOSX_FRAMEWORK_IDENTIFIER org.hdfgroup.${libtarget} MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${HDF5_PACKAGE_VERSION_MAJOR} MACOSX_FRAMEWORK_BUNDLE_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) - endif (${libtype} MATCHES "SHARED") - endif (HDF5_BUILD_FRAMEWORKS) - endif (APPLE) + endif () + endif () + endif () -endmacro (H5_SET_LIB_OPTIONS) +endmacro () diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index eba448c..e84bf74 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -7,7 +7,7 @@ if (${C_HAVE_QUADMATH}) set(HAVE_QUADMATH 1) else () set(HAVE_QUADMATH 0) -endif() +endif () # # This file provides functions for HDF5 specific Fortran support. @@ -20,14 +20,14 @@ ENABLE_LANGUAGE (Fortran) #----------------------------------------------------------------------------- MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) # -# if (NOT DEFINED ${RUN_RESULT_VAR}) +# if (NOT DEFINED ${RUN_RESULT_VAR}) message (STATUS "Detecting Fortran ${FUNCTION}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) + else () set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 "${CODE}" @@ -40,7 +40,7 @@ MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) ) set(${RETURN} ${OUTPUT}) - + #message ( "Test result1 ${RETURN} ") #message ( "Test result3 ${RESULT} ") #message ( "Test result2 ${CMAKE_MATCH_0} ") @@ -65,15 +65,15 @@ MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) "${OUTPUT}\n\n") endif () endif () -# endif (NOT DEFINED ${RUN_RESULT_VAR}) -ENDMACRO (FORTRAN_RUN) +# endif () +ENDMACRO () # Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END" MACRO (READ_SOURCE START END RETURN) - file(READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE) - string(REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE}) - set(RETURN "${CODE}") -ENDMACRO (READ_SOURCE START END RETURN) + file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE) + string (REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE}) + set (RETURN "${CODE}") +ENDMACRO () #----------------------------------------------------------------------------- # Check to see C_LONG_DOUBLE is available @@ -85,10 +85,10 @@ CHECK_FORTRAN_FEATURE(c_long_double ) if (${FORTRAN_HAVE_C_LONG_DOUBLE}) - set(FORTRAN_HAVE_C_LONG_DOUBLE 1) + set (FORTRAN_HAVE_C_LONG_DOUBLE 1) else () - set(FORTRAN_HAVE_C_LONG_DOUBLE 0) -endif() + set (FORTRAN_HAVE_C_LONG_DOUBLE 0) +endif () # Check to see C_LONG_DOUBLE is different from C_DOUBLE @@ -98,23 +98,23 @@ CHECK_FORTRAN_FEATURE(c_long_double FORTRAN_C_LONG_DOUBLE_IS_UNIQUE ) if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE}) - set(FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 1) + set (FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 1) else () - set(FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 0) -endif() + set (FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 0) +endif () ## Set the sizeof function for use later in the fortran tests -if(FORTRAN_HAVE_STORAGE_SIZE) - set(FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") - set(FC_SIZEOF_B "STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") - set(FC_SIZEOF_C "STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") -elseif(FORTRAN_HAVE_C_SIZEOF) - set(FC_SIZEOF_A "SIZEOF(a)") - set(FC_SIZEOF_B "SIZEOF(b)") - set(FC_SIZEOF_C "SIZEOF(c)") -else(FORTRAN_HAVE_STORAGE_SIZE) +if (FORTRAN_HAVE_STORAGE_SIZE) + set (FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") + set (FC_SIZEOF_B "STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") + set (FC_SIZEOF_C "STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") +elseif (FORTRAN_HAVE_C_SIZEOF) + set (FC_SIZEOF_A "SIZEOF(a)") + set (FC_SIZEOF_B "SIZEOF(b)") + set (FC_SIZEOF_C "SIZEOF(c)") +else () message (FATAL_ERROR "Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE") -endif(FORTRAN_HAVE_STORAGE_SIZE) +endif () #----------------------------------------------------------------------------- # Determine the available KINDs for REALs and INTEGERs @@ -134,35 +134,35 @@ FORTRAN_RUN("REAL and INTEGER KINDs" # dnl -- LINE 4 -- number of valid integer kinds # dnl -- LINE 5 -- number of valid real kinds -file(READ "${CMAKE_BINARY_DIR}/pac_fconftest.out" PROG_OUTPUT) +file (READ "${CMAKE_BINARY_DIR}/pac_fconftest.out" PROG_OUTPUT) # Convert the string to a list of strings by replacing the carriage return with a semicolon -string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") +string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") -list(GET PROG_OUTPUT 0 pac_validIntKinds) -list(GET PROG_OUTPUT 1 pac_validRealKinds) -list(GET PROG_OUTPUT 2 H5_PAC_FC_MAX_REAL_PRECISION) +list (GET PROG_OUTPUT 0 pac_validIntKinds) +list (GET PROG_OUTPUT 1 pac_validRealKinds) +list (GET PROG_OUTPUT 2 H5_PAC_FC_MAX_REAL_PRECISION) # If the lists are empty then something went wrong. -if( NOT pac_validIntKinds) +if (NOT pac_validIntKinds) message (FATAL_ERROR "Failed to find available INTEGER KINDs for Fortran") -endif() -if( NOT pac_validRealKinds) +endif () +if (NOT pac_validRealKinds) message (FATAL_ERROR "Failed to find available REAL KINDs for Fortran") -endif() -if( NOT H5_PAC_FC_MAX_REAL_PRECISION) +endif () +if (NOT H5_PAC_FC_MAX_REAL_PRECISION) message (FATAL_ERROR "No output from Fortran decimal precision program") -endif() +endif () -set(PAC_FC_ALL_INTEGER_KINDS "\{${pac_validIntKinds}\}") -set(PAC_FC_ALL_REAL_KINDS "\{${pac_validRealKinds}\}") +set (PAC_FC_ALL_INTEGER_KINDS "\{${pac_validIntKinds}\}") +set (PAC_FC_ALL_REAL_KINDS "\{${pac_validRealKinds}\}") -list(GET PROG_OUTPUT 3 NUM_IKIND) -list(GET PROG_OUTPUT 4 NUM_RKIND) +list (GET PROG_OUTPUT 3 NUM_IKIND) +list (GET PROG_OUTPUT 4 NUM_RKIND) -set(PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}") +set (PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}") -set(H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") -set(H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") +set (H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") +set (H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") message (STATUS "....NUMBER OF INTEGER KINDS FOUND ${PAC_FORTRAN_NUM_INTEGER_KINDS}") message (STATUS "....REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") @@ -175,10 +175,10 @@ message (STATUS "....MAX DECIMAL PRECISION ${H5_PAC_FC_MAX_REAL_PRECISION}") # ********** # INTEGERS # ********** -string(REGEX REPLACE "," ";" VAR "${pac_validIntKinds}") +string (REGEX REPLACE "," ";" VAR "${pac_validIntKinds}") -foreach( KIND ${VAR} ) - set(PROG_SRC +foreach (KIND ${VAR} ) + set (PROG_SRC " PROGRAM main USE ISO_C_BINDING @@ -193,37 +193,36 @@ foreach( KIND ${VAR} ) YY PROG_OUTPUT1 ) - string(REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") - set(pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") -endforeach(KIND) + string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") + set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") +endforeach () if (pack_int_sizeof STREQUAL "") message (FATAL_ERROR "Failed to find available INTEGER KINDs for Fortran") -endif() - -string(STRIP ${pack_int_sizeof} pack_int_sizeof) +endif () +string (STRIP ${pack_int_sizeof} pack_int_sizeof) #Remove trailing comma -string(REGEX REPLACE ",$" "" pack_int_sizeof "${pack_int_sizeof}") +string (REGEX REPLACE ",$" "" pack_int_sizeof "${pack_int_sizeof}") #Remove spaces -string(REGEX REPLACE " " "" pack_int_sizeof "${pack_int_sizeof}") +string (REGEX REPLACE " " "" pack_int_sizeof "${pack_int_sizeof}") -set(PAC_FC_ALL_INTEGER_KINDS_SIZEOF "\{${pack_int_sizeof}\}") +set (PAC_FC_ALL_INTEGER_KINDS_SIZEOF "\{${pack_int_sizeof}\}") -message(STATUS "....FOUND SIZEOF for INTEGER KINDs ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}") +message (STATUS "....FOUND SIZEOF for INTEGER KINDs ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}") # ********** # REALS # ********** -string(REGEX REPLACE "," ";" VAR "${pac_validRealKinds}") +string (REGEX REPLACE "," ";" VAR "${pac_validRealKinds}") #find the maximum kind of the real -list(LENGTH VAR LEN_VAR) +list (LENGTH VAR LEN_VAR) MATH (EXPR _LEN "${LEN_VAR}-1") -list(GET VAR ${_LEN} max_real_fortran_kind) +list (GET VAR ${_LEN} max_real_fortran_kind) -foreach( KIND ${VAR} ) - set(PROG_SRC +foreach (KIND ${VAR} ) + set(PROG_SRC " PROGRAM main USE ISO_C_BINDING @@ -238,32 +237,32 @@ foreach( KIND ${VAR} ) YY PROG_OUTPUT1 ) - string(REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") - set(pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") -endforeach(KIND) + string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") + set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") +endforeach () if (pack_int_sizeof STREQUAL "") message (FATAL_ERROR "Failed to find available REAL KINDs for Fortran") -endif() +endif () string(STRIP ${pack_real_sizeof} pack_real_sizeof) #Remove trailing comma -string(REGEX REPLACE ",$" "" pack_real_sizeof "${pack_real_sizeof}") +string (REGEX REPLACE ",$" "" pack_real_sizeof "${pack_real_sizeof}") #Remove spaces -string(REGEX REPLACE " " "" pack_real_sizeof "${pack_real_sizeof}") +string (REGEX REPLACE " " "" pack_real_sizeof "${pack_real_sizeof}") -set(H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${pack_real_sizeof}/)") +set (H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${pack_real_sizeof}/)") -message(STATUS "....FOUND SIZEOF for REAL KINDs \{${pack_real_sizeof}\}") +message (STATUS "....FOUND SIZEOF for REAL KINDs \{${pack_real_sizeof}\}") -set(PAC_FC_ALL_REAL_KINDS_SIZEOF "\{${pack_real_sizeof}\}") +set (PAC_FC_ALL_REAL_KINDS_SIZEOF "\{${pack_real_sizeof}\}") #find the maximum kind of the real -string(REGEX REPLACE "," ";" VAR "${pack_real_sizeof}") -list(LENGTH VAR LEN_VAR) +string (REGEX REPLACE "," ";" VAR "${pack_real_sizeof}") +list (LENGTH VAR LEN_VAR) MATH (EXPR _LEN "${LEN_VAR}-1") -list(GET VAR ${_LEN} max_real_fortran_sizeof) +list (GET VAR ${_LEN} max_real_fortran_sizeof) #----------------------------------------------------------------------------- # Find sizeof of native kinds @@ -277,9 +276,9 @@ FORTRAN_RUN("SIZEOF NATIVE KINDs" REAL b DOUBLE PRECISION c WRITE(*,*) ${FC_SIZEOF_A} - WRITE(*,*) kind(a) - WRITE(*,*) ${FC_SIZEOF_B} - WRITE(*,*) kind(b) + WRITE(*,*) kind(a) + WRITE(*,*) ${FC_SIZEOF_B} + WRITE(*,*) kind(b) WRITE(*,*) ${FC_SIZEOF_C} WRITE(*,*) kind(c) END @@ -297,63 +296,63 @@ FORTRAN_RUN("SIZEOF NATIVE KINDs" # dnl -- LINE 6 -- kind of DOUBLE PRECISION # Convert the string to a list of strings by replacing the carriage return with a semicolon -string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") +string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") -list(GET PROG_OUTPUT 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) -list(GET PROG_OUTPUT 1 PAC_FORTRAN_NATIVE_INTEGER_KIND) -list(GET PROG_OUTPUT 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF) -list(GET PROG_OUTPUT 3 PAC_FORTRAN_NATIVE_REAL_KIND) -list(GET PROG_OUTPUT 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) -list(GET PROG_OUTPUT 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND) +list (GET PROG_OUTPUT 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) +list (GET PROG_OUTPUT 1 PAC_FORTRAN_NATIVE_INTEGER_KIND) +list (GET PROG_OUTPUT 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF) +list (GET PROG_OUTPUT 3 PAC_FORTRAN_NATIVE_REAL_KIND) +list (GET PROG_OUTPUT 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) +list (GET PROG_OUTPUT 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND) if (NOT PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) message (FATAL_ERROR "Failed to find SIZEOF NATIVE INTEGER KINDs for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_REAL_SIZEOF) message (FATAL_ERROR "Failed to find SIZEOF NATIVE REAL KINDs for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) message (FATAL_ERROR "Failed to find SIZEOF NATIVE DOUBLE KINDs for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_INTEGER_KIND) message (FATAL_ERROR "Failed to find KIND of NATIVE INTEGER for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_REAL_KIND) message (FATAL_ERROR "Failed to find KIND of NATIVE REAL for Fortran") endif() if (NOT PAC_FORTRAN_NATIVE_DOUBLE_KIND) message (FATAL_ERROR "Failed to find KIND of NATIVE DOUBLE for Fortran") -endif() +endif () -set(FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) -#set(H5_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) +set (FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) +#set (H5_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) # remove the invalid kind from the list -if(NOT(${SIZEOF___FLOAT128} EQUAL 0)) - if(NOT(${SIZEOF___FLOAT128} EQUAL ${max_real_fortran_sizeof}) - AND NOT(${FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof}) - # account for the fact that the C compiler can have 16-byte __float128 and the fortran compiler only has 8-byte doubles, - # so we don't want to remove the 8-byte fortran doubles. - AND NOT(${PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF} EQUAL ${max_real_fortran_sizeof})) - message(WARNING " +if (NOT(${SIZEOF___FLOAT128} EQUAL 0)) + if (NOT(${SIZEOF___FLOAT128} EQUAL ${max_real_fortran_sizeof}) + AND NOT(${FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof}) + # account for the fact that the C compiler can have 16-byte __float128 and the fortran compiler only has 8-byte doubles, + # so we don't want to remove the 8-byte fortran doubles. + AND NOT(${PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF} EQUAL ${max_real_fortran_sizeof})) + message (WARNING " Fortran REAL(KIND=${max_real_fortran_kind}) is $max_real_fortran_sizeof Bytes, but no corresponding C float type exists of that size !!! Fortran interfaces will not be generated for REAL(KIND=${max_real_fortran_kind}) !!!") - string(REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS ${PAC_FC_ALL_REAL_KINDS}) - string(REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS_SIZEOF ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) + string (REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS ${PAC_FC_ALL_REAL_KINDS}) + string (REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS_SIZEOF ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) MATH (EXPR NUM_RKIND "${NUM_RKIND} - 1") - endif() -endif(NOT(${SIZEOF___FLOAT128} EQUAL 0)) + endif () +endif () -set(H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}") +set (H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}") -string(REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS}) -string(REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) -set(H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)") +string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS}) +string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) +set (H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)") -string(REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) -string(REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) -set(H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)") +string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) +string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) +set (H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)") ENABLE_LANGUAGE (C) @@ -366,9 +365,9 @@ MACRO (C_RUN FUNCTION CODE RETURN) if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) + else () set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c ${CODE} @@ -380,8 +379,8 @@ MACRO (C_RUN FUNCTION CODE RETURN) RUN_OUTPUT_VARIABLE OUTPUT ) - set(${RETURN} ${OUTPUT}) - + set (${RETURN} ${OUTPUT}) + #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") @@ -405,10 +404,10 @@ MACRO (C_RUN FUNCTION CODE RETURN) endif () else () message (FATAL_ERROR "Compilation of C ${FUNCTION} - Failed") - endif() -ENDMACRO (C_RUN) + endif () +ENDMACRO () -set(PROG_SRC +set (PROG_SRC " #include <float.h> #include <stdio.h> @@ -426,7 +425,7 @@ set(PROG_SRC #define C_FLT128_DIG 0 #endif #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#define C_LDBL_DIG DECIMAL_DIG +#define C_LDBL_DIG DECIMAL_DIG #else #define C_LDBL_DIG LDBL_DIG #endif @@ -444,24 +443,24 @@ C_RUN("maximum decimal precision for C" ${PROG_SRC} PROG_OUTPUT) # dnl -- LINE 2 -- __float128 decimal precision # Convert the string to a list of strings by replacing the carriage return with a semicolon -string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") +string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") -list(GET PROG_OUTPUT 0 LDBL_DIG) -list(GET PROG_OUTPUT 1 FLT128_DIG) +list (GET PROG_OUTPUT 0 LDBL_DIG) +list (GET PROG_OUTPUT 1 FLT128_DIG) -if(SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) - SET(H5_HAVE_FLOAT128 0) - SET(SIZEOF___FLOAT128 0) - set(H5_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG}) +if (SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) + set (H5_HAVE_FLOAT128 0) + set (SIZEOF___FLOAT128 0) + set (H5_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG}) else () set(H5_PAC_C_MAX_REAL_PRECISION ${FLT128_DIG}) -endif() +endif () # Setting definition if there is a 16 byte fortran integer -string(FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) -if(${pos} EQUAL -1) - set(HAVE_Fortran_INTEGER_SIZEOF_16 0) +string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) +if (${pos} EQUAL -1) + set (HAVE_Fortran_INTEGER_SIZEOF_16 0) else () - set(HAVE_Fortran_INTEGER_SIZEOF_16 1) + set (HAVE_Fortran_INTEGER_SIZEOF_16 1) endif () diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 058dd7a..c3f8f95 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR) ############################################################################################################### # This script will build and run the examples from a folder # Execute from a command line: diff --git a/config/cmake/HDF5_Process_Flex_Files.cmake b/config/cmake/HDF5_Process_Flex_Files.cmake index 2306e93..667ad31 100644 --- a/config/cmake/HDF5_Process_Flex_Files.cmake +++ b/config/cmake/HDF5_Process_Flex_Files.cmake @@ -49,7 +49,7 @@ if (FILE_PARSE) message (STATUS "processed pragma in ${FILE_PARSE}") file (READ ${GEN_DIR}/${FILE_PARSE}.h TEST_STREAM) file (WRITE ${FILE_PARSE}.h "${TEST_STREAM}") -endif (FILE_PARSE) +endif () if (FILE_ANALYZE) # Add code that disables warnings in the flex/bison-generated code. @@ -81,4 +81,4 @@ if (FILE_ANALYZE) ") file (APPEND ${FILE_ANALYZE} "${TEST_STREAM}") message (STATUS "processed pragma in ${FILE_ANALYZE}") -endif (FILE_ANALYZE) +endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 665db32..a56c087 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -12,21 +12,21 @@ if (CMAKE_COMPILER_IS_GNUCC) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") endif () - endif (CMAKE_BUILD_TYPE MATCHES Debug) -endif (CMAKE_COMPILER_IS_GNUCC) -if (CMAKE_COMPILER_IS_GNUCXX) + endif () +endif () +if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) if (CMAKE_BUILD_TYPE MATCHES Debug) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") endif () - else (CMAKE_BUILD_TYPE MATCHES Debug) + else () set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") endif () - endif (CMAKE_BUILD_TYPE MATCHES Debug) -endif (CMAKE_COMPILER_IS_GNUCXX) + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to disable compiler warnings @@ -41,22 +41,22 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") - endif (MSVC) + endif () if (WIN32) add_definitions (-D_CRT_SECURE_NO_WARNINGS) - endif (WIN32) + endif () # Borland uses -w- to suppress warnings. if (BORLAND) set (HDF5_WARNINGS_BLOCKED 1) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") - endif (BORLAND) + endif () # Most compilers use -w to suppress warnings. if (NOT HDF5_WARNINGS_BLOCKED) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") - endif (NOT HDF5_WARNINGS_BLOCKED) -endif (HDF5_DISABLE_COMPILER_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # CDash is configured to only allow 3000 warnings, so @@ -64,10 +64,22 @@ endif (HDF5_DISABLE_COMPILER_WARNINGS) #----------------------------------------------------------------------------- if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline") - else (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + set (CMAKE_C_FLAGS_5 "${CMAKE_C_FLAGS_5} -Wcast-qual") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs") + else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") - endif (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + endif () + + #----------------------------------------------------------------------------- + # Option to allow the user to enable developer warnings + #----------------------------------------------------------------------------- + option (HDF5_ENABLE_DEV_WARNINGS "Enable developer group warnings" OFF) + if (HDF5_ENABLE_DEV_WARNINGS) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsuggest-attribute=const -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Winline") + else () + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-discarded-qualifiers -Wno-suggest-attribute=const -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn -Wno-suggest-attribute=format -Wno-inline") + endif () + # Append warning flags # Don't use the '-Wtraditional' flag, we're way past having K&R C code # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") @@ -87,71 +99,74 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # Enable more format checking flags, beyond the basic -Wformat included # in -Wall - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wformat=2") - - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wunreachable-code") - endif() + set (H5_CFLAGS1_5 "${H5_CFLAGS1_5} -Wformat=2") # Append warning flags from gcc-3.3* case set (H5_CFLAGS1 "${H5_CFLAGS1} -Wendif-labels") # Append warning flags from gcc-3.4* case - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") # Append more extra warning flags that only gcc4.0+ know about set (H5_CFLAGS2 "${H5_CFLAGS2} -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros") # Append more extra warning flags that only gcc 4.1+ know about - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wunsafe-loop-optimizations -Wc++-compat") + set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wunsafe-loop-optimizations") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wc++-compat") # Append more extra warning flags that only gcc 4.2+ know about - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wstrict-overflow") + set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-strict-overflow") # Append more extra warning flags that only gcc 4.3+ know about # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wlogical-op -Wlarger-than=2048 -Wvla") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wlogical-op -Wlarger-than=2048 -Wvla") # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") # Append more extra warning flags that only gcc 4.5+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") - endif() + set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wjump-misses-init -Wunsuffixed-float-constants") + endif () # Append more extra warning flags that only gcc 4.6+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines") - endif() + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines") + endif () - # Append more extra warning flags that only gcc 4.7+ know about + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") - endif() + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wunreachable-code") + endif () - # Append more extra warning flags that only gcc 4.8+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wsuggest-attribute=format") - endif() + # Append more extra warning flags that only gcc 4.7+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") + endif () # Append more extra warning flags that only gcc 4.9+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wdate-time -Wopenmp-simd") - endif() + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time -Wopenmp-simd") + endif () # (There was no release of gcc 5.0) # Append more extra warning flags that only gcc 5.1+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) - set (H5_CFLAGS6 "${H5_CFLAGS6} -Warray-bounds=2 -Wc99-c11-compat") - endif() + set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") + endif () + + # Append more extra warning flags that only gcc 6.x+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa") + endif () -endif (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable all warnings @@ -163,12 +178,12 @@ if (HDF5_ENABLE_ALL_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall") - else (MSVC) + else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}") - endif (CMAKE_COMPILER_IS_GNUCC) - endif (MSVC) -endif (HDF5_ENABLE_ALL_WARNINGS) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2}") + endif () + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -180,12 +195,12 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1") - else (MSVC) + else () if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") - endif (CMAKE_COMPILER_IS_GNUCC) - endif (MSVC) -endif (HDF5_ENABLE_GROUPZERO_WARNINGS) + endif () + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -197,10 +212,10 @@ if (HDF5_ENABLE_GROUPONE_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2") - else (MSVC) + else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS1}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPONE_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -212,10 +227,10 @@ if (HDF5_ENABLE_GROUPTWO_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") - else (MSVC) + else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS2}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPTWO_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -227,10 +242,10 @@ if (HDF5_ENABLE_GROUPTHREE_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") - else (MSVC) + else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS3}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPTHREE_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -239,28 +254,8 @@ option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) if (HDF5_ENABLE_GROUPFOUR_WARNINGS) if (NOT MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") - endif (NOT MSVC) -endif (HDF5_ENABLE_GROUPFOUR_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPFIVE_WARNINGS "Enable group five warnings" OFF) -if (HDF5_ENABLE_GROUPFIVE_WARNINGS) - if (NOT MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS5}") - endif (NOT MSVC) -endif (HDF5_ENABLE_GROUPFIVE_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPSIX_WARNINGS "Enable group six warnings" OFF) -if (HDF5_ENABLE_GROUPSIX_WARNINGS) - if (NOT MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS6}") - endif (NOT MSVC) -endif (HDF5_ENABLE_GROUPSIX_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # This is in here to help some of the GCC based IDES like Eclipse @@ -268,7 +263,7 @@ endif (HDF5_ENABLE_GROUPSIX_WARNINGS) #----------------------------------------------------------------------------- if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") -endif (CMAKE_COMPILER_IS_GNUCC) -if (CMAKE_COMPILER_IS_GNUCXX) +endif () +if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") -endif (CMAKE_COMPILER_IS_GNUCXX) +endif () diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index a54f22c..d30d4d5 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -3,7 +3,7 @@ ######################################################## # To use this option, copy both the macro and option code -# into the root UserMacros.cmake file. +# into the root UserMacros.cmake file. # OR add an include to the root UserMacros.cmake file: # INCLUDE(path_to_file/WINDOWS_MT.cmake) @@ -19,23 +19,22 @@ MACRO (TARGET_STATIC_CRT_FLAGS) CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) if (${flag_var} MATCHES "/MD") string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif (${flag_var} MATCHES "/MD") - endforeach (flag_var) + endif () + endforeach () foreach (flag_var CMAKE_Fortran_FLAGS CMAKE_Fortran_FLAGS_DEBUG CMAKE_Fortran_FLAGS_RELEASE CMAKE_Fortran_FLAGS_MINSIZEREL CMAKE_Fortran_FLAGS_RELWITHDEBINFO) if (${flag_var} MATCHES "/libs:dll") string (REGEX REPLACE "/libs:dll" "/libs:static" ${flag_var} "${${flag_var}}") - endif (${flag_var} MATCHES "/libs:dll") - endforeach (flag_var) + endif () + endforeach () set (WIN_COMPILE_FLAGS "") set (WIN_LINK_FLAGS "/NODEFAULTLIB:MSVCRT") - endif (MSVC AND NOT BUILD_SHARED_LIBS) -ENDMACRO (TARGET_STATIC_CRT_FLAGS) + endif () +ENDMACRO () #----------------------------------------------------------------------------- option (BUILD_STATIC_CRT_LIBS "Build With Static CRT Libraries" OFF) if (BUILD_STATIC_CRT_LIBS) TARGET_STATIC_CRT_FLAGS () -endif (BUILD_STATIC_CRT_LIBS) -
\ No newline at end of file +endif () diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 24ae95c..5901a78 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -42,6 +42,8 @@ set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memor set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) +set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) + set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) set (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE) diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in index 5911fa7..45a832e 100644 --- a/config/cmake/hdf5-config-version.cmake.in +++ b/config/cmake/hdf5-config-version.cmake.in @@ -14,24 +14,24 @@ if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@") - + # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@ if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") - + # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x - set (PACKAGE_VERSION_COMPATIBLE TRUE) - + set (PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@") set (PACKAGE_VERSION_EXACT TRUE) - + if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@") # not using this yet - endif ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@") - endif ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@") - else ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") - set (PACKAGE_VERSION_COMPATIBLE FALSE) - endif ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") - endif ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@") + endif () + endif () + else () + set (PACKAGE_VERSION_COMPATIBLE FALSE) + endif () + endif () endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 59f4c7b..2d83caf 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -5,44 +5,44 @@ cmake_policy(SET CMP0007 NEW) # arguments checking if (NOT TEST_TESTER) message (FATAL_ERROR "Require TEST_TESTER to be defined") -endif (NOT TEST_TESTER) +endif () if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) +endif () if (NOT TEST_LIBRARY_DIRECTORY) message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined") -endif (NOT TEST_LIBRARY_DIRECTORY) +endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) +endif () if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) +endif () if (NOT TEST_CLASSPATH) message (STATUS "Require TEST_CLASSPATH to be defined") -endif (NOT TEST_CLASSPATH) +endif () if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_REFERENCE) +endif () if (NOT TEST_ERRREF) if (NOT SKIP_APPEND) # append error file since skip was not defined set (ERROR_APPEND 1) - endif(NOT SKIP_APPEND) -endif (NOT TEST_ERRREF) + endif () +endif () if (NOT TEST_LOG_LEVEL) set (LOG_LEVEL "info") -else (NOT TEST_LOG_LEVEL) +else () set (LOG_LEVEL "${TEST_LOG_LEVEL}") -endif (NOT TEST_LOG_LEVEL) +endif () message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=${LOG_LEVEL} -Djava.library.path=\"${TEST_LIBRARY_DIRECTORY}\" -cp \"${TEST_CLASSPATH}\" ${TEST_ARGS} ${TEST_PROGRAM} ${ARGN}") if (WIN32 AND NOT MINGW) set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}") -endif (WIN32 AND NOT MINGW) +endif () # run the test program, capture the stdout/stderr and the result var execute_process ( @@ -64,25 +64,25 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) if (TEST_MASK_FILE) STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") - endif (TEST_MASK_FILE) + endif () if (NOT ERROR_APPEND) # append error output to the stdout output file file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - else (NOT ERROR_APPEND) + else () # write back to original .err file file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - endif (NOT ERROR_APPEND) -endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + endif () +endif () if (TEST_MASK_ERROR) if (NOT TEST_ERRREF) # the error stack has been appended to the output file file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - else (NOT TEST_ERRREF) + else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - endif (NOT TEST_ERRREF) + endif () string (REGEX REPLACE "Time:[^\n]+\n" "Time: XXXX\n" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") @@ -94,16 +94,16 @@ if (TEST_MASK_ERROR) # write back the changes to the original files if (NOT TEST_ERRREF) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else (NOT TEST_ERRREF) + else () file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - endif (NOT TEST_ERRREF) -endif (TEST_MASK_ERROR) + endif () +endif () # if the return value is !=0 bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) message (STATUS "ERROR OUTPUT: ${TEST_STREAM}") message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") -endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") @@ -112,7 +112,7 @@ if (NOT TEST_SKIP_COMPARE) if (WIN32 AND NOT MINGW) file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) + endif () # now compare the output with the reference execute_process ( @@ -120,42 +120,42 @@ if (NOT TEST_SKIP_COMPARE) RESULT_VARIABLE TEST_RESULT ) if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0") - MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () + endif () + endforeach () + endif () + if (NOT ${len_act} STREQUAL ${len_ref}) + set (TEST_RESULT 1) + endif () + endif () message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout if (NOT ${TEST_RESULT} STREQUAL 0) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") - endif (NOT ${TEST_RESULT} STREQUAL 0) + endif () # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) if (WIN32 AND NOT MINGW) file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) + endif () # now compare the error output with the error reference execute_process ( @@ -163,38 +163,38 @@ if (NOT TEST_SKIP_COMPARE) RESULT_VARIABLE TEST_RESULT ) if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) - list (LENGTH test_ref len_ref) - MATH (EXPR _FP_LEN "${len_ref} - 1") - if (NOT ${len_act} STREQUAL "0") + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) + list (LENGTH test_ref len_ref) MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () + endif () + endforeach () + endif () + if (NOT ${len_act} STREQUAL ${len_ref}) + set (TEST_RESULT 1) + endif () + endif () message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout if (NOT ${TEST_RESULT} STREQUAL 0) message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") - endif (NOT ${TEST_RESULT} STREQUAL 0) - endif (TEST_ERRREF) -endif (NOT TEST_SKIP_COMPARE) + endif () + endif () +endif () if (TEST_GREP_COMPARE) # now grep the output with the reference @@ -205,7 +205,7 @@ if (TEST_GREP_COMPARE) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) if (${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") - endif (${TEST_RESULT} STREQUAL "0") + endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) if (${TEST_EXPECT} STREQUAL "1") @@ -213,9 +213,9 @@ if (TEST_GREP_COMPARE) string (LENGTH "${TEST_MATCH}" TEST_RESULT) if (NOT ${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") - endif (NOT ${TEST_RESULT} STREQUAL "0") - endif (${TEST_EXPECT} STREQUAL "0") -endif (TEST_GREP_COMPARE) + endif () + endif () +endif () # everything went fine... message ("${TEST_PROGRAM} Passed") diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index f2675c3..7657fc2 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR)
########################################################
# This dashboard is maintained by The HDF Group
# For any comments please contact cdashhelp@hdfgroup.org
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 2b1b097..8e3b7b0 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -4,7 +4,7 @@ ### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf5.log ###
#############################################################################################
-cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR)
############################################################################
# Usage:
# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log
diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake index 0775cbe..43db733 100644 --- a/config/cmake/userblockTest.cmake +++ b/config/cmake/userblockTest.cmake @@ -4,28 +4,28 @@ # arguments checking if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM tellub to be defined") -endif (NOT TEST_PROGRAM) +endif () if (NOT TEST_GET_PROGRAM) message (FATAL_ERROR "Require TEST_GET_PROGRAM getub to be defined") -endif (NOT TEST_GET_PROGRAM) +endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) +endif () if (NOT TEST_HFILE) message (FATAL_ERROR "Require TEST_HFILE the hdf file to be defined") -endif (NOT TEST_HFILE) +endif () if (NOT TEST_UFILE) message (FATAL_ERROR "Require TEST_UFILE the ub file to be defined") -endif (NOT TEST_UFILE) +endif () if (NOT TEST_CHECKUB) message (STATUS "Require TEST_CHECKUB - YES or NO - to be defined") -endif (NOT TEST_CHECKUB) +endif () #if (NOT TEST_EXPECT) # message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) +#endif () #if (NOT TEST_OFILE) # message (FATAL_ERROR "Require TEST_OFILE the original hdf file to be defined") -#endif (NOT TEST_OFILE) +#endif () set (TEST_U_STRING_LEN 0) set (TEST_O_STRING_LEN 0) @@ -53,9 +53,9 @@ if (TEST_CHECKUB STREQUAL "YES") ) if (NOT ${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} ${TEST_OFILE} is: ${TEST_ERROR}") - endif (NOT ${TEST_RESULT} STREQUAL "0") + endif () file (READ ${TEST_HFILE}.len.txt TEST_O_STRING_LEN) - endif (TEST_OFILE) + endif () MATH( EXPR TEST_STRING_SIZE "${TEST_U_STRING_LEN} + ${TEST_O_STRING_LEN}" ) @@ -73,10 +73,10 @@ if (TEST_CHECKUB STREQUAL "YES") #cat $ufile >> $cmpfile file (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) file (APPEND ${TEST_HFILE}-ub.cmp "${TEST_STREAM}") - else (NOT TEST_O_STRING_LEN STREQUAL "0") + else () file (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) file (WRITE ${TEST_HFILE}-ub.cmp ${TEST_STREAM}) - endif (NOT TEST_O_STRING_LEN STREQUAL "0") + endif () #$JAM_BIN/getub -c $size $hfile > $tfile EXECUTE_PROCESS ( @@ -99,8 +99,8 @@ if (TEST_CHECKUB STREQUAL "YES") # if the return value is !=${TEST_EXPECT} bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) message (FATAL_ERROR "Failed: The output of ${TEST_HFILE}-ub did not match ${TEST_HFILE}.\n${TEST_ERROR}") - endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) -else (TEST_CHECKUB STREQUAL "YES") + endif () +else () # call 'ubsize' to get the size of the user block #ubsize=`$JAM_BIN/tellub $hfile` EXECUTE_PROCESS ( @@ -112,8 +112,8 @@ else (TEST_CHECKUB STREQUAL "YES") ) if (NOT TEST_H_STRING_LEN STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_HFILE} was NOT empty") - endif (NOT TEST_H_STRING_LEN STREQUAL "0") -endif (TEST_CHECKUB STREQUAL "YES") + endif () +endif () # everything went fine... message ("Passed: The output of CHECK matched expectation") diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 10f0a7b..bcbb441 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -4,19 +4,19 @@ # arguments checking if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) +endif () #if (NOT TEST_ARGS) # message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) +#endif () #if (NOT TEST_EXPECT) # message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) +#endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) +endif () if (NOT TEST_VFD) message (FATAL_ERROR "Require TEST_VFD to be defined") -endif (NOT TEST_VFD) +endif () set (ERROR_APPEND 1) @@ -38,13 +38,12 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out "${TEST_STREAM}") -endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) +endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) message ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") -endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +endif () # everything went fine... message ("Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}") - |