开发者

In a cmake.txt file, how can I add a .cpp source file to a Visual Studio project but not have it compile?

开发者 https://www.devze.com 2023-01-02 09:23 出处:网络
How do I 开发者_JAVA百科add .cpp files to a project and have them visible in the project but not included in the compile?Basically I want the \"Excluded From Build\" flag to be set to \"Yes\".I want t

How do I 开发者_JAVA百科add .cpp files to a project and have them visible in the project but not included in the compile? Basically I want the "Excluded From Build" flag to be set to "Yes". I want to do this for C++ Unity style builds.


Ok, it looks like I need to do something like this:

# Exclude all translation units from compilation
set_source_files_properties(${files} PROPERTIES HEADER_FILE_ONLY true)

My reference:

http://cheind.wordpress.com/2009/12/10/reducing-compilation-time-unity-builds/


You could also set the language of the file to something undefined:

set_source_files_properties(${files} PROPERTIES LANGUAGE xxx)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号