Flux Capacitor Library
Both commands support the keywords
INTERFACE to specify the usage requirements:
PRIVATENeeded by me, but not my dependants.
PUBLICNeeded by me and my dependants.
INTERFACENot needed by me, but by my dependants only.
Attention: Build targets that have source files should always list the files explicitly. Using a mechanism like file globing hides dependencies and prevents the build tools from correctly resolve build dependencies.
add_library(apple src/apple.cc src/peel.cc ) add_library(fruit::apple ALIAS apple) target_include_directories(apple PUBLIC include ) target_link_libraries(apple PRIVATE fruit::seeds PUBLIC fruit::edible )
flux_capacitor to the project.
As usual also add an alias target named
[project]/ +--- CMakeLists.txt +--- flux_capacitor/ | +--- CMakeLists.txt | +--- include/ | | +--- flux_capacitor/ | | +--- flux_capacitor.h | +--- src/ | +--- capacitor.cc | +--- capacitor.h | +--- flux_capacitor.cc | +--- flux.cc | +--- flux.h | +--- ...
The library has three source files:
The library is implementing the
It is used by the library and also part of its own public interface.
time_machine::time_travel interface is a public dependency.
Also, don't forget to add the
project::settings as a private dependency.
include folder is a public include directory.