godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.7k stars 528 forks source link

Make godot-cpp installable with cmake config #1418

Closed ytnuf closed 1 month ago

ytnuf commented 6 months ago

This PR allows this library to be installable.

# after building it
cmake --install <insert_build_directory_here> --component godot-cpp-dev

The reason is so that this can be easily installed via a package manager without resorting to patches.

This project uses the standard CMAKEINSTALL* variables, so that the package manager can decide where to install the various artifacts of this package.

Also provides:

From a user's perspective they can use this library like so:

find_package("godot-cpp" 4.2.0 CONFIG REQUIRED)
target_link_library("my-gdextension-project" PRIVATE "godot::cpp")

Note that the target library's name godot::cpp is the consistent as when used via find_package or as a sub-project.

AThousandShips commented 6 months ago

Please open a proposal to track the support and details of this feature, this is pretty specific and we'd need to judge the actual demand