MantisBT - CMake
View Issue Details
0011752CMakeModulespublic2011-01-25 11:372011-11-11 10:45
Stephan Meister 
Will Dicharry 
normalminorhave not tried
closedfixed 
Visual Studio 2010Windows7 x64
CMake 2.8.3 
CMake 2.8.5CMake 2.8.5 
0011752: FindHDF5.cmake debug and release libraries get mixed in release configuration
If debug and release libraries for several components are found (e.g. hdf5, hdf5_cpp, hdf5_hl,...)
then using TARGET_LINK_LIBARARIES(Project ${HDF5_LIBRARIES}) will cause the Project to be linked against both debug and release libraries.
(For example hdf5.lib AND hdf5d.lib)

This is caused by lines 286+ in FindHDF5.cmake:
        set( HDF5_LIBRARIES
            debug ${HDF5_LIBRARIES_DEBUG}
            optimized ${HDF5_LIBRARIES_RELEASE} )
...

CMake does only treat the first library in HDF5_LIBRARIES_DEBUG as debug,
the others will default to optimized.

I suggest the following fix:
    if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
        set(HDF5_LIBRARIES)
    foreach(LIB ${HDF5_LIBRARIES_DEBUG})
        list(append HDF5_LIBRARIES debug ${LIB})
    endforeach()
    foreach(LIB ${HDF5_LIBRARIES_RELEASE})
        list(append HDF5_LIBRARIES optimized ${LIB})
    endforeach()
    else()
        set( HDF5_LIBRARIES ${HDF5_LIBRARIES_RELEASE} )
    endif()



No tags attached.
Issue History
2011-01-25 11:37Stephan MeisterNew Issue
2011-01-26 09:08David ColeAssigned To => Will Dicharry
2011-01-26 09:08David ColeStatusnew => assigned
2011-06-15 12:28Will DicharryNote Added: 0026876
2011-06-15 12:28Will DicharryStatusassigned => resolved
2011-06-15 12:28Will DicharryFixed in Version => CMake 2.8.5
2011-06-15 12:28Will DicharryResolutionopen => fixed
2011-06-17 18:23David ColeTarget Version => CMake 2.8.5
2011-11-11 10:45David ColeNote Added: 0027768
2011-11-11 10:45David ColeStatusresolved => closed

Notes
(0026876)
Will Dicharry   
2011-06-15 12:28   
Applied changes, they should make it into 2.8.5.
(0027768)
David Cole   
2011-11-11 10:45   
Closing resolved issues that have not been updated in more than 4 months.