summaryrefslogtreecommitdiffstats
path: root/Modules/FindHDF5.cmake
diff options
context:
space:
mode:
authorWill Dicharry <wdicharry@stellarscience.com>2011-05-25 18:53:28 (GMT)
committerWill Dicharry <wdicharry@stellarscience.com>2011-05-25 18:53:28 (GMT)
commit93ba19e0709168e3c820f7936f81c0927b7bb392 (patch)
tree2ff720753486b7d9518d840be043ca1fb81b14f7 /Modules/FindHDF5.cmake
parent0584701ae4c73f0867734acb19c6ed92507ce514 (diff)
downloadCMake-93ba19e0709168e3c820f7936f81c0927b7bb392.zip
CMake-93ba19e0709168e3c820f7936f81c0927b7bb392.tar.gz
CMake-93ba19e0709168e3c820f7936f81c0927b7bb392.tar.bz2
FindHDF5 ensures good link lines when libraries are duplicated.
Duplicates must be removed from the beginning of the link libraries to ensure unresolved symbols can be found.
Diffstat (limited to 'Modules/FindHDF5.cmake')
-rw-r--r--Modules/FindHDF5.cmake21
1 files changed, 16 insertions, 5 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index f1805cd..92dad21 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -307,18 +307,29 @@ if( NOT HDF5_FOUND )
# We may have picked up some duplicates in various lists during the above
# process for the language bindings (both the C and C++ bindings depend on
- # libz for example). Remove the duplicates.
+ # libz for example). Remove the duplicates. It appears that the default
+ # CMake behavior is to remove duplicates from the end of a list. However,
+ # for link lines, this is incorrect since unresolved symbols are searched
+ # for down the link line. Therefore, we reverse the list, remove the
+ # duplicates, and then reverse it again to get the duplicates removed from
+ # the beginning.
+ macro( _remove_duplicates_from_beginning _list_name )
+ list( REVERSE ${_list_name} )
+ list( REMOVE_DUPLICATES ${_list_name} )
+ list( REVERSE ${_list_name} )
+ endmacro()
+
if( HDF5_INCLUDE_DIRS )
- list( REMOVE_DUPLICATES HDF5_INCLUDE_DIRS )
+ _remove_duplicates_from_beginning( HDF5_INCLUDE_DIRS )
endif()
if( HDF5_LIBRARIES_DEBUG )
- list( REMOVE_DUPLICATES HDF5_LIBRARIES_DEBUG )
+ _remove_duplicates_from_beginning( HDF5_LIBRARIES_DEBUG )
endif()
if( HDF5_LIBRARIES_RELEASE )
- list( REMOVE_DUPLICATES HDF5_LIBRARIES_RELEASE )
+ _remove_duplicates_from_beginning( HDF5_LIBRARIES_RELEASE )
endif()
if( HDF5_LIBRARY_DIRS )
- list( REMOVE_DUPLICATES HDF5_LIBRARY_DIRS )
+ _remove_duplicates_from_beginning( HDF5_LIBRARY_DIRS )
endif()
# Construct the complete list of HDF5 libraries with debug and optimized