Zhu Jinchan
Source: http://blog.csdn.net/clever101
Today to engage in NETCDF source code on the Windows compilation, toss a half-day, is made, specially record the process. My goal is to generate NETCDF project files. NETCDF relies on the three libraries of Hdf5, zlib, and curl.
First download the latest HDF5 source code in HDF5 source codes, and then use CMake to generate a solution for compiling hdf5, such as:
Then download NetCDF Source: NetCDF Downloads, start using CMake to generate NetCDF solutions, such as:
An error occurred after clicking the Configure button:
CMake Error at cmakelists.txt:525 (find_package):
Could not find a package configuration file provided by ' HDF5 ' with any of
thefollowing names:
Hdf5config.cmake
Hdf5-config.cmake
You need to configure the path of the Hdf5 CMake, as follows:
Then configure the zlib path, locate the Netcdf-4.4.0\cmake\modules\findzlib.cmake, and modify the
Find_path (Zlib_include_dir zlib.h
"e:\\thirdpartybuild\\zlib-1.2.8" # Specifies the path of the Zlib.h
PATHS
$ENV {Zlib_root}
Path_suffixes
Include
)
SET (zlib_names z ZLIB zdll zlib1 zlibdzlibd1)
Find_library (zlib_library
NAMES
${zlib_names}
PATHS
"E:\\thirdpartybuild\\zlib-1.2.8\\vs\\release" # Specifies the path to the zlib library file
$ENV {Zlib_root}
Path_suffixes
Lib
)
Remove netcdf-4.4.0\cmakelists.txt settings about the Curl library (why should I remove it?) Because I looked for half a day, did not find the CMake file to set the Curl Library), specifically
# IF (not curl_library)
# MESSAGE (fatal_error "DAP support specified, CURL libraries is notfound.")
# ENDIF ()
And
# add_subdirectory (liblib)
Commented out in two places.
Then click Configure and generate two buttons to generate the NETCDF project file. The resulting NetCDF.sln engineering netcdf3 and NETCDF4 are the project files that compile the NETCDF library.
NETCDF compilation of source code on Windows