Use HDF5_FOUND to control autoconf and CMake built FindHDF5.
This commit is contained in:
parent
2ba826e060
commit
4e12284424
|
@ -180,30 +180,29 @@ macro( _HDF5_parse_compile_line
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Try to find HDF5 using an installed hdf5-config.cmake
|
# Try to find HDF5 using an installed hdf5-config.cmake
|
||||||
find_package( HDF5 QUIET NO_MODULE )
|
if( NOT HDF5_FOUND )
|
||||||
if( HDF5_INCLUDE_DIR )
|
find_package( HDF5 QUIET NO_MODULE )
|
||||||
set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} )
|
if( HDF5_FOUND )
|
||||||
set( HDF5_LIBRARIES )
|
set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} )
|
||||||
set( HDF5_C_TARGET hdf5 )
|
set( HDF5_LIBRARIES )
|
||||||
set( HDF5_CXX_TARGET hdf5_cpp )
|
set( HDF5_C_TARGET hdf5 )
|
||||||
set( HDF5_HL_TARGET hdf5_hl )
|
set( HDF5_CXX_TARGET hdf5_cpp )
|
||||||
set( HDF5_Fortran_TARGET hdf5_fortran )
|
set( HDF5_HL_TARGET hdf5_hl )
|
||||||
foreach( _component ${HDF5_LANGUAGE_BINDINGS} )
|
set( HDF5_Fortran_TARGET hdf5_fortran )
|
||||||
list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location )
|
foreach( _component ${HDF5_LANGUAGE_BINDINGS} )
|
||||||
get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION )
|
list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location )
|
||||||
if( _comp_location )
|
get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION )
|
||||||
set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH
|
if( _comp_location )
|
||||||
"HDF5 ${_component} library" )
|
set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH
|
||||||
mark_as_advanced( HDF5_${_component}_LIBRARY )
|
"HDF5 ${_component} library" )
|
||||||
list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} )
|
mark_as_advanced( HDF5_${_component}_LIBRARY )
|
||||||
endif()
|
list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} )
|
||||||
endforeach()
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( HDF5_INCLUDE_DIRS AND HDF5_LIBRARIES )
|
if( NOT HDF5_FOUND )
|
||||||
# Do nothing: we already have HDF5_INCLUDE_PATH and HDF5_LIBRARIES in the
|
|
||||||
# cache, it would be a shame to override them
|
|
||||||
else()
|
|
||||||
_HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE )
|
_HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE )
|
||||||
_HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE )
|
_HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE )
|
||||||
_HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE )
|
_HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE )
|
||||||
|
@ -259,9 +258,7 @@ else()
|
||||||
${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
|
${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
|
||||||
|
|
||||||
# find the HDF5 libraries
|
# find the HDF5 libraries
|
||||||
message( STATUS "FindHDF5 -- search for ${LANGUAGE}" )
|
|
||||||
foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
|
foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
|
||||||
message( STATUS "FindHDF5 -- Searching for ${LIB}" )
|
|
||||||
if( UNIX AND HDF5_USE_STATIC_LIBRARIES )
|
if( UNIX AND HDF5_USE_STATIC_LIBRARIES )
|
||||||
# According to bug 1643 on the CMake bug tracker, this is the
|
# According to bug 1643 on the CMake bug tracker, this is the
|
||||||
# preferred method for searching for a static library.
|
# preferred method for searching for a static library.
|
||||||
|
@ -358,16 +355,18 @@ find_package_handle_standard_args( HDF5 DEFAULT_MSG
|
||||||
HDF5_INCLUDE_DIRS
|
HDF5_INCLUDE_DIRS
|
||||||
)
|
)
|
||||||
|
|
||||||
mark_as_advanced(
|
if( HDF5_FOUND )
|
||||||
HDF5_INCLUDE_DIRS
|
mark_as_advanced(
|
||||||
HDF5_LIBRARIES
|
HDF5_INCLUDE_DIRS
|
||||||
HDF5_DEFINTIONS
|
HDF5_LIBRARIES
|
||||||
HDF5_LIBRARY_DIRS
|
HDF5_DEFINTIONS
|
||||||
HDF5_C_COMPILER_EXECUTABLE
|
HDF5_LIBRARY_DIRS
|
||||||
HDF5_CXX_COMPILER_EXECUTABLE
|
HDF5_C_COMPILER_EXECUTABLE
|
||||||
HDF5_Fortran_COMPILER_EXECUTABLE )
|
HDF5_CXX_COMPILER_EXECUTABLE
|
||||||
|
HDF5_Fortran_COMPILER_EXECUTABLE )
|
||||||
|
|
||||||
# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
|
# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
|
||||||
# HDF5_INCLUDE_DIRS
|
# HDF5_INCLUDE_DIRS
|
||||||
set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
|
set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue