Skip to content

Commit

Permalink
Stopped tracking a cmake-specific pkgconfig template; using the same …
Browse files Browse the repository at this point in the history
…one as autotools. Tightened up cmake summary a little, now a pkg-config file is generated.
  • Loading branch information
Ward Fisher committed Feb 6, 2014
1 parent 809aff0 commit 154c2a6
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 14 deletions.
52 changes: 51 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions liblib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 0 additions & 13 deletions netcdf.pc.cmake.in

This file was deleted.

0 comments on commit 154c2a6

Please sign in to comment.