An open API service indexing awesome lists of open source software.

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

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
```