首页 > 代码库 > cmake无法找到vs2015的c compiler

cmake无法找到vs2015的c compiler

运行cmake的configure失败,各种蛋疼


提示错误为:

CMake does not find Visual C compiler


老问题了,每次软件升级都带来一堆兼容问题。网上扒了一圈,说什么的都有。其实解决方式也很简单,


1. Open VS studio command prompt tool (as an administrator)
2. Navigate to where you have the Cmake executable
3. Run Cmake.exe 
4. Proceed as usual to select build and source folder 
5. Select the appropriate VS compiler and hit the configure button


简单的说就是,用管理员权限运行vs的VS studio command prompt tool,在开始菜单的vs2015文件夹下面有,注意有好几个命令行,别选错了。


启动后,其实就是vs的环境变量进入到命令行的上下文了,然后在命令行下cd到cmake路径,直接启动cmake,这种方式启动的cmake就能根据上下文找到对应的c编译器,然后就能正确的 执行configure

命令,然后就该咋地咋地了。


兼容性的锅,也不好说是谁的,貌似是微软更大些,怎么环境变量都没设置好呢?


参考:http://stackoverflow.com/questions/31619296/cmake-does-not-find-visual-c-compiler

本文出自 “做游戏的老G” 博客,请务必保留此出处http://goldlion.blog.51cto.com/4127613/1866257

cmake无法找到vs2015的c compiler