summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindHDF5.cmake14
1 files changed, 11 insertions, 3 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index ae2c707..a85b9ac 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -436,8 +436,13 @@ if(NOT HDF5_FOUND)
if(HDF5_FIND_DEBUG)
message(STATUS "Trying to get properties of target ${HDF5_${_lang}_TARGET}${_suffix}")
endif()
- get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION)
-
+ # Find library for this target. Complicated as on Windows with a DLL, we need to search for the import-lib.
+ get_target_property(_imported_conf ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_CONFIGURATIONS)
+ get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_IMPLIB_${_imported_conf} )
+ if (NOT _lang_location)
+ # no import lib, just try LOCATION
+ get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION)
+ endif()
if( _lang_location )
set(HDF5_${_lang}_LIBRARY ${_lang_location})
list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
@@ -445,7 +450,10 @@ if(NOT HDF5_FOUND)
set(HDF5_${_lang}_FOUND True)
endif()
if(FIND_HL)
- get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION)
+ get_target_property(__lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_imported_conf} )
+ if (NOT _lang_hl_location)
+ get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION)
+ endif()
if( _lang_hl_location )
set(HDF5_${_lang}_HL_LIBRARY ${_lang_hl_location})
list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})