You are looking at lesson 7. Your place is still lesson 1, task 1: Algorithm.
add_executable and add_library, target_include_directories and target_link_libraries, PUBLIC and PRIVATE. course_input is the same kind of library.
To CMake a program is a set of targets: what gets built and from which files. So far each CMakeLists.txt had one add_executable per program. Now you need two more commands.
add_executable(p07_duration main.c daytime.c)
add_executable is a program: .c files, one of which has main. .h files don't go in the list: #include pastes them in.
add_library(p07_daytime STATIC daytime.c)
add_library is a library: compiled .c files without main that several programs can use. STATIC means the library's code is copied into every program that uses it.
target_include_directories(p07_daytime PUBLIC .)
target_link_libraries(p07_duration PRIVATE p07_daytime)
target_include_directories – where to look for the library's .h files. . is this folder.target_link_libraries – the program uses the library: the linker adds its code and the compiler finds its .h.PUBLIC holds for those who use the library too; PRIVATE only for the target itself.The course's main CMakeLists.txt has exactly such a library:
add_library(course_input STATIC src/input.c)
target_include_directories(course_input PUBLIC include)
Every program of yours has target_link_libraries(... PRIVATE course_input), so #include "input.h" finds include/input.h and read_int comes from src/input.c. From topic 9 you write this library yourself.
CLion reloads the CMake project by itself. If a target is missing from the list, use File → Reload CMake Project. A new target shows up in the configuration list next to ▶.
Each one ticks itself when you do it.
All six done. You know your way around.
It is laid out like CLion: the same panels in the same places. This tour shows each one, and you can reopen it any time with Tour.
Switches the left panel: Lesson plan, Project files, Changes. Click the active icon again to hide the panel.
In CLion: the tool window bar runs down the left edge, too.
This part is not on this task: it appears when a task needs it.
Every task in this lesson. Now marks your place. Clicking a task only lets you look; it never moves your place. Project files and Changes open here too.
In CLion: this spot holds the Project view (the file tree).
This part is not on this task: it appears when a task needs it.
Opens the file for your task by itself. A tab appears for each file the step opens. The breadcrumbs above the code show the folder.
In CLion: the same editor tabs and breadcrumbs.
This part is not on this task: it appears when a task needs it.
Diff shows what changed, like git diff: red is the old code, green the new.
In CLion: the diff view in the Commit window looks the same.
This part is not on this task: it appears when a task needs it.
Terminal for build commands, Database to see your tables. They open by themselves when a task needs them. Drag the top edge to resize.
In CLion: Terminal, and the Database tool window.
This part is not on this task: it appears when a task needs it.
What to do now, right above the code, so you never miss it. Numbered notes in the code explain the important lines. Details shows what you should see and a hint.
In CLion: no equivalent: this is your lecturer's guide.
This part is not on this task: it appears when a task needs it.
Done is the only button that moves you forward. Look back lets you review without losing your place.
This part is not on this task: it appears when a task needs it.
Guided, Focus code or Floating. You can drag the panel edges too. Your layout is remembered for next time.
In CLion: you can also rearrange and hide tool windows.
This part is not on this task: it appears when a task needs it.
Six small missions. Each one ticks itself when you do it, so you know you have found everything.