[CMake] Win32: Find location of VS redistributable runtime files ?

Marcus D. Hanwell marcus at cryos.org
Thu Apr 2 12:15:43 EDT 2009


James Bigler wrote:
> On Thu, Apr 2, 2009 at 7:49 AM, Stephen Collyer
> <scollyer at netspinner.co.uk <mailto:scollyer at netspinner.co.uk>> wrote:
>
>
>     2009/4/2 Philip Lowman <philip at yhbt.com <mailto:philip at yhbt.com>>
>
>         On Thu, Apr 2, 2009 at 7:00 AM, Stephen Collyer
>         <scollyer at netspinner.co.uk <mailto:scollyer at netspinner.co.uk>>
>         wrote:
>
>             In the course of installation, I want to copy the
>             redistributable C++ runtime libs
>             directory from VS into my deliverable package. However,
>             this should work with
>             both VS8 and VS9. Could someone tell me how I can detect
>             the build environment
>             and locate the appropriate directory to do this ? For
>             example, if building with
>             VS9 I want to locate the directory:
>
>             C:\Program Files\Microsoft Visual Studio
>             9.0\VC\redist\x86\Microsoft.VC90.CRT
>
>             I'm guessing that there's a CMAKE_* variable that allow me
>             to do this,
>             but I'm not sure which.
>
>
>         You can include InstallRequiredSystemFiles for this. See:
>         http://www.cmake.org/cmake/help/cmake2.6docs.html#module:InstallRequiredSystemLibraries
>
>         VS9 support was added to this script and I believe it was
>         first added in CMake 2.6.0
>
>         -- 
>         Philip Lowman
>
>
>
>     Thanks for that - I'd completely forgotten about the existence of
>     that module.
>
>     I've tried it and I have one question though - it seems to dump
>     the manifest and
>     DLLs into the bin directory - it was my understanding that these
>     had to go into
>     a subdirectory of bin called Microsoft.VC80.CRT. Am I misinformed ?
>
>
>  
> I just recently shipped something with the redistributables, and it
> worked just fine putting them next to the dll (i.e. bin directory).
>
I worked on the packaging for Avogadro on Windows using VS. It works
very well with the files in the bin directory and as I understand
Windows, it looks in the same directory as the binary and then the path
is searched.

One issue we had was with plugins that were not in the binary directory.
I solved that by disabling the generation of manifests for modules in
our build scripts. I still need to clean up our Windows build as the way
we copy external libraries such as Qt is pretty hackish right now, but
that works too using a similar approach.


More information about the CMake mailing list