FindHDF5: Properly fail when required components are not found.
This commit is contained in:
parent
87c1cd9c51
commit
4ece8bdd0f
|
@ -117,9 +117,11 @@ if(NOT HDF5_FIND_COMPONENTS)
|
|||
foreach(__lang IN LISTS __langs)
|
||||
if(__lang MATCHES "^(C|CXX|Fortran)$")
|
||||
list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang})
|
||||
set(HDF5_FIND_REQUIRED_${__lang} True)
|
||||
endif()
|
||||
endforeach()
|
||||
set(FIND_HL ON)
|
||||
set(HDF5_FIND_REQUIRED_HL True)
|
||||
else()
|
||||
# add the extra specified components, ensuring that they are valid.
|
||||
set(FIND_HL OFF)
|
||||
|
@ -132,6 +134,9 @@ else()
|
|||
elseif(component STREQUAL "Fortran_HL") # only for compatibility
|
||||
list(APPEND HDF5_LANGUAGE_BINDINGS Fortran)
|
||||
set(FIND_HL ON)
|
||||
set(HDF5_FIND_REQUIRED_Fortran_HL False)
|
||||
set(HDF5_FIND_REQUIRED_Fortran True)
|
||||
set(HDF5_FIND_REQUIRED_HL True)
|
||||
else()
|
||||
message(FATAL_ERROR "${component} is not a valid HDF5 component.")
|
||||
endif()
|
||||
|
@ -144,6 +149,7 @@ else()
|
|||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
list(REMOVE_ITEM HDF5_FIND_COMPONENTS Fortran_HL) # replaced by Fortran and HL
|
||||
list(REMOVE_DUPLICATES HDF5_LANGUAGE_BINDINGS)
|
||||
endif()
|
||||
|
||||
|
@ -410,6 +416,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
|||
mark_as_advanced(HDF5_${_lang}_LIBRARY)
|
||||
list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_LIBRARY})
|
||||
set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_LIBRARY})
|
||||
set(HDF5_${_lang}_FOUND True)
|
||||
endif()
|
||||
if(FIND_HL)
|
||||
get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION)
|
||||
|
@ -419,6 +426,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
|||
mark_as_advanced(HDF5_${_lang}_HL_LIBRARY)
|
||||
list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARY})
|
||||
set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARY})
|
||||
set(HDF5_HL_FOUND True)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
@ -461,6 +469,9 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
|||
mark_as_advanced(HDF5_${__lang}_INCLUDE_DIRS)
|
||||
mark_as_advanced(HDF5_${__lang}_LIBRARIES)
|
||||
mark_as_advanced(HDF5_${__lang}_HL_LIBRARIES)
|
||||
|
||||
set(HDF5_${__lang}_FOUND True)
|
||||
set(HDF5_HL_FOUND True)
|
||||
else()
|
||||
set(HDF5_COMPILER_NO_INTERROGATE False)
|
||||
# If this language isn't using the wrapper, then try to seed the
|
||||
|
@ -513,6 +524,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
|||
list(APPEND HDF5_${__lang}_HL_LIBRARIES ${L})
|
||||
endif()
|
||||
endforeach()
|
||||
set(HDF5_HL_FOUND True)
|
||||
endif()
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_HDF5_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
@ -646,7 +658,10 @@ if( NOT HDF5_FOUND )
|
|||
)
|
||||
select_library_configurations( HDF5_${LIB} )
|
||||
list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
|
||||
eNdforeach()
|
||||
endforeach()
|
||||
if(HDF5_${__lang}_LIBRARIES)
|
||||
set(HDF5_${__lang}_FOUND True)
|
||||
endif()
|
||||
|
||||
# Append the libraries for this language binding to the list of all
|
||||
# required libraries.
|
||||
|
@ -687,6 +702,9 @@ if( NOT HDF5_FOUND )
|
|||
list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES})
|
||||
endif()
|
||||
endforeach()
|
||||
if(FIND_HL AND HDF5_HL_LIBRARIES)
|
||||
set(HDF5_HL_FOUND True)
|
||||
endif()
|
||||
|
||||
_HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS)
|
||||
_HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES)
|
||||
|
@ -746,4 +764,5 @@ endif()
|
|||
find_package_handle_standard_args(HDF5
|
||||
REQUIRED_VARS ${HDF5_REQUIRED_VARS}
|
||||
VERSION_VAR HDF5_VERSION
|
||||
HANDLE_COMPONENTS
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue