https://github.com/roaringbitmap/croaring_cmake_demo
Demonstration of how you might use CRoaring as a CMake dependency as a subdirectory
https://github.com/roaringbitmap/croaring_cmake_demo
Last synced: about 1 month ago
JSON representation
Demonstration of how you might use CRoaring as a CMake dependency as a subdirectory
- Host: GitHub
- URL: https://github.com/roaringbitmap/croaring_cmake_demo
- Owner: RoaringBitmap
- Created: 2020-07-03T20:11:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-17T17:54:53.000Z (over 5 years ago)
- Last Synced: 2025-10-08T21:57:04.629Z (6 months ago)
- Language: CMake
- Size: 8.79 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple demo of CRoaring as a CMake dependency.
[](https://cloud.drone.io/RoaringBitmap/croaring_cmake_demo)
This repository is meant to serve as an example of how to use [CRoaring](https://github.com/RoaringBitmap/CRoaring) as a `CMake` dependency by having CRoaring as a git submodule.
Usage:
```
mkdir build && cd build && cmake .. && cmake --build . && ./src/test
```
The simple `CMake` project builds a simple test (`./src/test`) .
Please refer to the main [CRoaring](https://github.com/RoaringBitmap/CRoaring) project for further documentation.
## How to add CRoaring as a CMake dependency
Fundamentally, it is as simple as adding the following line after copying the project as a subdirectory in your own project:
```
add_subdirectory(CRoaring EXCLUDE_FROM_ALL)
```
## Why and how to add a submodule?
If your own project is under git, you probably do not want to copy CRoaring in your own git repository. Instead, you want to add it as a submodule.
Once you have a git repository, adding CRoaring as a submodule is relatively easy, type:
```
git submodule add https://github.com/RoaringBitmap/CRoaring.git
```
Using submodules, you can control exactly which version your colleagues are using, down to the commit. Furthermore, submodules are portable: they work wherever git works.
Then you can just follow our example.
## FetchContent
There is even a simpler example using FetchContent. [A single CMakeLists.txt file suffices](https://github.com/RoaringBitmap/croaring_cmake_demo_single_file).