Here the short sample how-to use Google C++ Test Framework in cmakeable projects
- Google test will be downloaded from GitHub and built with your project
How to use:
- git clone https://github.com/snikulov/google-test-examples.git
- cd google-test-examples
- mkdir build
- cd build
- cmake ..
- cmake --build .
- ctest -VV
Known issues:
- Google Test (master branch) was broken for MinGW (see google/googletest#606) As workaround we'll use -Dgtest_disable_pthreads=ON as suggested per google/shaderc#174
## Get repo
$ git clone https://github.com/snikulov/google-test-examples.git
$ cd google-test-examples
We can use CMake to configure/build/running tests:
### Host side
$ cmake -P build.cmake
### Docker Containers side
cmake -P build_with_docker.cmake
### Targets
$ make [tab]
make all
all build/Makefile configure google-test-examples_test
build clean DOCKER_COMMAND run
build_directory clean_docker_image docker_image
build_docker_image CMAKE_COMMAND DOCKER_IMAGE
### Configure/Build/Running tests (with docker containers)
$ make all
docker build -t atty/google-test-examples:latest --file docker/Dockerfile .
Sending build context to Docker daemon 221.2kB
Step 1/1 : FROM rikorose/gcc-cmake:latest
...
1/1 Test #1: test1 ............................ Passed 0.00 sec
100% tests passed, 0 tests failed out of 1
Total Test time (real) = 0.00 sec