title: What is the best way to share Delphi source files among projects?
body: <p><strong>What is the best way to share Delphi source files among projects?</strong></p>
  
  <p><em>Clarification: We want to use a single source file in multiple Delphi projects.  We've been using our SCM tool to put the same file into multiple folders, but this is not a super-elegant experience and we are also considering migrating to a tool that doesn't support this.</em></p>
  
  <p>As I’ve been investigating this question, I’ve considered a few different approaches, but I’d like to know what you’re doing and how you find your approach.</p>
  
  <p><strong>Important Scenarios:</strong></p>
  
  <ul>
  <li>Code-time
  
  <ul>
  <li>Adding a new sharing dependency should require explicit declaration, so that sharing is managed.</li>
  <li>Adding a new sharing dependency should still be relatively simple; it should not require a complicated process.
  
  <ul>
  <li>One file which lists all of the project’s “imported” files (from externally) would be nice.</li>
  </ul></li>
  </ul></li>
  <li>Compile-time
  
  <ul>
  <li>All projects should always build with the one current version (current as of the source sync state plus local edits).
  
  <ul>
  <li>(Maintaining different versions in different locations should use file branching, which is not the topic, here.)</li>
  </ul></li>
  <li>Whether each project should be able to affect the shared file’s compilation with different compiler settings (including flags) is arguable.
  
  <ul>
  <li>It’s arguably easier to maintain (i.e. long-term) source code that is always built consistently.</li>
  <li>It’s arguably easier to make maintenance fixes (i.e. short-term) if the scope of said changes can easily be restricted to one project.</li>
  </ul></li>
  </ul></li>
  <li>Debug-time
  
  <ul>
  <li>The correct version of the source should automatically open, when stepping into a routine or setting a breakpoint.</li>
  <li>Editing the displayed source should affect the next build.
  
  <ul>
  <li>We do not want to debug against a temporary copy of the source: we'd probably lose code, in the confusion.</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p><strong>Considerations:</strong></p>
  
  <ul>
  <li>Near-Term:
  
  <ul>
  <li>What approach will be simplest to put in place?</li>
  </ul></li>
  <li>Long-Term:
  
  <ul>
  <li>What approach will be simplest to use and maintain?</li>
  </ul></li>
  </ul>
  
  <p>Thanks, in advance, for your feedback!</p>
  
  <p>Mattias</p>
  
  <p><hr/>
  <strong>--- UPDATE ---</strong></p>
  
  <p>Thanks for your feedback, via answers, comments, and votes!</p>
  
  <p>I've started down the path of putting shared files into one "producer" project and importing a list of compiled files into each "consumer" project.  The projects are being linked together with MSBuild.  Once things are more nailed-down, I'll edit this question and the "Library Project" answer, to share what I've learned.</p>
  
  <p>Stay tuned!  (But don't hold your breath; you'll asphyxiate within minutes! :P )</p>