Added a check for signed char.

This commit is contained in:
Ward Fisher 2015-12-22 12:02:18 -07:00
parent 9d4e72e75f
commit 2ea988f84d
3 changed files with 38 additions and 1 deletions

View File

@ -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)

View File

@ -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. */

View File

@ -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)