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

CHEVRIER, Marc marc.chevrier at sap.com
Thu Nov 9 04:33:02 EST 2017


For that purpose, set the environment variable PreferredToolArchitecture with value x64.

On 08/11/2017 23:26, "CMake on behalf of Paul Smith" <cmake-bounces at cmake.org on behalf of paul at mad-scientist.net> wrote:

    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!
    -- 
    
    Powered by www.kitware.com
    
    Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
    
    Kitware offers various services to support the CMake community. For more information on each offering, please visit:
    
    CMake Support: http://cmake.org/cmake/help/support.html
    CMake Consulting: http://cmake.org/cmake/help/consulting.html
    CMake Training Courses: http://cmake.org/cmake/help/training.html
    
    Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
    
    Follow this link to subscribe/unsubscribe:
    http://public.kitware.com/mailman/listinfo/cmake
    



More information about the CMake mailing list