Add code to generate an export library.

This commit is contained in:
Ward Fisher 2012-09-24 21:31:59 +00:00
parent 5259123089
commit dfed98c691
2 changed files with 18 additions and 7 deletions

View File

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 2.8.8) cmake_minimum_required(VERSION 2.8.8)
#Project Name #Project Name
project(NetCDF C) project(NetCDF C CXX)
SET(NetCDF_VERSION 4.2.1) SET(NetCDF_VERSION 4.2.1)
ENABLE_TESTING() ENABLE_TESTING()
INCLUDE(CTest) INCLUDE(CTest)
@ -18,6 +18,13 @@ SET (CTEST_DROP_LOCATION "/submit.php?project=WinNETCDF" CACHE STRING "")
SET (CTEST_DROP_SITE_CDASH TRUE CACHE BOOL "") SET (CTEST_DROP_SITE_CDASH TRUE CACHE BOOL "")
SET (CTEST_MEMORYCHECK_COMMAND valgrind CACHE STRING "") SET (CTEST_MEMORYCHECK_COMMAND valgrind CACHE STRING "")
# Set variable to define the build type.
INCLUDE(GenerateExportHeader)
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
SET(LIB_TYPE SHARED)
ENDIF()
ADD_DEFINITIONS() ADD_DEFINITIONS()
### Verbose make, for debugging. ### Verbose make, for debugging.
@ -490,6 +497,14 @@ IF(ENABLE_TESTS)
ENDIF() ENDIF()
# Code to generate an export header
GENERATE_EXPORT_HEADER(netcdf
BASE_NAME netcdf
EXPORT_MACRO_NAME netcdf_EXPORT
EXPORT_FILE_NAME netcdf_Export.h
STATIC_DEFINE netcdf_BUILT_AS_STATIC
)
##### #####
# Build doxygen documentation, if need be. # Build doxygen documentation, if need be.
##### #####

View File

@ -25,19 +25,16 @@ FOREACH(LIBS ${liblib_LIBS})
SET(LARGS ${LARGS} $<TARGET_OBJECTS:${LIBS}>) SET(LARGS ${LARGS} $<TARGET_OBJECTS:${LIBS}>)
ENDFOREACH() ENDFOREACH()
ADD_LIBRARY(netcdf stub.c ${LARGS} ) ADD_LIBRARY(netcdf ${LIB_TYPE} stub.c ${LARGS} )
##### #####
# Add dependencies required for linking. # Add dependencies required for linking.
##### #####
SET(TLL_LIBS ${HAVE_LIBM} ${ZLIB_LIBRARY}) SET(TLL_LIBS ${HAVE_LIBM} ${ZLIB_LIBRARY})
#TARGET_LINK_LIBRARIES(netcdf ${HAVE_LIBM})
#TARGET_LINK_LIBRARIES(netcdf ${MMATH})
IF(USE_DAP) IF(USE_DAP)
SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES}) SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES})
# TARGET_LINK_LIBRARIES(netcdf ${CURL_LIBRARIES})
ENDIF() ENDIF()
IF(USE_HDF5 OR USE_NETCDF4) IF(USE_HDF5 OR USE_NETCDF4)
@ -46,7 +43,6 @@ ENDIF()
IF(ENABLE_PNETCDF AND PNETCDF) IF(ENABLE_PNETCDF AND PNETCDF)
SET(TLL_LIBS ${TLL_LIBS} ${PNETCDF}) SET(TLL_LIBS ${TLL_LIBS} ${PNETCDF})
#TARGET_LINK_LIBRARIES(netcdf ${PNETCDF})
ENDIF() ENDIF()
TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS}) TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})