netcdf-c/liblib/CMakeLists.txt
Ward Fisher df9a54b689 o Fixed the SOVERSION for CMake-based builds.
o Updated autotools-based build to include files required for CMake-based 
builds.

o Updated Markdown-based documentation processed by Doxygen to include a
CMake FAQ.
2013-05-08 21:59:11 +00:00

83 lines
1.8 KiB
CMake

SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(".")
SET(liblib_LIBS dispatch netcdf3)
#####
# Add target objects/modules based on options.
#####
IF(USE_HDF5 OR USE_NETCDF4)
SET(liblib_LIBS ${liblib_LIBS} netcdf4)
ENDIF()
IF(USE_DAP)
SET(liblib_LIBS ${liblib_LIBS} oc2 dap2)
ENDIF()
IF(BUILD_CDMREMOTE)
SET(liblib_LIBS ${liblib_LIBS} cdmr)
ENDIF()
FOREACH(LIBS ${liblib_LIBS})
SET(LARGS ${LARGS} $<TARGET_OBJECTS:${LIBS}>)
ENDFOREACH()
ADD_LIBRARY(netcdf ${LIB_TYPE} stub.c ${LARGS} )
IF(MOD_NETCDF_NAME)
SET_TARGET_PROPERTIES(netcdf PROPERTIES LIBRARY_OUTPUT_NAME ${NETCDF_LIB_NAME})
SET_TARGET_PROPERTIES(netcdf PROPERTIES ARCHIVE_OUTPUT_NAME ${NETCDF_LIB_NAME})
SET_TARGET_PROPERTIES(netcdf PROPERTIES RUNTIME_OUTPUT_NAME ${NETCDF_LIB_NAME})
ENDIF()
#####
# Add dependencies required for linking.
#####
SET(TLL_LIBS "")
SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ${ZLIB_LIBRARY})
IF(USE_HDF5 OR USE_NETCDF4)
SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY})
ENDIF()
IF(USE_DAP)
SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES})
ENDIF()
IF(USE_HDF4)
SET(TLL_LIBS ${TLL_LIBS} ${HDF4_LIBRARIES})
ENDIF()
IF(ENABLE_PNETCDF AND PNETCDF)
SET(TLL_LIBS ${TLL_LIBS} ${PNETCDF})
ENDIF()
TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})
IF(MSVC)
SET_TARGET_PROPERTIES(netcdf PROPERTIES
LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
)
ENDIF()
IF(NOT MSVC)
IF(BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(netcdf PROPERTIES LINK_FLAGS -shared)
ENDIF()
ENDIF()
SET_TARGET_PROPERTIES(netcdf PROPERTIES
VERSION ${netCDF_VERSION}
SOVERSION ${netCDF_SO_VERSION})
INSTALL(TARGETS netcdf EXPORT netcdf-targets RUNTIME DESTINATION bin COMPONENT libraries
LIBRARY DESTINATION lib COMPONENT libraries
ARCHIVE DESTINATION lib COMPONENT libraries
)
SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)