“其他#using目录"cmake CMakeList.txt中的属性 [英] "additional #using directories" property in cmake CMakeList.txt

查看:91
本文介绍了“其他#using目录"cmake CMakeList.txt中的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用cmake生成VS解决方案文件时,我似乎找不到从cmake CMakeList.txt文件中设置Visual Studio属性其他#using目录"的方法.

I cant seem to find the way to set the visual studio property "additional #using directories" from my cmake CMakeList.txt file when using cmake to generate VS solution files.

它是一个CLI/cpp项目.

Its a CLI/cpp project.

这是我当前的构建文件:

Here is my current build file:

set(the_description "My CLI Project")

ocv_define_module(tiling opencv_stitching)


set_target_properties(${PROJECT_NAME} PROPERTIES VS_DOTNET_REFERENCES "System;System.Core")
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/clr /EHa")
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "d")

if(CMAKE_CXX_FLAGS_DEBUG MATCHES "/RTC1")
   string(REPLACE "/RTC1" " " CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()

if(CMAKE_CXX_FLAGS MATCHES "/EHsc")
   string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()

message(STATUS ${the_module})

推荐答案

您可以通过 target_compile_options :

You can set these via the /AI compiler option. For example with CMake version >= 2.8.12 you could use target_compile_options:

target_compile_options(${PROJECT_NAME} PRIVATE
                       $<$<BOOL:${MSVC}>:/AI${MetadataDir1}
                                         /AI${MetadataDir2}>)

这篇关于“其他#using目录"cmake CMakeList.txt中的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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