diff options
author | Will Dicharry <wdicharry@stellarscience.com> | 2011-05-24 21:27:30 (GMT) |
---|---|---|
committer | Will Dicharry <wdicharry@stellarscience.com> | 2011-05-25 18:34:21 (GMT) |
commit | 4e1228442429c526c451426cdf75c3ae08581103 (patch) | |
tree | cfa5cad4efd727b57b2c5530c0f90c86c1ea0711 /Modules/FindHDF5.cmake | |
parent | 2ba826e0600902b01750d345e2f51dd3ab0a9c4a (diff) | |
download | CMake-4e1228442429c526c451426cdf75c3ae08581103.zip CMake-4e1228442429c526c451426cdf75c3ae08581103.tar.gz CMake-4e1228442429c526c451426cdf75c3ae08581103.tar.bz2 |
Use HDF5_FOUND to control autoconf and CMake built FindHDF5.
Diffstat (limited to 'Modules/FindHDF5.cmake')
-rw-r--r-- | Modules/FindHDF5.cmake | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 3c96720..1b41ae6 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -180,30 +180,29 @@ macro( _HDF5_parse_compile_line endmacro() # Try to find HDF5 using an installed hdf5-config.cmake -find_package( HDF5 QUIET NO_MODULE ) -if( HDF5_INCLUDE_DIR ) - set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} ) - set( HDF5_LIBRARIES ) - set( HDF5_C_TARGET hdf5 ) - set( HDF5_CXX_TARGET hdf5_cpp ) - set( HDF5_HL_TARGET hdf5_hl ) - set( HDF5_Fortran_TARGET hdf5_fortran ) - foreach( _component ${HDF5_LANGUAGE_BINDINGS} ) - list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location ) - get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION ) - if( _comp_location ) - set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH - "HDF5 ${_component} library" ) - mark_as_advanced( HDF5_${_component}_LIBRARY ) - list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} ) - endif() - endforeach() +if( NOT HDF5_FOUND ) + find_package( HDF5 QUIET NO_MODULE ) + if( HDF5_FOUND ) + set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} ) + set( HDF5_LIBRARIES ) + set( HDF5_C_TARGET hdf5 ) + set( HDF5_CXX_TARGET hdf5_cpp ) + set( HDF5_HL_TARGET hdf5_hl ) + set( HDF5_Fortran_TARGET hdf5_fortran ) + foreach( _component ${HDF5_LANGUAGE_BINDINGS} ) + list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location ) + get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION ) + if( _comp_location ) + set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH + "HDF5 ${_component} library" ) + mark_as_advanced( HDF5_${_component}_LIBRARY ) + list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} ) + endif() + endforeach() + endif() endif() -if( HDF5_INCLUDE_DIRS AND HDF5_LIBRARIES ) - # Do nothing: we already have HDF5_INCLUDE_PATH and HDF5_LIBRARIES in the - # cache, it would be a shame to override them -else() +if( NOT HDF5_FOUND ) _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( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE ) @@ -259,9 +258,7 @@ else() ${HDF5_${LANGUAGE}_LIBRARY_NAMES} ) # find the HDF5 libraries - message( STATUS "FindHDF5 -- search for ${LANGUAGE}" ) foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} ) - message( STATUS "FindHDF5 -- Searching for ${LIB}" ) if( UNIX AND HDF5_USE_STATIC_LIBRARIES ) # According to bug 1643 on the CMake bug tracker, this is the # preferred method for searching for a static library. @@ -358,16 +355,18 @@ find_package_handle_standard_args( HDF5 DEFAULT_MSG HDF5_INCLUDE_DIRS ) -mark_as_advanced( - HDF5_INCLUDE_DIRS - HDF5_LIBRARIES - HDF5_DEFINTIONS - HDF5_LIBRARY_DIRS - HDF5_C_COMPILER_EXECUTABLE - HDF5_CXX_COMPILER_EXECUTABLE - HDF5_Fortran_COMPILER_EXECUTABLE ) +if( HDF5_FOUND ) + mark_as_advanced( + HDF5_INCLUDE_DIRS + HDF5_LIBRARIES + HDF5_DEFINTIONS + HDF5_LIBRARY_DIRS + HDF5_C_COMPILER_EXECUTABLE + HDF5_CXX_COMPILER_EXECUTABLE + HDF5_Fortran_COMPILER_EXECUTABLE ) -# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of -# HDF5_INCLUDE_DIRS -set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) + # For backwards compatibility we set HDF5_INCLUDE_DIR to the value of + # HDF5_INCLUDE_DIRS + set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) +endif() |