netcdf-c/liblib/CMakeLists.txt

90 lines
2.1 KiB
CMake
Raw Normal View History

SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(".")
SET(liblib_LIBS dispatch netcdf3)
2012-07-26 06:09:19 +08:00
#####
# Add target objects/modules based on options.
#####
IF(USE_HDF5 OR USE_NETCDF4)
SET(liblib_LIBS ${liblib_LIBS} netcdf4)
ENDIF()
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()
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()
2012-07-21 05:16:27 +08:00
2012-07-26 06:09:19 +08:00
#####
# 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()
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
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)
SET_TARGET_PROPERTIES(netcdf PROPERTIES LINK_FLAGS -shared)
2012-10-03 06:56:12 +08:00
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
)
2012-08-11 05:44:00 +08:00
SET(ALL_TLL_LIBS ${TLL_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)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")