Stopped tracking a cmake-specific pkgconfig template; using the same one as autotools. Tightened up cmake summary a little, now a pkg-config file is generated.

This commit is contained in:
Ward Fisher 2014-02-06 16:17:30 -07:00
parent 809aff04fe
commit 154c2a6edf
3 changed files with 52 additions and 14 deletions

View File

@ -299,7 +299,7 @@ MACRO(print_conf_summary)
ENDIF()
MESSAGE(STATUS "\tUsing pnetcdf:\t\t\t" ${STATUS_PNETCDF})
MESSAGE(STATUS "\tUsing Parallel IO:\t\t" ${STATUS_PARALLEL})
MESSAGE(STATUS "\tCMAKE_C_FLAGS:\t\t" ${CMAKE_C_FLAGS})
MESSAGE(STATUS "\tCMAKE_C_FLAGS:\t\t\t" ${CMAKE_C_FLAGS})
MESSAGE(STATUS "\tCMAKE_CXX_FLAGS:\t\t" ${CMAKE_CXX_FLAGS})
MESSAGE(STATUS "\tLinking against:\t\t" "${ALL_TLL_LIBS}")
@ -1069,6 +1069,56 @@ install (FILES ${netCDF_BINARY_DIR}/netcdf-config.cmake
${netCDF_BINARY_DIR}/netcdf-config-version.cmake
DESTINATION share/cmake)
###
# Create pkgconfig files.
###
IF(NOT DEFINED CMAKE_INSTALL_LIBDIR)
SET(CMAKE_INSTALL_LIBDIR lib)
ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR)
# Set
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(CC ${CMAKE_C_COMPILER})
SET(PACKAGE_VERSION ${VERSION})
# Process all dependency libraries and create a string
# used when parsing netcdf.pc.in
IF(NOT BUILD_SHARED_LIBS)
FOREACH(_LIB ${ALL_TLL_LIBS})
GET_FILENAME_COMPONENT(_LIB_NAME ${_LIB} NAME_WE)
STRING(REGEX REPLACE "^lib" "" _NAME ${_LIB_NAME})
LIST(APPEND NC_LIBS "-l${_NAME}")
GET_FILENAME_COMPONENT(_LIB_DIR ${_LIB} PATH)
LIST(APPEND LINKFLAGS "-L${_LIB_DIR}")
ENDFOREACH()
ENDIF(NOT BUILD_SHARED_LIBS)
SET(NC_LIBS "-lnetcdf ${NC_LIBS}")
STRING(REPLACE ";" " " NC_LIBS "${NC_LIBS}")
STRING(REPLACE ";" " " LINKFLAGS "${LINKFLAGS}")
LIST(REMOVE_DUPLICATES NC_LIBS)
LIST(REMOVE_DUPLICATES LINKFLAGS)
configure_file (
${netCDF_SOURCE_DIR}/netcdf.pc.in
${netCDF_BINARY_DIR}/netcdf.pc @ONLY)
install (FILES ${netCDF_BINARY_DIR}/netcdf.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
###
# End pkgconfig file creation.
###
####
# End CMake package configuration files.
#####
# Various options for CPACK

View File

@ -100,6 +100,7 @@ INSTALL(TARGETS netcdf EXPORT netcdf-targets RUNTIME DESTINATION bin COMPONENT l
)
SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)
SET(NC_LIBS ${NC_LIBS} PARENT_SCOPE)
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)

View File

@ -1,13 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
ccompiler=@CC@
Name: @PACKAGE@
Description: NetCDF Client Library for C
URL: http://www.unidata.ucar.edu/netcdf
Version: @PACKAGE_VERSION@
Libs: -L${libdir} @NC_LIBS@
Cflags: -I${includedir}