diff --git a/00_targets/README.md b/00_targets/README.md index 74624226fc46c87a33291e4e99058214c30f00c7..e3727de4813b04daac621d28401865d1908ebeb7 100644 --- a/00_targets/README.md +++ b/00_targets/README.md @@ -1,11 +1,31 @@ -# Define Targets +# Think in targets! + +This recipe illustrates how to build a basic application. +It consists of a backend library and an application frontend. + +## Define the target type [add_library]([https://cmake.org/cmake/help/latest/command/add_library.html]) [add_executable]([https://cmake.org/cmake/help/latest/command/add_executable.html]) -# Set Target Properties -[target_compile_definitions]([https://cmake.org/cmake/help/latest/command/target_compile_definitions.html]) -[target_compile_options]([https://cmake.org/cmake/help/latest/command/target_compile_options.html]) -[target_include_directories]([https://cmake.org/cmake/help/latest/command/target_include_directories.html]) -[target_link_libraries]([https://cmake.org/cmake/help/latest/command/target_link_libraries.html]) -[target_link_options]([https://cmake.org/cmake/help/latest/command/target_link_options.html]) -[target_sources]([https://cmake.org/cmake/help/latest/command/target_sources.html]) \ No newline at end of file +## Set target properties +| Aim | Command | +|----------------------------------------|-------------------------------------------------------------------------------------------------------------| +| add definitions | [target_compile_definitions]([https://cmake.org/cmake/help/latest/command/target_compile_definitions.html]) | +| add compile flags | [target_compile_options]([https://cmake.org/cmake/help/latest/command/target_compile_options.html]) | +| add include directories | [target_include_directories]([https://cmake.org/cmake/help/latest/command/target_include_directories.html]) | +| add a dependency, link against library | [target_link_libraries]([https://cmake.org/cmake/help/latest/command/target_link_libraries.html]) | +| add linker options | [target_link_options]([https://cmake.org/cmake/help/latest/command/target_link_options.html]) | +| add sources | [target_sources]([https://cmake.org/cmake/help/latest/command/target_sources.html]) | + +## Usage requirements +https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#transitive-usage-requirements + +| keyword | result | +|---------------|------------------------------------------------------------| +| **PRIVATE** | only relevant for the target | +| **INTERFACE** | only relevant for targets depending on this target | +| **PUBLIC** | relevant for both, the target itself and dependent targets | + +## How to link against a "supported" third-party library? +Find the library with [find_package]([https://cmake.org/cmake/help/latest/command/find_package.html]) and link against +the imported target with [target_link_libraries]([https://cmake.org/cmake/help/latest/command/target_link_libraries.html]). \ No newline at end of file