mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
remove old export functionality, move new in place
This commit is contained in:
parent
cf87b409fe
commit
d2ee2dff31
@ -1198,23 +1198,44 @@ CONFIGURE_FILE(
|
||||
|
||||
# Create CMake package configuration files. With these, other packages using
|
||||
# cmake should be able to find netcdf using find_package and find_library.
|
||||
# This call is paired with one in liblib.
|
||||
install(EXPORT netcdf-targets
|
||||
DESTINATION share/cmake
|
||||
COMPONENT documentation)
|
||||
# The EXPORT call is paired with one in liblib.
|
||||
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/netCDF)
|
||||
install(EXPORT netCDFTargets
|
||||
DESTINATION ${ConfigPackageLocation}
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${netCDF_SOURCE_DIR}/netcdf-config.cmake.in
|
||||
${netCDF_BINARY_DIR}/netcdf-config.cmake @ONLY)
|
||||
include(CMakePackageConfigHelpers)
|
||||
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(
|
||||
${netCDF_SOURCE_DIR}/netcdf-config-version.cmake.in
|
||||
${netCDF_BINARY_DIR}/netcdf-config-version.cmake @ONLY)
|
||||
INSTALL(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/netCDFConfig.cmake"
|
||||
DESTINATION "${ConfigPackageLocation}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(FILES ${netCDF_BINARY_DIR}/netcdf-config.cmake
|
||||
${netCDF_BINARY_DIR}/netcdf-config-version.cmake
|
||||
DESTINATION share/cmake/netcdf)
|
||||
# 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
|
||||
)
|
||||
|
||||
###
|
||||
# Create pkgconfig files.
|
||||
@ -1392,19 +1413,6 @@ 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)
|
||||
@ -1422,26 +1430,6 @@ 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.
|
||||
#####
|
||||
|
@ -90,9 +90,14 @@ SET_TARGET_PROPERTIES(netcdf PROPERTIES
|
||||
)
|
||||
|
||||
INSTALL(
|
||||
TARGETS netcdf EXPORT netcdf-targets RUNTIME DESTINATION bin COMPONENT libraries
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
TARGETS netcdf EXPORT netCDFTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
COMPONENT libraries
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
COMPONENT libraries
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT libraries
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)
|
||||
|
@ -9,6 +9,8 @@ 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@")
|
||||
|
||||
set(netcdf_LIBRARIES "netcdf")
|
||||
|
||||
# Compiling Options
|
||||
#
|
||||
set(netCDF_C_COMPILER @CC_VERSION@)
|
||||
|
@ -1,10 +0,0 @@
|
||||
# Cmake Package & Configuration file support.
|
||||
# Based on code from 'Mastering Cmake'
|
||||
|
||||
set (PACKAGE_VERSION "@VERSION@")
|
||||
if (NOT "${PACKAGE_FIND_VERSION}" VERSION_GREATER "@VERSION@")
|
||||
set (PACKAGE_VERSION_COMPATIBLE 1) # Compatible with older.
|
||||
if ("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "@VERSION@")
|
||||
set(PACKAGE_VERSION_EXACT 1) # exact match for this version.
|
||||
endif()
|
||||
endif()
|
@ -1,15 +0,0 @@
|
||||
# Cmake Package & Configuration file support.
|
||||
# Based on code from 'Mastering Cmake'
|
||||
|
||||
# Compute installation prefix relative to this file.
|
||||
get_filename_component (_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component (_prefix "${_dir}/../.." ABSOLUTE)
|
||||
|
||||
# Import the targets
|
||||
include ("${_prefix}/share/cmake/netcdf-targets.cmake")
|
||||
|
||||
# Report other information
|
||||
set (netcdf_INCLUDE_DIRS "${_prefix}/include/")
|
||||
|
||||
set (netcdf_LIBRARIES "netcdf")
|
||||
|
Loading…
Reference in New Issue
Block a user