[cmake-developers] [CMake 0011752]: FindHDF5.cmake debug and release libraries get mixed in release configuration

Mantis Bug Tracker mantis at public.kitware.com
Tue Jan 25 11:37:43 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=11752 
====================================================================== 
Reported By:                Stephan Meister
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   11752
Category:                   Modules
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-01-25 11:37 EST
Last Modified:              2011-01-25 11:37 EST
====================================================================== 
Summary:                    FindHDF5.cmake debug and release libraries get mixed
in release configuration
Description: 
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()




====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-01-25 11:37 Stephan MeisterNew Issue                                    
======================================================================




More information about the cmake-developers mailing list