summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt39
-rw-r--r--src/H5api_adpt.h18
2 files changed, 43 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 11b37a5..eddc951 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -853,8 +853,8 @@ set_source_files_properties (${HDF5_BINARY_DIR}/H5version.h GENERATED)
set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5overflow.h)
set_source_files_properties (${HDF5_BINARY_DIR}/H5overflow.h GENERATED)
-add_library (${HDF5_LIB_TARGET} ${LIB_TYPE} ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS})
-TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} ${LIB_TYPE} " " " ")
+add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS})
+TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ")
target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS})
if (NOT WIN32)
target_link_libraries (${HDF5_LIB_TARGET} dl)
@@ -863,7 +863,7 @@ if (H5_HAVE_PARALLEL AND MPI_C_FOUND)
target_link_libraries (${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES})
endif (H5_HAVE_PARALLEL AND MPI_C_FOUND)
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
-H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} ${LIB_TYPE})
+H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC)
set_target_properties (${HDF5_LIB_TARGET} PROPERTIES
FOLDER libraries
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
@@ -876,6 +876,35 @@ if (HDF5_ENABLE_DEBUG_APIS)
"H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG"
)
endif (HDF5_ENABLE_DEBUG_APIS)
+set (install_targets ${HDF5_LIB_TARGET})
+
+if (BUILD_SHARED_LIBS)
+ add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS})
+ TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ")
+ target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS})
+ if (NOT WIN32)
+ target_link_libraries (${HDF5_LIBSH_TARGET} dl)
+ endif (NOT WIN32)
+ if (H5_HAVE_PARALLEL AND MPI_C_FOUND)
+ target_link_libraries (${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES})
+ endif (H5_HAVE_PARALLEL AND MPI_C_FOUND)
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED)
+ set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES
+ FOLDER libraries
+ COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB"
+ INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
+ )
+
+ if (HDF5_ENABLE_DEBUG_APIS)
+ set_property (TARGET ${HDF5_LIBSH_TARGET}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ "H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG"
+ )
+ endif (HDF5_ENABLE_DEBUG_APIS)
+ set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET})
+endif (BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
@@ -896,12 +925,12 @@ endif (NOT HDF5_INSTALL_NO_DEVELOPMENT)
#-----------------------------------------------------------------------------
if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
- INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries)
+ INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries)
endif (BUILD_SHARED_LIBS)
install (
TARGETS
- ${HDF5_LIB_TARGET}
+ ${install_targets}
EXPORT
${HDF5_EXPORTED_TARGETS}
LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries
diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h
index 74066f7..ab7287c 100644
--- a/src/H5api_adpt.h
+++ b/src/H5api_adpt.h
@@ -47,7 +47,7 @@
/* This will only be defined if HDF5 was built with CMake */
#ifdef H5_BUILT_AS_DYNAMIC_LIB
-#if defined(hdf5_EXPORTS)
+#if defined(hdf5_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5_DLL __declspec(dllexport)
#define H5_DLLVAR extern __declspec(dllexport)
@@ -70,7 +70,7 @@
#define H5_DLLVAR extern
#endif /* _HDF5DLL_ */
-#if defined(hdf5_test_EXPORTS)
+#if defined(hdf5_test_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5TEST_DLL __declspec(dllexport)
#define H5TEST_DLLVAR extern __declspec(dllexport)
@@ -93,7 +93,7 @@
#define H5TEST_DLLVAR extern
#endif /* H5TEST_DLL */
-#if defined(hdf5_tools_EXPORTS)
+#if defined(hdf5_tools_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5TOOLS_DLL __declspec(dllexport)
#define H5TOOLS_DLLVAR extern __declspec(dllexport)
@@ -116,7 +116,7 @@
#define H5TOOLS_DLLVAR extern
#endif /* H5TOOLS_DLL */
-#if defined(hdf5_cpp_EXPORTS)
+#if defined(hdf5_cpp_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5_DLLCPP __declspec(dllexport)
#define H5_DLLCPPVAR extern __declspec(dllexport)
@@ -139,7 +139,7 @@
#define H5_DLLCPPVAR extern
#endif /* H5_DLLCPP */
-#if defined(hdf5_hl_EXPORTS)
+#if defined(hdf5_hl_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5_HLDLL __declspec(dllexport)
#define H5_HLDLLVAR extern __declspec(dllexport)
@@ -162,7 +162,7 @@
#define H5_HLDLLVAR extern
#endif /* H5_HLDLL */
-#if defined(hdf5_hl_cpp_EXPORTS)
+#if defined(hdf5_hl_cpp_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5_HLCPPDLL __declspec(dllexport)
#define H5_HLCPPDLLVAR extern __declspec(dllexport)
@@ -185,7 +185,7 @@
#define H5_HLCPPDLLVAR extern
#endif /* H5_HLCPPDLL */
-#if defined(hdf5_f90cstub_EXPORTS)
+#if defined(hdf5_f90cstub_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5_FCDLL __declspec(dllexport)
#define H5_FCDLLVAR extern __declspec(dllexport)
@@ -208,7 +208,7 @@
#define H5_FCDLLVAR extern
#endif /* H5_FCDLL */
-#if defined(hdf5_test_f90cstub_EXPORTS)
+#if defined(hdf5_test_f90cstub_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5_FCTESTDLL __declspec(dllexport)
#define H5_FCTESTDLLVAR extern __declspec(dllexport)
@@ -231,7 +231,7 @@
#define H5_FCTESTDLLVAR extern
#endif /* H5_FCTESTDLL */
-#if defined(hdf5_hl_f90cstub_EXPORTS)
+#if defined(hdf5_hl_f90cstub_shared_EXPORTS)
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define HDF5_HL_F90CSTUBDLL __declspec(dllexport)
#define HDF5_HL_F90CSTUBDLLVAR extern __declspec(dllexport)