https://github.com/cwsmith/cmakehelloworld
example of basic cmake usage to build a library with public and internal headers and a 'test' that exercises public APIs
https://github.com/cwsmith/cmakehelloworld
Last synced: 4 months ago
JSON representation
example of basic cmake usage to build a library with public and internal headers and a 'test' that exercises public APIs
- Host: GitHub
- URL: https://github.com/cwsmith/cmakehelloworld
- Owner: cwsmith
- License: bsd-3-clause
- Created: 2019-06-28T19:34:05.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-28T21:08:25.000Z (almost 7 years ago)
- Last Synced: 2025-03-01T00:39:14.418Z (over 1 year ago)
- Language: CMake
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Derived from: https://cmake.org/examples/
## layout
- src - source code, `hello.h` is the public header and will be installed with `make
install`
- test - example code that exercises APIs in the public header
- CMakeLists.txt - cmake files that specify how to build the library and test
## setup
```
git clone git@github.com:cwsmith/cmakeHelloWorld.git
mkdir buildCmakeHelloWorld
```
## build
The following assumes that a valid C and C++ compiler, and `cmake`, are in your PATH.
`CMAKE_INSTALL_PREFIX` is the path where the library, headers, and test binary
are installed.
```
cd buildCmakeHelloWorld
cmake ../cmakeHelloWorld -DCMAKE_INSTALL_PREFIX=$PWD/install
make
make install
```
## test
```
./install/bin/helloDemo
```