netcdf-c/liblib/CMakeLists.txt
Ward Fisher 9b3d24cbc0
2012-08-10 21:44:00 +00:00

56 lines
1.2 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 stub.c ${LARGS} )
#####
# Add dependencies required for linking.
#####
SET(TLL_LIBS ${HAVE_LIBM})
#TARGET_LINK_LIBRARIES(netcdf ${HAVE_LIBM})
#TARGET_LINK_LIBRARIES(netcdf ${MMATH})
IF(USE_DAP)
SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES})
# TARGET_LINK_LIBRARIES(netcdf ${CURL_LIBRARIES})
ENDIF()
IF(USE_HDF5 OR USE_NETCDF4)
#TARGET_LINK_LIBRARIES(netcdf ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARY} ${SZIP_LIBRARY} ${ZLIB_LIBRARY})
SET(TLL_LIBS ${TLL_LIBS} ${SZIP_LIBRARY} ${ZLIB_LIBRARY} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARY})
ENDIF()
IF(ENABLE_PNETCDF AND PNETCDF)
SET(TLL_LIBS ${TLL_LIBS} ${PNETCDF})
#TARGET_LINK_LIBRARIES(netcdf ${PNETCDF})
ENDIF()
TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})
INSTALL(TARGETS netcdf DESTINATION lib)
#include(CPack)
SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)