build-cpp / cmkr

Modern build system based on CMake and TOML.
https://cmkr.build
MIT License
425 stars 28 forks source link

Implement seamless packaging #16

Open mrexodia opened 3 years ago

mrexodia commented 3 years ago

Ideally writing

[project]
name = "example"
version = "1.0"

[find-package]
fmt = {}

[target.mylib]
type = "static"
sources = ["..."]
link-libraries = ["fmt::fmt"]

[target.otherlib]
type = "static"
sources = ["..."]

[target.mytool]
type = "static"
sources = ["..."]
link-libraries = ["mylib", "otherlib"]

[package]
targets = ["mylib", "otherlib", "mytool"]
dependency-packages = ["fmt"]

Should automatically generate a modern CMake example (project.name) package with a exampleConfig.cmake file that has IMPORTED targets, versioning and the relevant find_package calls. This library can then be consumed with:

[find-package]
example = { version = "1.0" }

Perhaps this could be used? https://github.com/TheLartians/PackageProject.cmake

mrexodia commented 2 years ago

WIP branch: https://github.com/build-cpp/cmkr/tree/package