代码之家  ›  专栏  ›  技术社区  ›  Michael Kelley Franci Penov

在cmake.txt文件中,如何将.cpp源文件添加到VisualStudio项目中,但不进行编译?

  •  1
  • Michael Kelley Franci Penov  · 技术社区  · 15 年前

    如何将.cpp文件添加到项目中,并使它们在项目中可见但不包括在编译中?基本上我希望“Excluded From Build”标志设置为“Yes”。我想为C++统一样式构建做这件事。

    2 回复  |  直到 15 年前
        1
  •  3
  •   Michael Kelley Franci Penov    15 年前

    好吧,看起来我需要这样做:

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

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

        2
  •  0
  •   Abubadabu    11 年前

    您还可以将文件的语言设置为未定义的语言:

    set_source_files_properties(${files} PROPERTIES LANGUAGE xxx)