summaryrefslogtreecommitdiffstats
path: root/config/cmake/ConfigureChecks.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'config/cmake/ConfigureChecks.cmake')
-rw-r--r--config/cmake/ConfigureChecks.cmake59
1 files changed, 35 insertions, 24 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 3d4c23b..8013363 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -872,35 +872,46 @@ if (HDF5_BUILD_FORTRAN)
endif()
#-----------------------------------------------------------------------------
-# Macro to determine the various conversion capabilities
+# Macro to determine long double conversion properties
#-----------------------------------------------------------------------------
-macro (H5ConversionTests TEST msg)
+macro (H5ConversionTests TEST def msg)
if (NOT DEFINED ${TEST})
- TRY_RUN (${TEST}_RUN ${TEST}_COMPILE
- ${CMAKE_BINARY_DIR}
- ${HDF_RESOURCES_DIR}/ConversionTests.c
- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST
- OUTPUT_VARIABLE OUTPUT
- )
- if (${TEST}_COMPILE)
- if (${TEST}_RUN EQUAL "0")
- set (${TEST} 1 CACHE INTERNAL ${msg})
- message (VERBOSE "${msg}... yes")
+ if (NOT CMAKE_CROSSCOMPILING)
+ # Build and run the test code if not cross-compiling
+ TRY_RUN (${TEST}_RUN ${TEST}_COMPILE
+ ${CMAKE_BINARY_DIR}
+ ${HDF_RESOURCES_DIR}/ConversionTests.c
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if (${TEST}_COMPILE)
+ if (${TEST}_RUN EQUAL "0")
+ set (${TEST} 1 CACHE INTERNAL ${msg})
+ message (VERBOSE "${msg}... yes")
+ else ()
+ set (${TEST} "" CACHE INTERNAL ${msg})
+ message (VERBOSE "${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 ()
else ()
set (${TEST} "" CACHE INTERNAL ${msg})
message (VERBOSE "${msg}... no")
file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n"
+ "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n"
)
endif ()
else ()
- set (${TEST} "" CACHE INTERNAL ${msg})
- message (VERBOSE "${msg}... no")
- file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n"
- )
+ # Use the default if there's no cache variable and cross-compiling
+ if (${def})
+ message (VERBOSE "${msg}... yes (cross-compile default)")
+ set (${TEST} 1 CACHE INTERNAL ${msg})
+ else ()
+ message (VERBOSE "${msg}... no (cross-compile default)")
+ set (${TEST} "" CACHE INTERNAL ${msg})
+ endif ()
endif ()
-
endif ()
endmacro ()
@@ -917,7 +928,7 @@ endmacro ()
# 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.
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm")
+H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL FALSE "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.
@@ -926,7 +937,7 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your syst
# ..., 7fffff..., the compiler uses a unknown algorithm. We define a
# macro and skip the test for now until we know about the algorithm.
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm")
+H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL FALSE "Checking IF your system can convert (unsigned) long to long double values with special algorithm")
# ----------------------------------------------------------------------
# Set the flag to indicate that the machine can accurately convert
# 'long double' to '(unsigned) long long' values. (This flag should be set for
@@ -936,7 +947,7 @@ H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL "Checking IF your syste
# 0x4351ccf385ebc8a0dfcc... or 0x4351ccf385ebc8a0ffcc... will make the converted
# values wildly wrong. This test detects this wrong behavior and disable the test.
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly converting long double to (unsigned) long long values")
+H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE TRUE "Checking IF correctly converting long double to (unsigned) long long values")
# ----------------------------------------------------------------------
# Set the flag to indicate that the machine can accurately convert
# '(unsigned) long long' to 'long double' values. (This flag should be set for
@@ -944,9 +955,9 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctl
# 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice
# as big as they should be.
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values")
+H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT TRUE "Checking IF correctly converting (unsigned) long long to long double values")
# ----------------------------------------------------------------------
# Set the flag to indicate that the machine can accurately convert
# some long double values
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV "Checking IF the cpu is power9 and cannot correctly converting long double values")
+H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV FALSE "Checking IF the cpu is power9 and cannot correctly converting long double values")