Git Product home page Git Product logo

cmakecatch2_sample's Introduction

Sample project for CMake and Catch2.

This project demonstrates how to implement Catch2 for unit testing a class in a more sophisticated folder structure.

Directories:

\include - header files

\src - implementation

\lib - external libraries

\test - testing scripts

Compilation procedure

Navigate to the root build folder:

cd build

Execute cmake commands:

cmake ..

make

Execute main for running the main program:

./bin/main

Run tests:

./main_test

Additional CMake guides

1.) Cmake general guide https://preshing.com/20170511/how-to-build-a-cmake-based-project/

2.) Multiple source files (simple fix) https://riptutorial.com/cmake/example/22391/-hello-world--with-multiple-source-files

3.) Adding library https://cmake.org/cmake-tutorial/

4.) Catch2 intro https://medium.com/@junaidrahim/a-guide-to-using-catch2-for-unit-testing-in-c-f0f5450d05fb

5.) Simple Catch2 and Cmake sample: https://schneide.blog/2017/12/11/integrating-catch2-with-cmake-and-jenkins/

6.) Folder structure with separate headers and source files https://stackoverflow.com/questions/8304190/cmake-with-include-and-source-paths-basic-setup

cmakecatch2_sample's People

Contributors

qvandenberg avatar thomasfsteeples avatar

Watchers

 avatar  avatar

cmakecatch2_sample's Issues

Testing script does not work

The sequence of

cd test; mkdir build; cd build; cmake ..; make
produces the following error:

Scanning dependencies of target example_unit_test [ 20%] Building CXX object CMakeFiles/example_unit_test.dir/Users/Quincy/Documents/Code/Cpp_learnmaterial/catch2/cmake_standalone/tests/src/TrialClass.cpp.o [ 40%] Linking CXX static library libexample_unit_test.a [ 40%] Built target example_unit_test Scanning dependencies of target unit_tests [ 60%] Building CXX object CMakeFiles/unit_tests.dir/TrialClass.test.cpp.o [ 80%] Linking CXX executable unit_tests ld: library not found for -lCatch2::Test

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.