corrosion
v0.5.0
Corrosion, früher als CMake-Cargo bekannt, ist ein Werkzeug zur Integration von Rost in ein vorhandenes CMake-Projekt. Korrosion kann automatisch ausführbare, statische Bibliotheken und dynamische Bibliotheken aus einem Arbeitsbereich oder Paketmanifest ( Cargo.toml -Datei) importieren.
Mit dem CMake FetchContent -Modul können Sie Korrosion einfach in Ihren Build integrieren. Andere Methoden, einschließlich der Installation von Korrosion oder dem Hinzufügen als Unterverzeichnis, werden im Setup -Kapitel der Korrosionsdokumentation behandelt.
include (FetchContent)
FetchContent_Declare(
Corrosion
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
GIT_TAG v0.5 # Optionally specify a commit hash, version tag or branch here
)
FetchContent_MakeAvailable(Corrosion)
# Import targets defined in a package or workspace manifest `Cargo.toml` file
corrosion_import_crate(MANIFEST_PATH rust-lib/Cargo.toml)
add_executable (your_cpp_bin main.cpp)
target_link_libraries (your_cpp_bin PUBLIC rust-lib)