FindHDF5: Restore pre-3.6 behavior of finding only C by default

Refactoring in commit v3.6.0-rc1~72^2 (HDF5: Rework component searching
to correctly find HL for all bindings, 2016-05-12) changed the default
behavior from finding only the C bindings to finding everything for the
enabled languages.  Restore the original behavior for compatibility and
because many projects need only the C bindings.

Closes: #16397
This commit is contained in:
Brad King 2016-11-02 09:03:56 -04:00
parent c5dcd31e92
commit ff3ccc1f23
1 changed files with 2 additions and 10 deletions

View File

@ -111,18 +111,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
set(HDF5_VALID_LANGUAGE_BINDINGS C CXX Fortran)
# Validate the list of find components.
set(HDF5_LANGUAGE_BINDINGS)
if(NOT HDF5_FIND_COMPONENTS)
get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
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)
set(HDF5_LANGUAGE_BINDINGS "C")
else()
set(HDF5_LANGUAGE_BINDINGS)
# add the extra specified components, ensuring that they are valid.
set(FIND_HL OFF)
foreach(component IN LISTS HDF5_FIND_COMPONENTS)