There are really only two options for this. You can copy the source code into your repository and add it to your build system. If it’s too hard to add to your build system or takes too long to compile you can add it to CI separate from the main codebase and commit the binaries.
I feel like this is pretty well known, the only interesting thing I have to say is that you should really put the builds somewhere where other people can reproduce them. Building it on your PC/random servers and committing that is not good enough! CI works well for this. You make a new repo that contains the library source code and a script to build it build it, and set it up so people can click a button to run it.
I’m not sure of a nice way to get stuff like cmake onto the build machines though. Docker is not a solution unless you’re Linux only. I guess there aren’t that many build systems out there so making the images manually isn’t too bad?