Skip to content

Commit

Permalink
[WIP] Download section
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT committed Dec 18, 2023
1 parent 621ae21 commit 5d09e7e
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
73 changes: 73 additions & 0 deletions docs/guides/user/download.md
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>
1 change: 1 addition & 0 deletions docs/guides/user/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ hidden: true
glob: true
---
who-is-the-user
download
```

This is a general guide for how a user can interact with modern CMake project
Expand Down

0 comments on commit 5d09e7e

Please sign in to comment.