检查是否从CMake生成Visual Studio解决方案或Makefile [英] Check if generating a Visual Studio solution or Makefile from CMake
本文介绍了检查是否从CMake生成Visual Studio解决方案或Makefile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何生成我的Visual Studio解决方案或Makefile,如何在CMakeLists.txt中知道?
How can I know in my CMakeLists.txt if I'm generating a Visual Studio solution or a Makefile?
我需要像这样将外部项目添加到解决方案中:
I need to add external projects to the solution like this:
INCLUDE_EXTERNAL_MSPROJECT(cs-tests ${CMAKE_CURRENT_SOURCE_DIR}/cstests/cstests.csproj)
但是我只想在致电
cmake .. -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 12 2013"
当我打电话时不是:
cmake -G "NMake Makefiles" ..
推荐答案
生成器的名称存储在 CMAKE_GENERATOR
中.它应包含 -G
选项给出的确切字符串.
The name of the generator is stored in CMAKE_GENERATOR
. It should contain the exact string given by the -G
option.
MSVC
变量也应设置为 TRUE
, MSVC12
和 MSVC_IDE
也应设置为(虽然我可以暂时无法从文档中确认.)
The MSVC
variable should also be set to TRUE
, as should MSVC12
and MSVC_IDE
(though I can't confirm that from the documentation at the moment.)
这篇关于检查是否从CMake生成Visual Studio解决方案或Makefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文