mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
Added TOC, FAQ to CMake instructions document.
This commit is contained in:
parent
55eed7ffa1
commit
e6e8bba26a
@ -1,13 +1,25 @@
|
||||
\page netCDF-CMake Build Instructions for netCDF-C using CMake
|
||||
|
||||
# Overview
|
||||
# Table of Contents
|
||||
|
||||
* [Overview](#overview)
|
||||
* [Requirements](#requirements)
|
||||
* [Build Process](#buildprocess)
|
||||
* [Building](#building)
|
||||
* [Testing](#testing)
|
||||
* [FAQ](#FAQ)
|
||||
|
||||
|
||||
|
||||
|
||||
# <a id="overview"></a>Overview
|
||||
|
||||
Starting with netCDF-C 4.3.0, we are happy to announce the inclusion of CMake support. CMake will allow for building netCDF on a wider range of platforms, include Microsoft Windows with Visual Studio. CMake support also provides robust unit and regression testing tools. We will also maintain the standard autotools-based build system in parallel.
|
||||
|
||||
In addition to providing new build options for netCDF-C, we will also provide pre-built binary downloads for the shared versions of netCDF for use with Visual Studio.
|
||||
|
||||
|
||||
# Requirements
|
||||
# <a id="requirements"></a> Requirements
|
||||
The following packages are required to build netCDF-C using CMake.
|
||||
|
||||
* netCDF-C Source Code
|
||||
@ -20,7 +32,7 @@ The following packages are required to build netCDF-C using CMake.
|
||||
<img src="deptree.jpg" height="250px" />
|
||||
</center>
|
||||
|
||||
# The CMake Build Process
|
||||
# <a id="buildprocess"></a>The CMake Build Process
|
||||
|
||||
There are four steps in the Build Process when using CMake
|
||||
|
||||
@ -31,7 +43,7 @@ There are four steps in the Build Process when using CMake
|
||||
|
||||
For users who prefer pre-built binaries, installation packages are available at \ref winbin
|
||||
|
||||
## Configuration
|
||||
## <a id="configuration"></a>Configuration
|
||||
|
||||
The output of the configuration step is a project file based on the appropriate configurator specified. Common configurators include:
|
||||
|
||||
@ -66,7 +78,7 @@ If you have libraries installed in a custom directory, you may need to specify t
|
||||
|
||||
|
||||
|
||||
## Building
|
||||
## <a id="building"></a>Building
|
||||
|
||||
The compiler can be executed directly with 'make' or the appropriate command for the configurator which was used.
|
||||
|
||||
@ -78,7 +90,7 @@ Building can also be executed indirectly via cmake:
|
||||
|
||||
|
||||
|
||||
## Testing
|
||||
## <a id="testing"></a>Testing
|
||||
|
||||
Testing can be executed several different ways:
|
||||
|
||||
@ -92,7 +104,7 @@ or
|
||||
|
||||
> \> cmake --build [Build Directory] --target test
|
||||
|
||||
## Installation
|
||||
## <a id="installation"></a>Installation
|
||||
|
||||
Once netCDF has been built and tested, it may be installed using the following commands:
|
||||
|
||||
@ -102,18 +114,37 @@ or
|
||||
|
||||
> \> cmake --build [Build Directory] --target install
|
||||
|
||||
# CMake Frequently Asked Questions (FAQ)
|
||||
# <a id="FAQ"></a> CMake Frequently Asked Questions (FAQ)
|
||||
|
||||
* **How do I specify how to build a shared or static library?**
|
||||
## <a id="faqtoc"></a> Table of Contents
|
||||
|
||||
* [How do I specify how to build a shared or static library?](#sharedstatic)
|
||||
* [Can I build both shared and static libraries at the same time with cmake?](#sharedstaticboth)
|
||||
* [What if I want to link against multiple libraries in a non-standard location?](#nonstdloc)
|
||||
* [How can I see the options available to CMake?](#listoptions)
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
* **How do I specify how to build a shared or static library?** <a id="sharedstatic"></a>
|
||||
|
||||
-DBUILD_SHARED_LIBS=[ON/OFF]
|
||||
|
||||
* **Can I build both shared and static libraries at the same time?**
|
||||
|
||||
[Back to the top of FAQ](#faqtoc)
|
||||
|
||||
Not at this time; it is required to instead build first one version, and then the other, if you need both.
|
||||
|
||||
|
||||
* **How can I specify linking against a particular library?**
|
||||
--
|
||||
|
||||
* **Can I build both shared and static libraries at the same time with cmake?** <a id="sharedstaticboth"></a>
|
||||
|
||||
Not at this time; it is required to instead build first one version, and then the other, if you need both.
|
||||
|
||||
|
||||
[Back to the top of FAQ](#faqtoc)
|
||||
|
||||
--
|
||||
|
||||
|
||||
* **How can I specify linking against a particular library?** <a id="partlib"></a>
|
||||
|
||||
It depends on the library. To specify a custom ZLib, for example, you would do the following:
|
||||
-DZLIB_LIBRARY=/path/to/my/zlib.lib
|
||||
@ -126,8 +157,13 @@ or
|
||||
|
||||
Alternatively, you may specify
|
||||
* -DHDF5_LIBRARIES="/path/to/hdf5.lib;/path/to/hdf5_hl.lib" -DHDF5_INCLUDE_DIRS=/path/to/hdf5/include/
|
||||
|
||||
|
||||
[Back to the top of FAQ](#faqtoc)
|
||||
|
||||
--
|
||||
|
||||
* **What if I want to link against multiple libraries in a non-standard location?**
|
||||
* **What if I want to link against multiple libraries in a non-standard location?**<a id="nonstdloc"></a>
|
||||
|
||||
You can specify the path to search when looking for dependencies and header files using the CMAKE_PREFIX_PATH variable:
|
||||
|
||||
@ -135,23 +171,14 @@ or
|
||||
or
|
||||
> cmake [Source Directory] -DCMAKE_PREFIX_PATH=/usr/custom_library_locations/
|
||||
|
||||
|
||||
* **How can I see the options available to CMake?**
|
||||
[Back to the top of FAQ](#faqtoc)
|
||||
|
||||
--
|
||||
|
||||
* **How can I see the options available to CMake?** <a id="listoptions"></a>
|
||||
|
||||
|
||||
> cmake [path to source tree] -L - This will show the basic options.
|
||||
> cmake [path to source tree] -LA - This will show the basic and advanced options.
|
||||
|
||||
|
||||
# Errata
|
||||
|
||||
## netCDF 4.3.1-rc1
|
||||
|
||||
## netCDF 4.3.0
|
||||
|
||||
* When netCDF 4.3.0 was originally released, the file `nc-config.in.cmake` was accidentally excluded. This file can be downloaded [here]. The file should be placed in the root of the netcdf source directory.
|
||||
|
||||
[here]: https://www.unidata.ucar.edu/software/netcdf/win_netcdf/nc-config.in.cmake "nc-config.in.cmake"
|
||||
|
||||
* When building shared libraries via CMake on Unix/Linux, the resulting files have the soversion 4.3.0. This is a mistake, the soversion should be 7.2.0. This can be rectified post-install by creating a symbolic link from libnetcdf.4.3.0.so to libnetcdf.7.2.0.so. This would be accomplished thusly:
|
||||
|
||||
> $ sudo ln -s /usr/local/lib/libnetcdf.4.3.0.so /usr/local/lib/libnetcdf.7.2.0.so
|
||||
[Back to the top of FAQ](#faqtoc)
|
||||
|
Loading…
Reference in New Issue
Block a user