2012-07-18 05:44:41 +08:00
|
|
|
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
INCLUDE_DIRECTORIES(".")
|
|
|
|
|
2012-07-19 05:12:58 +08:00
|
|
|
SET(liblib_LIBS dispatch netcdf3)
|
2012-07-18 05:44:41 +08:00
|
|
|
|
2012-07-26 06:09:19 +08:00
|
|
|
#####
|
|
|
|
# Add target objects/modules based on options.
|
|
|
|
#####
|
|
|
|
|
2012-07-19 05:12:58 +08:00
|
|
|
IF(USE_HDF5 OR USE_NETCDF4)
|
|
|
|
SET(liblib_LIBS ${liblib_LIBS} netcdf4)
|
|
|
|
ENDIF()
|
2012-07-18 05:44:41 +08:00
|
|
|
|
2013-03-16 04:31:07 +08:00
|
|
|
IF(USE_PNETCDF)
|
|
|
|
SET(liblib_LIBS ${liblib_LIBS} netcdf5)
|
|
|
|
ENDIF()
|
|
|
|
|
2012-07-26 06:09:19 +08:00
|
|
|
IF(USE_DAP)
|
2012-08-04 06:24:29 +08:00
|
|
|
SET(liblib_LIBS ${liblib_LIBS} oc2 dap2)
|
2012-07-20 06:11:10 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2012-07-25 06:53:58 +08:00
|
|
|
IF(BUILD_CDMREMOTE)
|
|
|
|
SET(liblib_LIBS ${liblib_LIBS} cdmr)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
2012-07-19 05:12:58 +08:00
|
|
|
FOREACH(LIBS ${liblib_LIBS})
|
|
|
|
SET(LARGS ${LARGS} $<TARGET_OBJECTS:${LIBS}>)
|
|
|
|
ENDFOREACH()
|
|
|
|
|
2012-09-25 05:31:59 +08:00
|
|
|
ADD_LIBRARY(netcdf ${LIB_TYPE} stub.c ${LARGS} )
|
2012-11-01 06:17:33 +08:00
|
|
|
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})
|
2012-11-01 06:30:10 +08:00
|
|
|
SET_TARGET_PROPERTIES(netcdf PROPERTIES RUNTIME_OUTPUT_NAME ${NETCDF_LIB_NAME})
|
2012-11-01 06:17:33 +08:00
|
|
|
ENDIF()
|
2012-07-21 05:16:27 +08:00
|
|
|
|
2012-07-26 06:09:19 +08:00
|
|
|
#####
|
|
|
|
# Add dependencies required for linking.
|
|
|
|
#####
|
2013-02-13 06:22:54 +08:00
|
|
|
|
|
|
|
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()
|
2012-08-07 01:27:08 +08:00
|
|
|
|
2012-07-26 06:09:19 +08:00
|
|
|
IF(USE_DAP)
|
2012-08-11 05:44:00 +08:00
|
|
|
SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES})
|
2012-07-26 06:09:19 +08:00
|
|
|
ENDIF()
|
2012-07-21 05:16:27 +08:00
|
|
|
|
2013-01-16 06:43:09 +08:00
|
|
|
IF(USE_HDF4)
|
|
|
|
SET(TLL_LIBS ${TLL_LIBS} ${HDF4_LIBRARIES})
|
|
|
|
ENDIF()
|
|
|
|
|
2012-07-25 06:53:58 +08:00
|
|
|
|
2012-07-26 06:09:19 +08:00
|
|
|
IF(ENABLE_PNETCDF AND PNETCDF)
|
2012-08-11 05:44:00 +08:00
|
|
|
SET(TLL_LIBS ${TLL_LIBS} ${PNETCDF})
|
2012-07-25 06:53:58 +08:00
|
|
|
ENDIF()
|
2012-08-11 05:44:00 +08:00
|
|
|
TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})
|
2012-09-14 02:27:23 +08:00
|
|
|
|
|
|
|
IF(MSVC)
|
|
|
|
SET_TARGET_PROPERTIES(netcdf PROPERTIES
|
2012-10-25 03:49:31 +08:00
|
|
|
LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
2012-09-14 02:27:23 +08:00
|
|
|
)
|
|
|
|
ENDIF()
|
|
|
|
|
2012-10-03 06:56:12 +08:00
|
|
|
IF(NOT MSVC)
|
|
|
|
IF(BUILD_SHARED_LIBS)
|
2012-10-04 00:39:27 +08:00
|
|
|
SET_TARGET_PROPERTIES(netcdf PROPERTIES LINK_FLAGS -shared)
|
2012-10-03 06:56:12 +08:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2012-11-20 05:43:12 +08:00
|
|
|
SET_TARGET_PROPERTIES(netcdf PROPERTIES
|
2013-02-21 07:28:28 +08:00
|
|
|
VERSION ${netCDF_VERSION}
|
2013-05-09 05:59:11 +08:00
|
|
|
SOVERSION ${netCDF_SO_VERSION})
|
2012-11-20 05:43:12 +08:00
|
|
|
|
|
|
|
INSTALL(TARGETS netcdf EXPORT netcdf-targets RUNTIME DESTINATION bin COMPONENT libraries
|
|
|
|
LIBRARY DESTINATION lib COMPONENT libraries
|
|
|
|
ARCHIVE DESTINATION lib COMPONENT libraries
|
|
|
|
)
|
|
|
|
|
2012-08-11 05:44:00 +08:00
|
|
|
SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)
|
2013-06-04 00:42:04 +08:00
|
|
|
|
|
|
|
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)
|
|
|
|
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|