[CMake] [netcdfgroup] [Hdf-forum] netCDF 4.3 Release Candidateavailable --- CMake build in Windows
Biddiscombe, John A.
biddisco at cscs.ch
Thu Apr 25 08:24:45 EDT 2013
Mike
>
You tell the difference between debug & release by the naming of the library itself. All the debug libraries have a "_D" in them or some such thing like that.
<
Once the hdf5-config.cmake has been located, I'm using
get_target_property( _configs ${_component} IMPORTED_CONFIGURATIONS )
To find debug/release etc, for each imported target then iterating over them to get the correct installed path/names.
The latest findhdf5 is using the cmake generated config to mimic the old style find_package syntax.
The key part is detecting if it's a static library or a dynamic one and getting the correct path using
either LOCATION (static) or IMPORTED_IMPLIB (dynamic) and from that build a list of the targets
the core part is as follows
foreach( _component ${HDF5_LIBRARIES} )
get_target_property( _configs ${_component} IMPORTED_CONFIGURATIONS )
get_target_property( _type ${_component} TYPE )
foreach( _config ${_configs} )
if (${_type} MATCHES "LIBRARY")
if (${_type} MATCHES "SHARED")
get_target_property( _comp_location ${_component} IMPORTED_IMPLIB_${_config} )
else()
get_target_property( _comp_location ${_component} LOCATION_${_config} )
endif (${_type} MATCHES "SHARED")
endif (${_type} MATCHES "LIBRARY")
string(TOUPPER ${_component} _name)
# message("Generated name is ${_name}_LIBRARY_${_config} = ${_comp_location}")
if( _comp_location )
set( ${_name}_LIBRARY_${_config} ${_comp_location} CACHE PATH
"${_name}_LIBRARY_${_config} library" )
mark_as_advanced( HDF5_${_component}_LIBRARY )
list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} )
endif()
endforeach()
endforeach()
and generates a full list which should be correct regardless of any unusual names etc.
For me, it's a complete waste of time because I only use the new style cmake imported targets, but there seem to be
Many older projects which still want to use the old style find package (or find old versions of projects)
JB
[cid:image001.png at 01CE41C0.71221B70]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130425/20a18294/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 39067 bytes
Desc: image001.png
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130425/20a18294/attachment-0001.png>
More information about the CMake
mailing list