当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - Automatically add all files in directory to library project

问题描述:

We're looking to create a library to link several projects against in Visual Studio. The source for this library is maintained outside of Visual Studio. Is there a way to automatically scrape a specified directory (or directories) for *.cpp files and automatically add them to the library? Currently we have to add or delete files as required (right click project, add, existing).

网友答案:

This answer from (@Yuchen Zhong)

In visual studio 2015, this is how you do it.

If you wanted to automatically include all descendant files below a specific folder:

<Content Include="Path\To\Folder\**" />

Reference: http://jamesrpatterson.com/blog/automatic-include-in-project-for-visual-studio

from this SO question: How do I add an existing directory tree to a project in Visual Studio? should give you all you need.

<Content Include="Path\To\Folder\*.cpp" >

I knew the answer, and that it must be posted somewhere...took me a little bit to find, so hoping this answer helps others find the other answer.

分享给朋友:
您可能感兴趣的文章:
随机阅读: