From 6848ff4ce54bedd5d0ef909f2bc08ab99dc0a513 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Mon, 3 Jul 2017 01:40:41 +0100 Subject: FindHDF5: Define H5_BUILT_AS_DYNAMIC_LIB when using Windows DLLs When searching for shared libraries on Windows, add H5_BUILT_AS_DYNAMIC_LIB to HDF5_DEFINITIONS so that the header file knows how to dllimport the symbols. --- Modules/FindHDF5.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index acf7cd4..48d5de4 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -733,6 +733,9 @@ if( NOT HDF5_FOUND ) else() set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) + if(WIN32) + list(APPEND HDF5_DEFINITIONS "-DH5_BUILT_AS_DYNAMIC_LIB") + endif() endif() find_library(HDF5_${LIB}_LIBRARY_DEBUG NAMES ${THIS_LIBRARY_SEARCH_DEBUG} @@ -794,6 +797,7 @@ if( NOT HDF5_FOUND ) set(HDF5_HL_FOUND True) endif() + _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) -- cgit v0.12