[cmake-developers] Patches to add XXX_RUNTIME_LIBRARIES and XXX_RUNTIME_LIBRARY_DIRS to FindZLIB.cmake, FindXml2.cmake, and FindXslt.cmake

Rick Yorgason rick at longbowgames.com
Wed May 25 15:47:51 EDT 2011


(Reposting after my first post didn't get through because I hadn't 
subscribed to the list first.  Apologies if this gets duplicated.)

There's a suggestion in Modules/readme.txt and this post:

http://www.cmake.org/pipermail/cmake/2010-February/035085.html

that the FindXXX.cmake files should offer XXX_RUNTIME_LIBRARIES and 
XXX_RUNTIME_LIBRARY_DIRS variables to let you know where the DLLs for a 
library are, so I've added that feature for ZLIB, LibXml2, and LibXslt. 
   Patches below.

It should be noted that these variables will become more useful if we 
get a couple changes in CMake:

XXX_RUNTIME_LIBRARY_DIRS is best used to set the PATH before debugging, 
and currently on Windows the only way to do that is with a really 
awkward workaround:

http://stackoverflow.com/questions/1005901/how-to-set-path-environment-variable-using-cmake-and-visual-studio-to-run-test

Or you can do what I'm doing and copy them into the appropriate build 
folders at gen-time, which is obviously problematic if you ever update 
your libs.

This would be a lot easier to use if we ever get this feature:

http://www.kwwidgets.org/Bug/view.php?id=8884

As far as XXX_RUNTIME_LIBRARIES, that's best used in INSTALL(FILES), and 
it works pretty well for these three libraries, but it won't work as 
well for libraries that include separate DLLs for optimized and debug 
builds (like Boost or Qt).  For that to work, INSTALL(FILES) will need a 
way of specifying 'optimized', 'release', and 'general' keywords like 
TARGET_LINK_LIBRARIES.  In the meantime, it's probably best for these 
variables to only include the release DLLs, which is why I left the 
debug DLLs out of FindZLIB.cmake.

Also, I only did this for .dll files and not .so files.  There's no 
reason we couldn't, but it would be only marginally useful on 
non-Windows platforms, since it's not typical to ship copies of shared 
libraries on other platforms.

Cheers,

-Rick-

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: FindLibXml2-runtimes.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20110525/27a89932/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: FindLibXslt-runtimes.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20110525/27a89932/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: FindZLIB-runtimes.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20110525/27a89932/attachment-0002.ksh>


More information about the cmake-developers mailing list