Added MSVC-compatibility items.

This commit is contained in:
Ward Fisher 2012-08-27 21:19:25 +00:00
parent 929f90f0df
commit 04e61d5894
8 changed files with 30 additions and 12 deletions

View File

@ -8,6 +8,11 @@ SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT")
SET(CPACK_PACKAGE_VERSION "4.3") SET(CPACK_PACKAGE_VERSION "4.3")
ENABLE_TESTING() ENABLE_TESTING()
INCLUDE(CTest) INCLUDE(CTest)
IF(MSVC)
SET(USE_FOLDERS ON)
ENDIF()
# CTest/CDash configuration # CTest/CDash configuration
SET (CTEST_DROP_METHOD http CACHE STRING "") SET (CTEST_DROP_METHOD http CACHE STRING "")
SET (CTEST_DROP_SITE "yakov.unidata.ucar.edu/~wfisher/cdash/" CACHE STRING "") SET (CTEST_DROP_SITE "yakov.unidata.ucar.edu/~wfisher/cdash/" CACHE STRING "")
@ -242,14 +247,14 @@ IF(NOT WIN32)
ENDIF() ENDIF()
# Enable Tests # Enable Tests
IF(NOT MSVC) #IF(NOT MSVC)
OPTION (ENABLE_TESTS "Enable basic tests, run with 'make test'." ON) OPTION (ENABLE_TESTS "Enable basic tests, run with 'make test'." ON)
IF(ENABLE_TESTS) IF(ENABLE_TESTS)
SET(BUILD_TESTSETS ON CACHE BOOL "") SET(BUILD_TESTSETS ON CACHE BOOL "")
ENDIF() ENDIF()
ELSE() #ELSE()
SET(ENABLE_TESTS OFF CACHE "") # SET(ENABLE_TESTS OFF CACHE BOOL "")
ENDIF() #ENDIF()
# Enable Large file tests # Enable Large file tests
OPTION (ENABLE_LARGE_FILE_TESTS "Enable large file tests." OFF) OPTION (ENABLE_LARGE_FILE_TESTS "Enable large file tests." OFF)
@ -310,6 +315,7 @@ MARK_AS_ADVANCED(ENABLE_DAP_REMOTE_TESTS ENABLE_DAP_LONG_TESTS)
# Library include checks # Library include checks
CHECK_INCLUDE_FILE("math.h" HAVE_MATH_H) CHECK_INCLUDE_FILE("math.h" HAVE_MATH_H)
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA_H) CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA_H)
CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H) CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H)
CHECK_INCLUDE_FILE("dirent.h" HAVE_DIRENT_H) CHECK_INCLUDE_FILE("dirent.h" HAVE_DIRENT_H)

View File

@ -60,6 +60,9 @@
/* Define to 1 if you have the <dirent> header file. */ /* Define to 1 if you have the <dirent> header file. */
#cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@ #cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@ #cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@

View File

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
cmake .. -D"ENABLE_DAP=OFF" -D"ENABLE_NETCDF_4=OFF" -D"USE_HDF5=OFF" -D"ENABLE_TOOLS=OFF" cmake .. -D"ENABLE_DAP=OFF" -D"ENABLE_NETCDF_4=OFF" -D"USE_HDF5=OFF" -D"BUILD_UTILITIES=ON"

View File

@ -78,6 +78,8 @@ typedef unsigned char _Bool;
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_INTTYPES_H #ifdef HAVE_INTTYPES_H
#include <inttypes.h> #include <inttypes.h>
#elif defined(_MSC_VER)
#include <stdint.h>
#else /* HAVE_INTTYPES_H */ #else /* HAVE_INTTYPES_H */
#include <pstdint.h> #include <pstdint.h>
#endif /* HAVE_INTTYPES_H */ #endif /* HAVE_INTTYPES_H */

View File

@ -4,6 +4,10 @@
* $Header$ * $Header$
*********************************************************************/ *********************************************************************/
#ifdef _MSC_VER
#include<io.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>

View File

@ -2,11 +2,14 @@ SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(".") INCLUDE_DIRECTORIES(".")
# Process these files with m4.
SET(m4_SOURCES attr ncx putget t_ncxx) IF(NOT MSVC)
foreach (f ${m4_SOURCES}) # Process these files with m4.
GEN_m4(${f}) SET(m4_SOURCES attr ncx putget t_ncxx)
endforeach(f) foreach (f ${m4_SOURCES})
GEN_m4(${f})
endforeach(f)
ENDIF()
SET(libsrc_SOURCES v1hpg.c nclistmgr.c putget.c attr.c nc3dispatch.c nc.c var.c dim.c ncx.c lookup3.c ncio.c) SET(libsrc_SOURCES v1hpg.c nclistmgr.c putget.c attr.c nc3dispatch.c nc.c var.c dim.c ncx.c lookup3.c ncio.c)

View File

@ -11,7 +11,7 @@
#ifdef HAVE_GETOPT_H #ifdef HAVE_GETOPT_H
#include <getopt.h> #include <getopt.h>
#endif #endif
#ifndef _WIN32 #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <string.h> #include <string.h>

View File

@ -57,6 +57,6 @@ EXTERNC List* listclone(List*);
#define listclear(l) listsetlength((l),0) #define listclear(l) listsetlength((l),0)
#define listextend(l,len) listsetalloc((l),(len)+(l->alloc)) #define listextend(l,len) listsetalloc((l),(len)+(l->alloc))
#define listcontents(l) ((l)==NULL?NULL:(l)->content) #define listcontents(l) ((l)==NULL?NULL:(l)->content)
#define listlength(l) ((l)==NULL?0:(l)->length) #define listlength(l) ((l)==NULL?0:(int)(l)->length)
#endif /*LIST_H*/ #endif /*LIST_H*/