Following Recipe 7, Limiting scope with add_subdirectory, we will discuss the CMake structure from the bottom up, from the individual CMakeLists.txt files defining each library, such as src/evolution/CMakeLists.txt:
add_library(evolution "")target_sources(evolution PRIVATE
empty.f90 PUBLIC ${CMAKE_CURRENT_LIST_DIR}/ancestors.f90 ${CMAKE_CURRENT_LIST_DIR}/evolution.f90 )
These individual CMakeLists.txt files define libraries as close as possible to the sources, following the same reasoning as in previous two recipes: code developers with knowledge of this library and possibly limited knowledge of the CMake framework only need to edit files in this directory: divide and conquer.
We first define the library name with add_library ...