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

Shoaib Meenai smeenai at fb.com
Wed Nov 8 17:30:00 EST 2017


Running cmake from an x64 developer command prompt and passing -Thost=x64 to cmake should do the trick.

On 11/8/17, 2:26 PM, "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: https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cmake.org_Wiki_CMake-5FFAQ&d=DwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=04uD08sTa71kZ1R71-0lfj2WhRqDAQ1MD4dFpTTvEMw&s=WUSP8DL8wol0uWj27DY-hr8Cxfo-wDIzw4VK8gxsYZA&e=
    
    Kitware offers various services to support the CMake community. For more information on each offering, please visit:
    
    CMake Support: https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_support.html&d=DwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=04uD08sTa71kZ1R71-0lfj2WhRqDAQ1MD4dFpTTvEMw&s=XPIwm3-OwRZY6iPlierCUC4nja73_1tN4MOrTmwjafU&e=
    CMake Consulting: https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_consulting.html&d=DwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=04uD08sTa71kZ1R71-0lfj2WhRqDAQ1MD4dFpTTvEMw&s=znr1l-FqO4cl2CO0FquPjJu2rb3VFT_FB6fK5Kl7jj4&e=
    CMake Training Courses: https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_training.html&d=DwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=04uD08sTa71kZ1R71-0lfj2WhRqDAQ1MD4dFpTTvEMw&s=HkOsuk57njZ5Gle8DHBws-Zxuye7VU87mKMu8Sj1Xa4&e=
    
    Visit other Kitware open-source projects at https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=04uD08sTa71kZ1R71-0lfj2WhRqDAQ1MD4dFpTTvEMw&s=PKDPXwr0OKmHvOmP0NDauxr8_gk81Twie9Bqc8IByuw&e=
    
    Follow this link to subscribe/unsubscribe:
    https://urldefense.proofpoint.com/v2/url?u=http-3A__public.kitware.com_mailman_listinfo_cmake&d=DwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=04uD08sTa71kZ1R71-0lfj2WhRqDAQ1MD4dFpTTvEMw&s=IMj1Uw3a24-XuV1oGDAnZFzXJiix5ZqSEg09HyKfLPU&e=
    



More information about the CMake mailing list