mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-31 17:10:47 +08:00
cmake: simplify try_run result comparisons (#950)
Instead of looking at `MATCHES 0` which runs a regex and returns a false positive for any result such as `10`, check if they are equal to `0`. Also quote `0` to avoid looking it up as a variable (which was left behind prior to the fix to use `${RETURN_VAR}` in the `c_run` macro).
This commit is contained in:
parent
b38bc071e9
commit
b5f5c59f29
@ -149,7 +149,7 @@ 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 EQUAL "0")
|
||||
HDF_FUNCTION_TEST (HAVE_DIRECT)
|
||||
set (CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE")
|
||||
add_definitions ("-D_GNU_SOURCE")
|
||||
@ -259,8 +259,8 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
|
||||
message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
|
||||
endif ()
|
||||
|
||||
if (${COMPILE_RESULT_VAR})
|
||||
if (${RUN_RESULT_VAR} MATCHES 0)
|
||||
if (COMPILE_RESULT_VAR)
|
||||
if (RUN_RESULT_VAR EQUAL "0")
|
||||
set (${RETURN_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
|
||||
message (VERBOSE "Testing C ${FUNCTION_NAME} - OK")
|
||||
@ -318,7 +318,7 @@ message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}")
|
||||
list (GET PROG_OUTPUT4 0 H5_LDBL_DIG)
|
||||
list (GET PROG_OUTPUT4 1 H5_FLT128_DIG)
|
||||
|
||||
if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0)
|
||||
if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL "0" OR FLT128_DIG EQUAL "0")
|
||||
set (${HDF_PREFIX}_HAVE_FLOAT128 0)
|
||||
set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
|
||||
set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG})
|
||||
@ -344,7 +344,7 @@ macro (H5ConversionTests TEST msg)
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
)
|
||||
if (${TEST}_COMPILE)
|
||||
if (${TEST}_RUN MATCHES 0)
|
||||
if (${TEST}_RUN EQUAL "0")
|
||||
set (${TEST} 1 CACHE INTERNAL ${msg})
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
|
||||
message (VERBOSE "${msg}... yes")
|
||||
|
Loading…
x
Reference in New Issue
Block a user