Skip to content

Instantly share code, notes, and snippets.

@neogeogre
Last active November 24, 2021 17:09
Show Gist options
  • Save neogeogre/4bef87d096c8e3056a50eb1dd7f99b0c to your computer and use it in GitHub Desktop.
Save neogeogre/4bef87d096c8e3056a50eb1dd7f99b0c to your computer and use it in GitHub Desktop.
Install globally a lib with cmake to make it avaiable for C++ project
Easiest way to add a lib to c++ project.
Download source code under `Downloads`:
```sh
cd /home/geoffrey/Downloads/mylib
cmake -DBUILD_SHARED_LIBS=ON .
make install
```
- `mylib` should be visible under `/usr/local/lib/cmake/`.
- Then in `CMakeLists.txt` use:
```cmake
find_package(mylib)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment