Git Product home page Git Product logo

googletest-with-cmake's Introduction

A sample project for how to setup googletest with CMake. The detailed blog can be found here

https://youyue123.github.io/tech/2018/01/29/TDD-for-C++-in-CMake-And-GoogleTest.html

File Structure

├── build                     # build folder for this project
    ├── src
    │   ├── sample_lib_1          # Sample Library 1 folder
    │   │   ├── sample_lib_1.cpp  # Implementation file for Sample Library 1
    │   │   ├── sample_lib_1.hpp  # Declarition file for Sample Library 1
    │   │   ├── CMakeList.txt     # CMake definition file for Sample Library 1
    │   ├── sample_lib_2          # Same as above structure
    │   │   ├── sample_lib_2.cpp  
    │   │   ├── sample_lib_2.hpp  
    │   │   ├── CMakeList.txt    
    │   ├── CMakeList.txt         # CMake defination for the whole src folder
    │   └── main.cpp              # Main entrance
    ├── tests                
    │   ├── testSampleLib1        # Test Sample Lib 1 folder
    │   │   ├── CMakeLists.txt    # CMake defination for Test Sample Lib 1 folder
    │   │   ├── testSampleLib1.cpp# Test case implementation file 
    │   │   ├── testSampleLib1.hpp# Test case declaration file
    │   │   ├── main.cpp          # Entrance of this test case
    │   │   ├── testSampleLib1.cpp    
    │   ├── testSampleLib2        # Similar to testSampleLib1
    │   │   ├── ...
    │   │   ├── ...   
    │   │   ├── ...
    │   │   ├── ...
    │   │   └── ...
    │   └── CMakeLists.txt        # CMake defination for the whole tests folder
    └── CMakeLists.txt

Build

mkdir build
cd build
cmake ..
make

Run Test

cd build && make test

Refer to this blog post for a detailed explaination of how it works.

googletest-with-cmake's People

Contributors

youyue123 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.