mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
Added a check for signed char.
This commit is contained in:
parent
9d4e72e75f
commit
2ea988f84d
@ -997,8 +997,24 @@ MARK_AS_ADVANCED(ENABLE_DOXYGEN_BUILD_RELEASE_DOCS DOXYGEN_ENABLE_TASKS ENABLE_D
|
||||
# Option checks
|
||||
################################
|
||||
|
||||
####
|
||||
# Check to see if char is signed or unsigned.
|
||||
####
|
||||
|
||||
SET(SIGNED_TEST_SOURCE "\n
|
||||
#include <stdlib.h>\n
|
||||
int main(void) {\n
|
||||
char is_signed = (char) - 1;\n
|
||||
if(is_signed < 0)\n
|
||||
return 0;\n
|
||||
else\n
|
||||
return 1;\n
|
||||
}\n")
|
||||
|
||||
CHECK_C_SOURCE_RUNS("${SIGNED_TEST_SOURCE}" CHAR_IS_SIGNED)
|
||||
MESSAGE(STATUS "Type 'char' is signed: ${CHAR_IS_SIGNED}")
|
||||
|
||||
|
||||
#
|
||||
# Library include checks
|
||||
CHECK_INCLUDE_FILE("math.h" HAVE_MATH_H)
|
||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
|
@ -209,6 +209,9 @@ are set when opening a binary file on Windows. */
|
||||
/* Define if we have filelengthi64. */
|
||||
#cmakedefine HAVE_FILE_LENGTH_I64 @HAVE_FILE_LENGTH_I64@
|
||||
|
||||
/* Define whether char is signed by default. */
|
||||
#cmakedefine CHAR_IS_SIGNED
|
||||
|
||||
/* The size of `void*` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_VOIDSTAR @SIZEOF_VOIDSTAR@
|
||||
/* The size of `char` as computed by sizeof. */
|
||||
|
@ -14,12 +14,29 @@ SET (nc_test_SRC
|
||||
test_write.c
|
||||
util.c
|
||||
)
|
||||
|
||||
SET (nc_test2_SRC
|
||||
nc_test2.c
|
||||
error.c
|
||||
test_get.c
|
||||
test_put.c
|
||||
test_read.c
|
||||
test_write.c
|
||||
util.c
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(nc_test ${nc_test_SRC})
|
||||
TARGET_LINK_LIBRARIES(nc_test
|
||||
netcdf
|
||||
${HAVE_LIBM}
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(nc_test2 ${nc_test2_SRC})
|
||||
TARGET_LINK_LIBRARIES(nc_test2
|
||||
netcdf
|
||||
${HAVE_LIBM}
|
||||
)
|
||||
|
||||
# Some extra stand-alone tests
|
||||
SET(TESTS t_nc tst_small tst_misc tst_norm tst_names tst_nofill tst_nofill2 tst_nofill3 tst_meta)
|
||||
|
||||
@ -66,6 +83,7 @@ FOREACH(CTEST ${TESTS})
|
||||
ENDFOREACH()
|
||||
|
||||
ADD_TEST(nc_test ${EXECUTABLE_OUTPUT_PATH}/nc_test)
|
||||
ADD_TEST(nc_test2 ${EXECUTABLE_OUTPUT_PATH}/nc_test)
|
||||
|
||||
IF(BUILD_DISKLESS)
|
||||
add_sh_test(nc_test run_diskless)
|
||||
|
Loading…
Reference in New Issue
Block a user