[CMake] Visual Studio 12 C++ Compiler Detection

Allen Barnett Allen.Barnett at varian.com
Sun Dec 7 15:12:32 EST 2014


If anyone is interested, it turns out that visual studio 2013 prefers the 32-bit cross compiler. You can set the environment variable PreferredToolArchtecture=x64 to get the native 64-bit compiler (say, before you run CMake).

Some discussion is here: https://connect.microsoft.com/VisualStudio/feedback/details/800059/isnativeenvironment-true-no-longer-works-on-visual-studio-2013-rc

Allen

> -----Original Message-----
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Allen
> Barnett
> Sent: Friday, December 05, 2014 9:06 AM
> To: Jakub Zakrzewski
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Visual Studio 12 C++ Compiler Detection
> 
> Hi Jakub: Thanks for the tip. What is the proper way to execute the compiler
> during the initial configure step? try_compile?
> 
> Thanks,
> Allen
> 
> > So, it appears to find the compiler OK since it emits the correct
> > compiler identification. But, the actual value of CMAKE_CXX_COMPILER is
> not usable. If you try to execute C:/Program…./x86_amd64/cl.exe from
> within a CMake script or even from the command line, it will fail and
> produce the well-known “0xc000007b” dialog (missing DLL). Unless you’ve
> sourced > vcvarsx86_amd64.bat, the correct environment variables are not
> set for this version of the compiler.
> 
> > On the other hand, if I do “cmake –G NMake Makefiles”, I get what I
> expect:
> 
> > Namely, it finds C:/Program…./amd64/cl.exe.
> 
> > I would like to see how it is coming up with this version of the compiler
> which isn’t even in the PATH.
> 
> Hi Allen,
> 
> CMake does not pay attention to the PATH when you ask for VisualStudio
> generator. It simply finds it using it's internal logic. The generated projects
> are suitable for opening in the IDE.
> The NMake generator behaves much more like Unix Makefiles generator, so
> it is sensitive to the environment variables and remembers all variables it
> needs.
> 
> 
> --
> 
> 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