使用cmake将clr支持设置为true [英] set clr support to true with cmake

查看:731
本文介绍了使用cmake将clr支持设置为true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用cmake生成托管的c ++代码。以下是我为此添加的脚本

I am trying generate a managed c++ code with cmake. Below is the script which i have added for

 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/clr") 
 STRING(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
 STRING(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr")  

它没有将clrsupport设置为true。我们如何做到这一点。

It does not set clrsupport to true.How do we do it cmake.

-swetha

推荐答案

在Visual Studio 2017上,这对我有用:

This does the trick for me, on Visual Studio 2017:

set_target_properties(${PROJECT_NAME} PROPERTIES COMMON_LANGUAGE_RUNTIME "")

请注意,Visual Studio 2017已删除了值 pure和 safe,并且空字符串 如上将为您提供一个混合(本机/托管)dll。

Note that the values "pure" and "safe" have been removed with Visual Studio 2017, and the empty string "" as above will get you a "mixed" (native/managed) dll.

这篇关于使用cmake将clr支持设置为true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆