mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-12 15:45:21 +08:00
o Additional work with CMake
o Added config.h for CMake
This commit is contained in:
parent
a5991834f4
commit
381529f81e
123
CMakeLists.txt
123
CMakeLists.txt
@ -2,13 +2,85 @@
|
||||
cmake_minimum_required(VERSION 2.8.6)
|
||||
|
||||
#Project Name
|
||||
project(netCDF 4.2)
|
||||
project(NETCDF C)
|
||||
ADD_DEFINITIONS()
|
||||
|
||||
#Add custom CMake Modules
|
||||
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
|
||||
CACHE INTERNAL "Location of our custom CMake modules.")
|
||||
|
||||
# Configure type checks
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
|
||||
|
||||
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
INCLUDE_DIRECTORIES(${NETCDF_SOURCE_DIR}/include)
|
||||
|
||||
# Option to Build DLL
|
||||
OPTION (DLL_NETCDF "Build a Windows DLL." OFF)
|
||||
|
||||
# Option to Build DAP Client
|
||||
OPTION (ENABLE_DAP "Enable DAP Client." OFF)
|
||||
|
||||
# Option to Enable HDF4
|
||||
OPTION (USE_HDF4 "Use HDF4." OFF)
|
||||
IF (USE_HDF4)
|
||||
FIND_PACKAGE(HDF4)
|
||||
ENDIF (USE_HDF4)
|
||||
|
||||
# Packages to include
|
||||
|
||||
FIND_PACKAGE (CURL)
|
||||
FIND_PACKAGE (HDF5)
|
||||
FIND_PACKAGE (ZLIB)
|
||||
|
||||
## Beging autotools-style checks for config.h
|
||||
|
||||
CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA_H)
|
||||
CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H)
|
||||
CHECK_INCLUDE_FILE("dirent.h" HAVE_DIRENT_H)
|
||||
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
|
||||
CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
|
||||
CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
|
||||
CHECK_INCLUDE_FILE("getopt.h" HAVE_GETOPT_H)
|
||||
CHECK_INCLUDE_FILE("hdf5.h" HAVE_HDF5_H)
|
||||
CHECK_INCLUDE_FILE("locale.h" HAVE_LOCAL_H)
|
||||
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
||||
CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
|
||||
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
|
||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE("sys/dir.h" HAVE_SYS_DIR_H)
|
||||
CHECK_INCLUDE_FILE("sys/ndir.h" HAVE_SYS_NDIR_H)
|
||||
CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
|
||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
|
||||
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE("sys/wait.h" HAVE_SYS_WAIT_H)
|
||||
|
||||
CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
|
||||
CHECK_TYPE_SIZE("float" SIZEOF_FLOAT)
|
||||
CHECK_TYPE_SIZE("int" SIZEOF_INT)
|
||||
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
|
||||
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
||||
CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T)
|
||||
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
|
||||
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
|
||||
CHECK_TYPE_SIZE("uchar" SIZEOF_UCHAR)
|
||||
|
||||
|
||||
|
||||
# Create config.h file
|
||||
configure_file("${NETCDF_SOURCE_DIR}/cmake_config.h.in"
|
||||
"${NETCDF_BINARY_DIR}/config.h")
|
||||
INCLUDE_DIRECTORIES(${NETCDF_BINARY_DIR})
|
||||
## End autotools-style checs for config.h
|
||||
|
||||
|
||||
OPTION (NETCDF_USE_FOLDERS "ENable folder grouping of projects in IDEs." ON)
|
||||
MARK_AS_ADVANCED (NETCDF_USE_FOLDERS)
|
||||
IF (NETCDF_USE_FOLDERS)
|
||||
SET_PROPERTY (GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
ENDIF (NETCDF_USE_FOLDERS)
|
||||
|
||||
#----
|
||||
# Set core names of the libraries.
|
||||
@ -18,26 +90,25 @@ SET (NETCDF_LIB_CORENAME "netcdf")
|
||||
#---
|
||||
# Set the true names of all the libraries, if customized by external project
|
||||
#---
|
||||
SET (NETCDF_LIB_NAME "${NETCDF_
|
||||
|
||||
# Recurse into other subdirectories.
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(h5_test)
|
||||
add_subdirectory(man4)
|
||||
add_subdirectory(man4/images)
|
||||
#add_subdirectory(include)
|
||||
#add_subdirectory(h5_test)
|
||||
#add_subdirectory(man4)
|
||||
#add_subdirectory(man4/images)
|
||||
add_subdirectory(libsrc)
|
||||
add_subdirectory(libsrc4)
|
||||
add_subdirectory(nc_test4)
|
||||
add_subdirectory(nc_test)
|
||||
add_subdirectory(ncdump)
|
||||
add_subdirectory(ncgen3)
|
||||
add_subdirectory(ncgen)
|
||||
add_subdirectory(examples)
|
||||
add_subdirectory(oc)
|
||||
add_subdirectory(libdap2)
|
||||
add_subdirectory(libcdmr)
|
||||
add_subdirectory(librpc)
|
||||
add_subdirectory(libdispatch)
|
||||
add_subdirectory(liblib)
|
||||
add_subdirectory(ncdump)
|
||||
add_subdirectory(ncdap_test)
|
||||
#add_subdirectory(libsrc4)
|
||||
#add_subdirectory(nc_test4)
|
||||
#add_subdirectory(nc_test)
|
||||
#add_subdirectory(ncdump)
|
||||
#add_subdirectory(ncgen3)
|
||||
#add_subdirectory(ncgen)
|
||||
#add_subdirectory(examples)
|
||||
#add_subdirectory(oc)
|
||||
#add_subdirectory(libdap2)
|
||||
#add_subdirectory(libcdmr)
|
||||
#add_subdirectory(librpc)
|
||||
#add_subdirectory(libdispatch)
|
||||
#add_subdirectory(liblib)
|
||||
#add_subdirectory(ncdump)
|
||||
#add_subdirectory(ncdap_test)
|
||||
|
89
cmake_config.h.in
Normal file
89
cmake_config.h.in
Normal file
@ -0,0 +1,89 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
/* Define to 1 if you have the <alloca.h> header file. */
|
||||
#cmakedefine HAVE_ALLOCA_H @HAVE_ALLOCA_H@
|
||||
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#cmakedefine HAVE_CTYPE_H @HAVE_CTYPE_H@
|
||||
|
||||
/* Define to 1 if you have the <dirent> header file. */
|
||||
#cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#cmakedefine HAVE_ERRNO_H @HAVE_ERRNO_H@
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#cmakedefine HAVE_FCNTL_H @HAVE_FCNTL_H@
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#cmakedefine HAVE_GETOPT_H @HAVE_GETOPT_H@
|
||||
|
||||
/* Define to 1 if you have the <hdf5.h> header file. */
|
||||
#cmakedefine HAVE_HDF5_H @HAVE_HDF5_H@
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#cmakedefine HAVE_LOCAL_H @HAVE_LOCAL_H@
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#cmakedefine HAVE_STDIO_H @HAVE_STDIO_H@
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file. */
|
||||
#cmakedefine HAVE_SYS_DIR_H @HAVE_SYS_DIR_H@
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file. */
|
||||
#cmakedefine HAVE_SYS_NDIR_H @HAVE_SYS_NDIR_H@
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#cmakedefine HAVE_SYS_PARAM_H @HAVE_SYS_PARAM_H@
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#cmakedefine HAVE_SYS_WAIT_H @HAVE_SYS_WAIT_H@
|
||||
|
||||
/* The size of `double` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_DOUBLE @SIZEOF_DOUBLE@
|
||||
/* The size of `float` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_FLOAT @SIZEOF_FLOAT@
|
||||
/* The size of `int` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_INT @SIZEOF_INT@
|
||||
/* The size of `long` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_LONG @SIZEOF_LONG@
|
||||
/* The size of `long long` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@
|
||||
/* The size of `off_t` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@
|
||||
/* The size of `short` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
|
||||
/* The size of `size_t` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
|
||||
/* The size of `uchar` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
|
||||
|
||||
|
||||
/* Set this when building a DLL under MinGW */
|
||||
#cmakedefine DLL_NETCDF
|
||||
/* Set this when DAP is enabled. */
|
||||
#cmakedefine ENABLE_DAP
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user