[CMake] InstallRequiredSystemLibraries fails for msvc10 x64

J Decker d3ck0r at gmail.com
Wed Mar 9 15:42:26 EST 2011


On Wed, Mar 9, 2011 at 11:56 AM, David Cole <david.cole at kitware.com> wrote:
> This is already at least partially fixed in CMake 2.8.4...

Ya I saw that - thought I was working against 2.8.4 until I got to the
next box... so I started checking again...

> Are there still problems building/using 64-bit CMake using the official
> 2.8.4 release? (Rather than whatever you were using when you reported
> this... which must be prior to 2.8.4, or you'd have the above chunk of code
> rather than the one you referred to.)
>

Yes; with a target of 'Visual Studio 10 Win64' but not with 'Visual Studio 10'.

C:\tools\startups>cmake --version
cmake version 2.8.4

C:\general\build\vs10\sack\Debug_solution\alltype-core>cmake -G
"Visual Studio 10 Win64" M:/sack -DCMAKE_BUILD_TYPE=Debug
EFIX=C:\general\build\vs10/sack/Debug_out/core -DBUILD_MONOLITHIC=1
CMake Warning at
c:/tools/unix/cmake/share/cmake-2.8/Modules/InstallRequiredSystemLibraries.cmake:314
(MESSAGE):
  system runtime library file does not exist:
  'MSVC10_REDIST_DIR-NOTFOUND/Debug_NonRedist/x64/Microsoft.VC100.DebugCRT/msvcp100d.dll'
Call Stack (most recent call first):
  CMakeLists.txt:1080 (INCLUDE)


CMake Warning at
c:/tools/unix/cmake/share/cmake-2.8/Modules/InstallRequiredSystemLibraries.cmake:314
(MESSAGE):
  system runtime library file does not exist:
  'MSVC10_REDIST_DIR-NOTFOUND/Debug_NonRedist/x64/Microsoft.VC100.DebugCRT/msvcr100d.dll'
Call Stack (most recent call first):
  CMakeLists.txt:1080 (INCLUDE)


---- My Fix ----
    GET_FILENAME_COMPONENT( msvc_install_path
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]"
ABSOLUTE )
    FIND_PATH(MSVC10_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT
      PATHS
        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/../../VC/redist"
        "${msvc_install_path}/../../VC/redist"
        "${base_dir}/VC/redist"
        "$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/VC/redist"
        "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio 10.0/VC/redist"
      )




>
> Thanks,
> David
>
>
> On Wed, Mar 9, 2011 at 2:43 PM, J Decker <d3ck0r at gmail.com> wrote:
>>
>> In InstallRequiredSystemLibraries
>>
>>  IF(CMAKE_CL_64)
>>    SET(CMAKE_MSVC_ARCH amd64)
>>  ELSE(CMAKE_CL_64)
>>    SET(CMAKE_MSVC_ARCH x86)
>>  ENDIF(CMAKE_CL_64)
>>
>>
>> amd64 should be x64 for vs2010
>>    SET(CMAKE_MSVC_ARCH x64)
>>
>> --------------------
>>
>> If cmake is built as 64bit this won't work
>>
>>    FIND_PATH(MSVC10_REDIST_DIR NAMES
>> ${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT
>>      PATHS
>>
>>  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/../../VC/redist"
>>        "${base_dir}/VC/redist"
>>      )
>>
>> because that key is only installed as a 32 bit key (which is under
>> Wow6432Node with x64)
>>
>> ---------------------
>> This part is really confusing me - I really thought I had it , then I
>> tested a few other modes and it doesn't work.
>>
>> Also, and I don't know why, but the following code works with vs2010
>> 32bit, but not with vs2010 64bit
>>
>>    FIND_PATH(MSVC10_REDIST_DIR NAMES
>> ${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT
>>      PATHS
>>
>>  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/../../VC/redist"
>>        "${base_dir}/VC/redist"
>>      )
>>
>> the previous seems to work only in 32 bit mode... with x64 (other than
>> the arch change from amd64 to x64, it was still unable to locate the
>> redist, until I grabbed the value into a seperate variable....
>>
>> Grabbing the registry value into a variable and then using that to
>> search works in 32 and 64 bit targets.  (actually after confirming
>> that it worked, the following doesn't actually work, but what's at the
>> end does)
>>
>> Changing the search for the redist path like this works in all modes
>> 32/64 debug/release....
>>
>>    GET_FILENAME_COMPONENT( msvc_install_path
>> "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]"
>> ABSOLUTE )
>>    FIND_PATH(MSVC10_REDIST_DIR NAMES
>> ${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT
>>      PATHS
>>        "${msvc_install_path}/../../VC/redist"
>>        "${base_dir}/VC/redist"
>>      )
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>
>


More information about the CMake mailing list