[英]How do I use CMake to set the VS platform toolset property?
Rather that using the method presented here , I would like to manually set a property of a Visual Studio project in the CMake file, in this case, the Platform Toolset to $(DefaultPlatformToolset)
(see this image) , which is a VS macro. 而是使用此处介绍的方法,我想在CMake文件中手动设置Visual Studio项目的属性,在本例中,将Platform Toolset设置为
$(DefaultPlatformToolset)
(参见此图) ,这是一个VS宏。 Is it possible? 可能吗?
This is generally what CMAKE_GENERATOR_TOOLSET
is used for, however, it should be used within a toolchain file, not within the CMakeLists.txt. 通常,这就是
CMAKE_GENERATOR_TOOLSET
的用途,但是,应在工具链文件中而不是CMakeLists.txt中使用它。
Native build system toolset name specified by user.
用户指定的本机构建系统工具集名称。
Some CMake generators support a toolset name to be given to the native build system to choose a compiler.
一些CMake生成器支持将工具集名称提供给本机构建系统以选择编译器。 If the user specifies a toolset name (eg via the cmake -T option) the value will be available in this variable.
如果用户指定工具集名称(例如,通过cmake -T选项),则该变量中的值将可用。
The value of this variable should never be modified by project code.
该变量的值永远不能被项目代码修改。 A toolchain file specified by the CMAKE_TOOLCHAIN_FILE variable may initialize CMAKE_GENERATOR_TOOLSET.
CMAKE_TOOLCHAIN_FILE变量指定的工具链文件可以初始化CMAKE_GENERATOR_TOOLSET。 Once a given build tree has been initialized with a particular value for this variable, changing the value has undefined behavior.
一旦使用该变量的特定值初始化给定的构建树,更改该值将具有未定义的行为。
I think if you set it before making your project
call, then it will theoretically still work, although obviously this is not the supported method of using it, so compatibility may vary. 我认为,如果您在进行
project
调用之前进行设置,那么从理论上讲它仍然可以使用,尽管显然这不是使用它的支持方法,因此兼容性可能会有所不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.