Skip to content

Commit e8d4595

Browse files
committed
cmake: allow corrosion to be provided externally
the default behavior (retrieving Corrosion from github:corrosion-rs/corrosion) is not changed, but this change allows vcpkg or Nix to supply Corrosion instead.
1 parent 08e598c commit e8d4595

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

vmicore/rust_src/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
include(FetchContent)
2-
FetchContent_Declare(
3-
Corrosion
4-
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
5-
GIT_TAG stable/v0.4 # Newer versions require cmake 3.22 which is not available on Debian 11
6-
)
7-
FetchContent_MakeAvailable(Corrosion)
1+
find_package(Corrosion CONFIG)
2+
if (NOT Corrosion_FOUND)
3+
include(FetchContent)
4+
FetchContent_Declare(
5+
Corrosion
6+
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
7+
GIT_TAG stable/v0.4 # Newer versions require cmake 3.22 which is not available on Debian 11
8+
)
9+
FetchContent_MakeAvailable(Corrosion)
10+
endif()
811

912
corrosion_import_crate(MANIFEST_PATH Cargo.toml)
1013
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")

0 commit comments

Comments
 (0)