diff --git a/api/cpp/CMakeLists.txt b/api/cpp/CMakeLists.txt index 94862795fa9..65506777718 100644 --- a/api/cpp/CMakeLists.txt +++ b/api/cpp/CMakeLists.txt @@ -9,13 +9,17 @@ project(Slint HOMEPAGE_URL "https://slint.dev/" LANGUAGES C CXX VERSION 1.10.0) include(FeatureSummary) include(CMakeDependentOption) -include(FetchContent) -FetchContent_Declare( - Corrosion - GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git - GIT_TAG v0.5.1 -) -FetchContent_MakeAvailable(Corrosion) +find_package(Corrosion QUIET 0.5) +if (NOT Corrosion_FOUND) + include(FetchContent) + FetchContent_Declare( + Corrosion + GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git + GIT_TAG v0.5.1 + ) + + FetchContent_MakeAvailable(Corrosion) +endif (NOT Corrosion_FOUND) list(PREPEND CMAKE_MODULE_PATH ${Corrosion_SOURCE_DIR}/cmake) find_package(Rust 1.82 REQUIRED MODULE)