[CMake] manifest version mismatch with VS 2008 and InstallRequiredSystemLibraries

Tyler tyler at cryptio.net
Mon May 9 16:28:36 EDT 2011


On Tue, May 3, 2011 at 12:17 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> My blog entry might help:
>
> http://www.kitware.com/blog/home/post/4

Thanks, Bill. That's a good summary of the issues. It would have been
really useful to me a few days ago :), but hopefully this saves
someone else some time. The tip about CMakeVerifyManifest is quite
handy.

To close the loop, here's what I ended up doing.

It's possible to tell Visual Studio to embed a newer version in
generated binaries (by insuring that _BIND_TO_CURRENT_VCLIBS_VERSION
is set to 1 sufficiently early in your project), but each time the
version number increases you have to rebuild everything, including
third-party libraries. We build and cache our 3rdpartylibs on a
network share and I didn't want to run on the Microsoft treadmill by
rebuilding everything each time Microsoft releases a Visual Studio
update. Instead, I decided to treat the CRT libs as yet another
3rdpartylib, pinned to version 9.0.21022.8, and just include them
manually.

I considered modifying InstallRequiredSystemLibraries so that it could
use CRT libraries from somewhere other than the default, but there are
many combinations of different versions of VS and components I don't
use (MFC, ATL, etc.). Also, it seems that no one else has this
problem, so making the solution general for the community would not be
useful. Instead I hacked together the function below.

Thanks,
tyler

# This is a dumb version of the CMake module InstallRequiredSystemLibraries.
# We would like to replace this hand-rolled function with "include
# (InstallRequiredSystemLibraries)" but the default CRT libraries don't work
# for us and the provided module doesn't allow us to customize where the CRT
# libraries are pulled from. See
# http://wiki/bin/view/Main/PackagingWithCMake#microsoft_crt for details.
function (tp_install_required_system_libraries)
    if (NOT DEFINED TP_CRT_ROOT)
        set (TP_CRT_ROOT "${TP_3RDPARTYLIBS_ROOT}/microsoft_crt/9.0.21022.8")
    endif ()
    set (TP_CRT_BASE "${TP_CRT_ROOT}/build/${TP_PLATFORM}")
    set (runtime_libs
        "${TP_CRT_BASE}/Microsoft.VC90.CRT.manifest"
        "${TP_CRT_BASE}/msvcm90.dll"
        "${TP_CRT_BASE}/msvcp90.dll"
        "${TP_CRT_BASE}/msvcr90.dll"
        )
    install (PROGRAMS ${runtime_libs}
        DESTINATION bin
        )
endfunction ()


More information about the CMake mailing list