https://github.com/jke94/cmakesharedlib
Example of shared library. Using docker and cmake, to build shared library, install it in a Linux environment, and used by a client.
https://github.com/jke94/cmakesharedlib
cpp docker docker-compose linux shared-library
Last synced: 2 months ago
JSON representation
Example of shared library. Using docker and cmake, to build shared library, install it in a Linux environment, and used by a client.
- Host: GitHub
- URL: https://github.com/jke94/cmakesharedlib
- Owner: jke94
- Created: 2022-09-07T20:47:03.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-10T17:48:14.000Z (almost 4 years ago)
- Last Synced: 2025-06-26T12:02:33.564Z (about 1 year ago)
- Topics: cpp, docker, docker-compose, linux, shared-library
- Language: C++
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CMakeSharedLib
Example of shared library. Using docker and cmake, to build shared library, install it in a Linux environment, and used by a client.
## A. Build shared lib and install it.
- From "HeroesLibrary/build" directory as base directory:
### 1. Make the generator and build from the build directory.
```
cmake ..
```
### 2. Make
```
make
```
### 3. Make the library available system wide. This will install and place in /usr/lib
```
sudo make install
```
## B. Consume shared lib by a client.
- From "HeroesClient/build" directory as base directory:
### 1. Make the generator and build from the build directory.
```
cmake ..
```
### 2. Make
```
make
```
### 3. Run executable
```
./main
```
## C. Docker.
- From base repository folder as base directory:
### 1. Docker-compose: build library.
```
sudo docker compose -f ./docker-compose.yml -p cpp-container up --build
```
## References
- [A minimal example using cmake to create a c++ shared library](https://surfertas.github.io/cmake/cpp/projecteuler/2019/05/01/cmake.html)