Skip to content

Targets

Nikita Ivanov edited this page Oct 26, 2023 · 2 revisions

Overview

A target is the cornerstone of Re. If you come from CMake, the concept of targets there is pretty much identical.

Targets can depend on, and be depended on by, other targets.

Targets can include tasks and actions to be performed before, during or after their build process.

Common Types

Targets can be of different types:

  • Executable (type: executable) targets:
    • Can be launched directly
    • Compiled into native executables (.exe, ELF, Mach-O)
    • Can be started via re run
  • Static library (type: static-library) targets:
    • Compiled into native static libraries (.lib, .a)
    • Can be depended on by other targets, including other static libraries
    • Linked to via the platform linker
    • (NOTE: other target types can technically be depended on as well, but that will only alter the build order to put the dependency first)
  • Shared library (type: shared-library) targets:
    • Compiled into native shared libraries (.dll, .so, .dylib)
    • At this moment, you cannot automatically depend on them them properly through Re.
  • Project (type: project) targets:
    • Not compiled themselves: they can contain other targets, which will be built with the project
    • Adding a project target into your dependencies will make your target depend on everything the project target contains
    • Source files directly contained in project targets are silently ignored

A typical big Re project usually consists of one type: project target that contains multiple other targets in a tree hierarchy.

Smaller Re projects may only include a single static library or executable target.

Root Target

The root target is the target in the directory of which you’re running re.

It has some minor special properties described on other pages.

Differences with CMake

Unlike CMake, Re does not have the “object library” target type and does not include support for interface targets.

Clone this wiki locally