[CMake] How to force use of Windows 64bit link.exe?

Paul Smith paul at mad-scientist.net
Wed Nov 8 17:05:26 EST 2017


Hi all.  I wonder if someone can help me get CMake to force Visual
Studio to run the 64bit linker instead of the 32bit linker.  By that I
mean, the link.exe binary built for 64bit, not a linker that produces a
64bit executable.

Sometimes (but not always) when I link my code I get an error from the
32bit link.exe and Visual Studio wants to automatically re-invoke the
64bit link.exe.  I would prefer that it just always starts with the
64bit version, rather than fail and retry.

I get errors like:

  LINK : the 32-bit linker
  (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe)
  ran out of heap space; restarting link with the 64-bit linker

I run CMake with a generator like this:

  cmake.exe -G "Visual Studio 14 2015" -A x64 D:\builds\src

I want to convince cmake to tell Visual Studio to invoke the 64bit
link.exe at first, rather than waiting for a failure--the 64bit
link.exe is, I believe:

  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\link.exe

Does anyone know how to force that to happen?

BTW, I'm using CMake 3.5.2 at the moment.

Cheers!


More information about the CMake mailing list