Back
Close

Introduction to cmake

raphaelmeyer
28.5K views

Time Display Library

Now, we are going to add the time display library to project, including the tests.

Exercise 5

Add the time display library to the project in the same way as the flux capacitor library. Include the tests as well.

  • Library time_display:

    • Alias target: time_machine::time_display
    • Private dependencies:
      • time_machine::time_travel
      • project::settings
  • Tests time_display-tests:

    • Alias target: tests::time_display
    • Run target: run-time_display-tests
    • Private dependencies:
      • time_machine::time_display
      • time_machine::time_travel
      • catchorg::catch2
      • project::settings
Folder structure
[project]/
+--- CMakeLists.txt
+--- time_display/
|    +--- CMakeLists.txt
|    +--- include/
|    |    +--- time_display/
|    |         +--- display.h
|    +--- src/
|    |    +--- colors.cc
|    |    +--- colors.h
|    |    +--- display.cc
|    |    +--- numbers.cc
|    |    +--- numbers.h
|    +--- tests/
|         +--- CMakeLists.txt
|         +--- colors.cc
|         +--- numbers.cc
|         +--- time_display.cc
|
+--- ...
Run CMake
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io