Skip to content

[Proposal] Targets API #6

@cyanidle

Description

@cyanidle

There should be a way to define different kinds of targets

  • Executables
  • Static libs
  • Shared libs
  • Custom build-steps

Bonus

  • Optimal object-files usage

I would really like if we could pull off something like this example (but as a first-class citizen)

add_library(xxx-objects OBJECT ${SRC})
add_library(xxx-static STATIC $<TARGET_OBJECTS:xxx-objects>)
add_library(xxx-shared SHARED $<TARGET_OBJECTS:xxx-objects>)

This is an example of advanced CMake, that allows to create 2 artifacts, without recompiling same set of .c sources twice. Also it decouples consumers of these libs at target-level (which allows ninja to compile consumer's object files at the same time as xxx libraries)

There are huge usability problems and caveats tho) It is very difficult to use such system correctly. Maybe we could do better?

This is a rather distant goal

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedAccepted proposalenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions