In a cmake.txt file, how can I add a .cpp source file to a Visual Studio project but not have it compile?
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)
精彩评论