how cmake can check which Visual C++ version runs

2019-08-30 00:05发布

I am working on a CMake project for Windows which uses 'NMake' as generator.

Inside my CMake I have to setup variables differently based on the specific version of Visual C++ which will compile the code. Specifically I am using Visual Studio 2017 and Visual Studio 2013.

How can I distinguish withing the CMakeLists.txt when NMake is generating its files for Visual Studio 2017 instead of Visual Studio 2013?

Is there any CMake variable I can read to know which version of Visual C++ will be used?

Is there maybe a NMake version under CMAke?

Unfortunately I have to stick to 'NMake' generator and I cannot switch to the two generators which would solve easily my problem which are 'Visual Studio 15 2017 Win64' and 'Visual Studio 12 2013 Win64'.

0条回答
登录 后发表回答