Introduction to cmake

raphaelmeyer
28.6K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

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
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content