Added dummy function in case HDF5 is not found

This commit is contained in:
Guilhem Lavaux 2011-06-28 09:08:14 -04:00
parent 0eb308f1d0
commit f94e2912d4
2 changed files with 21 additions and 2 deletions

View File

@ -8,6 +8,7 @@ include(GetGitRevisionDescription)
get_git_head_revision(HEAD GIT_VER)
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
option(BUILD_STATIC_LIBS "Build static libraries." ON)
find_path(NETCDF_INCLUDE_PATH NAMES netcdf.h)
find_path(GSL_INCLUDE_PATH NAMES gsl/gsl_blas.h)

View File

@ -16,6 +16,10 @@ if (HDF5_FOUND)
h5_readFlash.cpp
loadFlash.cpp
)
else(HDF5_FOUND)
set(CosmoTool_SRCS ${CosmoTool_SRCS}
loadFlash_dummy.cpp
)
endif (HDF5_FOUND)
SET(CosmoTool_SRCS ${CosmoTool_SRCS}
@ -43,7 +47,6 @@ SET(CosmoTool_SRCS ${CosmoTool_SRCS}
)
include_directories(${GSL_INCLUDE_PATH} ${NETCDF_INCLUDE_PATH})
add_library(CosmoTool ${CosmoTool_SRCS})
set(CosmoTool_LIBS ${NETCDF_LIBRARY} ${NETCDFCPP_LIBRARY} ${GSL_LIBRARY} ${GSLCBLAS_LIBRARY})
if (HDF5_FOUND)
@ -51,12 +54,27 @@ if (HDF5_FOUND)
include_directories(${HDF5_INCLUDE_DIRS})
endif (HDF5_FOUND)
if (BUILD_SHARED_LIBS)
add_library(CosmoTool SHARED ${CosmoTool_SRCS})
target_link_libraries(CosmoTool ${CosmoTool_LIBS})
if (BUILD_STATIC_LIBS)
add_library(CosmoTool_static STATIC ${CosmoTool_SRCS})
endif(BUILD_STATIC_LIBS)
else (BUILD_SHARED_LIBS)
add_library(CosmoTool STATIC ${CosmoTool_LIBS})
endif (BUILD_SHARED_LIBS)
install(TARGETS CosmoTool
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
if (BUILD_SHARED_LIBS)
install(TARGETS CosmoTool_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif (BUILD_SHARED_LIBS)
install(DIRECTORY . DESTINATION include/CosmoTool
FILES_MATCHING PATTERN "*.hpp")
install(DIRECTORY . DESTINATION include/CosmoTool