how cmake can check which Visual C++ version runs behind NMAKE

与世无争的帅哥 提交于 2019-12-12 04:43:23

问题


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'.

来源:https://stackoverflow.com/questions/47145999/how-cmake-can-check-which-visual-c-version-runs-behind-nmake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!