Skip to content

Commit

Permalink
Manually merging pull request #74 contributed by Nico Schlömer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ward Fisher committed Aug 20, 2014
1 parent b25dbcd commit 3cb78c5
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 14 deletions.
62 changes: 48 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ ENDIF()
STRING(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)

# Determine the configure date.
EXECUTE_PROCESS(COMMAND date
OUTPUT_VARIABLE CONFIG_DATE)
EXECUTE_PROCESS(
COMMAND date
OUTPUT_VARIABLE CONFIG_DATE
)
string(STRIP ${CONFIG_DATE} CONFIG_DATE)

################################
# End Project Properties
Expand Down Expand Up @@ -1200,17 +1203,17 @@ install(EXPORT netcdf-targets
DESTINATION share/cmake
COMPONENT documentation)

configure_file(
${netCDF_SOURCE_DIR}/netcdf-config.cmake.in
${netCDF_BINARY_DIR}/netcdf-config.cmake @ONLY)
#configure_file(
# ${netCDF_SOURCE_DIR}/netcdf-config.cmake.in
# ${netCDF_BINARY_DIR}/netcdf-config.cmake @ONLY)

configure_file(
${netCDF_SOURCE_DIR}/netcdf-config-version.cmake.in
${netCDF_BINARY_DIR}/netcdf-config-version.cmake @ONLY)
#configure_file(
# ${netCDF_SOURCE_DIR}/netcdf-config-version.cmake.in
# ${netCDF_BINARY_DIR}/netcdf-config-version.cmake @ONLY)

install(FILES ${netCDF_BINARY_DIR}/netcdf-config.cmake
${netCDF_BINARY_DIR}/netcdf-config-version.cmake
DESTINATION share/cmake/netcdf)
#install(FILES ${netCDF_BINARY_DIR}/netcdf-config.cmake
# ${netCDF_BINARY_DIR}/netcdf-config-version.cmake
# DESTINATION share/cmake/netcdf)


###
Expand All @@ -1225,7 +1228,7 @@ ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR)
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(exec_prefix ${CMAKE_INSTALL_PREFIX})
SET(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
SET(includedir ${CMAKE_INSTALL_PREFIX}/include)
SET(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
SET(CC ${CMAKE_C_COMPILER})

# Process all dependency libraries and create a string
Expand Down Expand Up @@ -1389,11 +1392,22 @@ is_enabled(USE_MMAP HAS_MMAP)
is_enabled(JNA HAS_JNA)

# Generate file from template.
include(CMakePackageConfigHelpers)
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/netCDF)
CONFIGURE_PACKAGE_CONFIG_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/netCDFConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/netCDFConfig.cmake"
INSTALL_DESTINATION "${ConfigPackageLocation}"
NO_CHECK_REQUIRED_COMPONENTS_MACRO
PATH_VARS
CMAKE_INSTALL_PREFIX
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_LIBDIR
)

CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libnetcdf.settings.in"
"${CMAKE_CURRENT_BINARY_DIR}/libnetcdf.settings"
@ONLY
)
@ONLY)

# Read in settings file, print out.
# Avoid using system-specific calls so that this
Expand All @@ -1408,6 +1422,26 @@ INSTALL(FILES "${netCDF_BINARY_DIR}/libnetcdf.settings"
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT libraries)

INSTALL(
FILES "${CMAKE_CURRENT_BINARY_DIR}/netCDFConfig.cmake"
DESTINATION "${ConfigPackageLocation}"
COMPONENT Devel
)

# Create export configuration
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/netCDF/netCDFConfigVersion.cmake"
VERSION ${netCDF_VERSION}
COMPATIBILITY SameMajorVersion
)

install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/netCDF/netCDFConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
COMPONENT Devel
)

#####
# End libnetcdf.settings section.
#####
Expand Down
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This file contains a high-level description of this package's evolution. Release

### 4.3.3-rc1 Released TBD

* Added `CMake`-based export files, contributed by Nico Schlömer. See https://github.com/Unidata/netcdf-c/pull/74.

* Fixed ncdump bug for char variables with multiple unlimited dimensions and added an associated test. Now the output CDL properly disambiguates dimension groupings, so that ncgen can generate the original file from the CDL. [NCF-310](https://bugtracking.unidata.ucar.edu/browse/NCF-310)

* Converted the [Manually-maintained FAQ page](http://www.unidata.ucar.edu/software/netcdf/docs/faq.html) into markdown and added it to the `docs/` directory. This way the html version will be generated when the rest of the documentation is built, the FAQ will be under version control, and it will be in a more visible location, hopefully making it easier to maintain.
Expand Down
36 changes: 36 additions & 0 deletions netCDFConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# NetCDF Configuration Summary
#
# General
#
@PACKAGE_INIT@

set(NetCDFVersion "@PACKAGE_VERSION@")
set_and_check(netCDF_INSTALL_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set_and_check(netCDF_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(netCDF_LIB_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

# Compiling Options
#
set(netCDF_C_COMPILER @CC_VERSION@)
set(netCDF_C_COMPILER_FLAGS @CFLAGS@)
set(netCDF_C_CPP_FLAGS @CPPFLAGS@)
set(netCDF_LDFLAGS @LDFLAGS@)
set(netCDF_AM_CFLAGS @AM_CFLAGS@)
set(netCDF_AM_CPPFLAGS @AM_CPPFLAGS@)
set(netCDF_AM_LDFLAGS @AM_LDFLAGS@)
set(netCDF_SHARED @enable_shared@)
set(netCDF_STATIC @enable_static@)
set(netCDF_EXTRA_LIBS @LIBS@)

# Features:
#
set(netCDF_HAS_NC2 @HAS_NC2@)
set(netCDF_HAS_NC4 @HAS_NC4@)
set(netCDF_HAS_HDF4 @HAS_HDF4@)
set(netCDF_HAS_HDF5 @HAS_HDF5@)
set(netCDF_HAS_PNETCDF @HAS_PNETCDF@)
set(netCDF_HAS_PARALLEL @HAS_PARALLEL@)
set(netCDF_HAS_DAP @HAS_DAP@)
set(netCDF_HAS_DISKLESS @HAS_DISKLESS@)
set(netCDF_HAS_MMAP @HAS_MMAP@)
set(netCDF_HAS_JNA @HAS_JNA@)

0 comments on commit 3cb78c5

Please sign in to comment.