-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Cristian Le <[email protected]>
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Downloading the project | ||
|
||
First step is where do we even get the files we need to start using the project. | ||
As you're probably aware by now, C/C++ projects do not have a concise packaging | ||
system [^1][^2] like [PyPI] is for python, so the starting point here is not that | ||
straight-forward. The actual project that implemented this template should | ||
document where they are officially packaging the project, usually on the | ||
front-page of their git repository or documentation. | ||
|
||
Regardless, here I will try to cover some of the common sources and conventions | ||
where you can find the project. | ||
|
||
[PyPI]: https://pypi.org/ | ||
|
||
--- | ||
|
||
## Where do I download the project from? | ||
::::{tab-set} | ||
:::{tab-item} As an end-user | ||
For the most part you should look for a [packaged] source, even the project you | ||
want to use is a library that you would be using in your own C/C++ project. | ||
|
||
When importing the project within another CMake project, the recommended way is | ||
[using `FetchContent`], which will internally use either the [packaged] or | ||
[source] version. | ||
::: | ||
:::{tab-item} As an upstream developer | ||
You are primarily interested in the [source] version. When working on multiple | ||
projects, it is especially useful to know how to setup your [CMakeUserPreset] so | ||
that you can easily switch between one project and another. | ||
::: | ||
:::{tab-item} As a downstream packager | ||
You should be aware on how get the project from [source]. The original git | ||
source is preferred since CMake does not bundle any additional metadata in its | ||
archive. | ||
::: | ||
:::: | ||
|
||
## Packaged version | ||
|
||
Usually you will find the project | ||
|
||
## Source project | ||
|
||
## Using `FetchContent` | ||
|
||
## Other build-system | ||
|
||
Good luck, you have reached the wild-west. You are mostly on your own now. | ||
|
||
Some projects can have other ways of importing the project using [`pkgconf`], | ||
however, for consuming CMake projects, it is greatly discouraged to rely on | ||
these because it cannot contain the same amount of metadata, e.g. for | ||
[c++ modules], it does not contain the compiler used for packaged compiled | ||
library, that would tell the consumer if they need to re-compile the project or | ||
not, but on the other-hand, such information is used when consuming CMake's | ||
[`find_package`]. | ||
|
||
[packaged]: #packaged-version | ||
[source]: #source-project | ||
[using `FetchContent`]: #using-fetchcontent | ||
[`pkgconf`]: https://github.com/pkgconf/pkgconf | ||
[c++ modules]: https://en.cppreference.com/w/cpp/language/modules | ||
|
||
[CMakeUserPreset]: TBD | ||
|
||
[`find_package`]: inv:cmake:cmake:command#command:find_package | ||
|
||
[^1]: There is a proposal within CMake to at least unify the dependency backend | ||
[^2] which would be a pre-requisite for having a unified packaging system | ||
using CMake. But still it is a long way until there can be a `pip`-like | ||
interface to install projects. | ||
[^2]: <https://gitlab.kitware.com/cmake/cmake/-/issues/22686> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters