Skip to content

tawez/CMakeUnit-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMakeUnit-example

A project that illustrates how you can use CMakeUnit to test CMake code.

This is (or at least should be) a self-explanatory example.

Examples in this project

  1. generic
    Examples illustrating key concepts behind CMakeUnit

  2. assertions
    Examples illustrating usage of CMakeUnit assertions

  3. mocks
    Examples illustrating usage of CMakeUnit mocks

  4. set
    Example of how to test custom macro

Project setup

In CMakeLists.txt do the following

Add CMakeUnit to your project

There are at least three ways to add CMakeUnit to your project:

  1. Add CMakeUnit using FetchContent and add CMakeUnit source folder to CMAKE_MODULE_PATH (see CMakeLists.txt).

  2. Add CMakeUnit as a git submodule and add path to CMakeUnit root folder to CMAKE_MODULE_PATH

    list(PREPEND CMAKE_MODULE_PATH "path/to/CMakeUnit")
  3. Add a copy of CMakeUnit.cmake to the folder of your choice and add this folder to CMAKE_MODULE_PATH

    list(PREPEND CMAKE_MODULE_PATH "path/to/folder")

Project structure

You may organize the code in the way the most suits your needs. CMakeUnit does not force anything in this matter. Readability should be the rule of thumb.

About

Example project using CMakeUnit to test CMake code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages