I have a lot of code that is needed for several projects - units, include files, resources and more. These files are writen by myself, downloaded or cloned with git and have their own place in the directory structure.

These (source)files have to be accessible during compilation. Now I'm struggling with two different possibilities how that can be accomplished:

  • Copy the relevant files into my project source tree
  • Use the files with a (relative)path

Copy files


  • The project can always be compiled
  • All neccessary files will be commited with git


  • I don't benefit autmatically from bugfixes and have to check manually if there are are newer versions
  • Copies of the same code at various plces

Use path


  • Bug fixes are a automatically included during the next build
  • I don't have the check which files have to be copied additionally


  • Major changes in the referenced files can make my project uncompilable
  • Relevant files of the project are missing in the repository

How do you deal with this problem? Is there a way to have the best of both worlds?

In the case that it matters: I'm working most of the time under Windows with Free Pascal, Forth, Assembler, Verilog.

1 Answer 1


Usually these things are solved by creating a common module on which your projects depend on. Such modules can be uploaded to an artifact repository. For example in Java you upload your artifacts to Maven Central and you import them using a Gradle build file or Maven pom. For example your Maven pom would contain the following dependency:


That way you can develop your common library separately and you have proper version control. Applications which use your common library can depend on a specific version and no code is duplicated!

Now it should be noted that you don't have to upload your artifacts to a central repository, usually you can host them locally and achieve the same results. I should note that I've never worked with Free Pascal, but I believe there is the Online Package Manager that you could use.

EDIT: I actually think the Online Package Manager is specifically for Lazarus packages. Checkout this answer, it recommends fppkg.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.