denisps denisps - 8 months ago 52
C++ Question

CMake "make install" or including a library in windows

I'm trying to create an Open Source C++ project. I want it to be as easy to build as possible, but at the same time cross platform.
I don't need gui or heavy libraries like boost or Qt, so I've settled on using GitHub, CMake, and LibSourcey.
My problem is, I can't find a way to make my project easy to build in windows, which is my development environment.
How can I "make install" a library in Windows for use in my project? Do I even have to install it in windows?
Is it possible to download, build, and link it automatically?

On windows, besides an installer, I also want to make a portable version, so don't want any hard coded library paths.

I assume, on some platforms, like Linux, libraries are built separably and packaged up by maintainers. So I shouldn't just bundle up my own copies.

So, my question is:
How can I set up a project that is cross platform and easy to build, and what are the best practices?


You can create git submodule in your git repo with path for example contrib/LibSourcery and url to github repo of LibSourcery, because of LibSourcery uses cmake you just need add such line into your CMakeLists.txt: add_subdirectory(contrib/LibSourcery)

So person who want to use your code, just do git clone --recursive url to get all of your code and dependencies, after that it run cmake -G, to create project for IDE of his choice (including MSVC++ of course), open project in IDE and press build button, that's all.