diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindHDF5.cmake | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 94a8729..b10e313 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -518,28 +518,26 @@ if(NOT HDF5_FOUND) ) set(HDF5_${__lang}_LIBRARIES) - set(_HDF5_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - if(HDF5_USE_STATIC_LIBRARIES) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES) + set(_HDF5_SEARCH_NAMES_LOCAL) if(x"${L}" MATCHES "hdf5") # hdf5 library set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) + if(UNIX AND HDF5_USE_STATIC_LIBRARIES) + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) + endif() else() # external library set(_HDF5_SEARCH_OPTS_LOCAL) endif() find_library(HDF5_${__lang}_LIBRARY_${L} - NAMES ${L} + NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR HINTS ${HDF5_${__lang}_LIBRARY_DIRS} ${HDF5_ROOT} ${_HDF5_SEARCH_OPTS_LOCAL} ) unset(_HDF5_SEARCH_OPTS_LOCAL) + unset(_HDF5_SEARCH_NAMES_LOCAL) if(HDF5_${__lang}_LIBRARY_${L}) list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) else() @@ -549,20 +547,25 @@ if(NOT HDF5_FOUND) if(FIND_HL) set(HDF5_${__lang}_HL_LIBRARIES) foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) + set(_HDF5_SEARCH_NAMES_LOCAL) if("x${L}" MATCHES "hdf5") # hdf5 library set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) + if(UNIX AND HDF5_USE_STATIC_LIBRARIES) + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) + endif() else() # external library set(_HDF5_SEARCH_OPTS_LOCAL) endif() find_library(HDF5_${__lang}_LIBRARY_${L} - NAMES ${L} + NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR HINTS ${HDF5_${__lang}_LIBRARY_DIRS} ${HDF5_ROOT} ${_HDF5_SEARCH_OPTS_LOCAL} ) unset(_HDF5_SEARCH_OPTS_LOCAL) + unset(_HDF5_SEARCH_NAMES_LOCAL) if(HDF5_${__lang}_LIBRARY_${L}) list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) else() @@ -572,8 +575,6 @@ if(NOT HDF5_FOUND) set(HDF5_HL_FOUND True) endif() - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_HDF5_CMAKE_FIND_LIBRARY_SUFFIXES}) - set(HDF5_${__lang}_FOUND True) mark_as_advanced(HDF5_${__lang}_DEFINITIONS) mark_as_advanced(HDF5_${__lang}_INCLUDE_DIRS) |