How can CMake determine the version of Visual Studio 2010? - visual-studio-2010

I need to check programmatically whether SP1 is installed for Visual Studio 2010, since all our prebuilt libraries were built with this version. What's the best way to do that in CMake?

Check the value of the CMAKE_CXX_COMPILER_VERSION global variable.
For VS10SP1, the version should be 16.00.40219.01, for the non-SP1 version it should be 16.00.30319.01.
If you are stuck with an old CMake version (older than 2.8.12) that does not support CMAKE_CXX_COMPILER_VERSION, take a look at the CMakeDetermineVSServicePack module.

Related

Cuda with cmake

I am trying to compile a existing CMake project using Cuda v8.0 that I found online. To do that, I use CMake GUI version. (I am currently running Windows 10, with Visual Studio 2017). The "Configure" step always givs me the following error message:
No CMAKE_CUDA_COMPILER could be found.
I have cuda 8.0 installed (altogether with other Cuda versions that I removed from my path), CuDNN also in my path. And I expect at some points to generate Visual studio project files that I could then use to compile the project...
What could cause that error?
EDIT
Upon request, I uploaded the CMakeOutput.log there : https://framabin.org/?c532b10d2a4aef54#NkJZItfUfPwMP6BHCiP5DhQS40duM4AhsKR+bWHN0tE=
Alright! With #raul-laasner help, I think I have the solution of my problems!
The first one was indeed that my Cuda version was not correctly identified. And I am not sure at this stage that one was found at all. My environment variables where probably ignored also. I had to specify the CMAKE_CUDA_COMPILER option to "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/nvcc.exe".
Then, the problem was that I was using a too recent version of Visual Studio. For starters, Cuda v8.0 is not compatible with Visual Studio 2017: Cuda 8.0 with Visual Studio 2017. But even with the most recent version of Cuda, my Visual Studio is too recent. Meaning: NVIDIA lags behind when it comes to the Visual Studio versions... And now, Microsoft plans to update the _MSC_VER on most of the upgrade. Thus, I had two choices:
Downgrade Visual Studio to a compatible version.
Use more recent version of Cuda (9.2) and modify the c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include\crt\host_config.h to change the upper limit of the _MSC_VER verification.
By doing the second option, I managed to configure and compile the project. I am not sure though that I won't have later problems with this "hacky" way. But at least, I've been on a further step!
For me, this issue was caused by nvcc(x64 version) doesn't support x86 platform and was fixed by specifying the platform for cmake:
$build> cmake .. -G"Visual Studio 15 2017 Win64"

Is pre-compiled Qt 5.9 VS version independent?

On the Qt website, in the download section, there is a pre-compiled Qt5.9 available.
Before Qt5.9 there were different pre-compiled packages for each Visual Studio version.
Is new pre-compiled Qt5.9 VS version independent?
If not, for which version is it?
No, it's not. It can't be since visual c++ versions are usually* not binary compatible (*just now Visual Studio 2017 is binary compatible with 2015).
That package just has different versions you can install, to target Windows: VS2013 (x64), VS2015(x64 and x86), VS2017(x64), MinGW and to target Android (arm and x86).

How can I find out which version of Qt Visual Studio Addin to install for different version of Visual Studio?

Different versions of the Qt Visual Studio Addin are available for download at
Qt Visual Studio Addin
How do I know which version to install for different versions of Visual Studio?
I'm running Visual Studio 2012, but would like to know a general answer.
Don't use the archive by default, use it only if you need older version.
The Visual Studio addin you need depends on the Qt version you want, for Qt 5 you need version 1.2.4 and for Qt 4 you need 1.1.11, see the download section here

Visual Studio 2010 Express, Windows SDK 7.1, CMake and 64 bit

I'm running into problems generating a Visual Studio 2010 Express 64 bit project through CMake. I installed VS2010 Express first, then the Windows SDK 7.1 in order to be able to build 64 bit apps and then tried to compile my CMake project.
I do not remember this to be that difficult with 2008 Express, but with 2010 I fail again and again. 2010 searches per default for 7.0a SDK which is shipped with it. The express version seems to ship a reduced 32 bit version, which is located under
.../Program Files(X86)/Microsoft SDKs/Windows/7.0a
Windows SDK 7.1 64bit will be installed per default under
.../Program Files/Microsoft SDKs/Windows/7.0
In VS 2010 Express the platform SDK can be changed on a per-project-map basis and if I do so the inherited path macros surprisingly point to the correct SDK. The problem now is, that CMake is not happy about me screwing around in the project files by myself. Thus, it always resets the Platform SDK entry to the default value, which will make the Windows SDK point to 7.0a and result in complaints about missing 64 bit libs.
I now see two possibilities to resolve this:
Find a way to really integrate the 7.1 SDK into VS2010 Express, just like with VS2008. VS2008 searches the registry for the tag 'CurrentInstallFolder' in the Windows SDKs entry, and you can change this entry to point to another SDK.
Find a way to tell CMake (2.8.1) to set the correct Platform SDK in the project. No plan how to do this...
I would appreciate any help. 2010 is somewhat mandatory unfortunately, I personally cannot get used to it at all...
Ok, updating to the latest CMake (2.8.12) resolved this, CMake now detects the 7.1 SDK and sets it in the project files.
Edit: The toolset can be chosen in a CMake file via the CMAKE_GENERATOR_TOOLSET flag

which Visual Studio version is the earliest one to support 64bit compilation?

is it Visual Studio 2005?
The reason why I ask is because I've inherited some old code (written with VS 6) that now needs to be compiled to run on a 64bit system. Unfortunately the code won't compile with VS 2010 so I'm trying to use the oldest possible version.
VS2002 (v7.0) was the earliest, tho I'd recommend VS2003 (v7.1). You may have issues installing either one on Win 7 tho.

Resources