[cmake-developers] SelectLibraryConfigurations cached/advanced variables

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Tue Jul 9 05:56:02 EDT 2013


Hello,

On 03/07/13 20:21, Brad King wrote:
> The open request's discussion identified some concerns about the
> SelectLibraryConfigurations module, so please start another thread
> to raise the concerns here (or respond to this message and change the
> subject line).


I was discussing with Brad about using SelectLibraryConfigurations in
FindGTK2.cmake, but there are a couple of things that I don't like in
this module:


SelectLibraryConfigurations module currently cache and mark as advanced
the variable ${basename}_LIBRARY.
${basename}_LIBRARY_RELEASE and ${basename}_LIBRARY_DEBUG are usually
cached, because they often come from find_library().
${basename}_LIBRARY on the other hand is always of type
"optimized;${${basename}_LIBRARY_RELEASE};debug;${${basename}_LIBRARY_DEBUG}"
or just "${basename}_LIBRARY_RELEASE" or "${basename}_LIBRARY_DEBUG" if
only one version of the library is not found, if both have the same
value, or if configuration types are not supported.


I believe that caching and marking as advanced just
${basename}_LIBRARY_RELEASE and ${basename}_LIBRARY_DEBUG is enough,
just by modifying these two variables, the user has enough control on
finding the library, and having 3 variables is IMO redundant and confusing.
So, is there a reason why ${basename}_LIBRARY is cached?


Another issue is that if one of the libraries (_DEBUG or _RELEASE) is
not set, the value is set to the value of the other one.
FindQt4, from which the macro is extracted, sets the values to
XXX_LIBRARY_{DEBUG,RELEASE}-NOTFOUND instead.
In both cases the XXX_LIBRARY is correct, but IMO using NOTFOUND makes
it easier to understand which one is missing.


I tried to fix these issues, you can find the patches attached.


Regards,
 Daniele
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SelectLibraryConfigurations-Do-not-cache-the-_LIBRAR.patch
Type: text/x-patch
Size: 1084 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130709/eb7e3982/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-SelectLibraryConfigurations-Use-NOTFOUND-instead-of-.patch
Type: text/x-patch
Size: 4205 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130709/eb7e3982/attachment-0003.bin>


More information about the cmake-developers mailing list