cmake: add support for vendored cmake

Use a "cmake-vendored" directory if it exists, to avoid accessing the
network if it's available, and a target to create an appropriate tarball
to create that directory.
This commit is contained in:
David Adam 2023-03-30 12:01:23 +08:00
parent 3ae16a5b95
commit 1c978f7ec5

View file

@ -1,3 +1,6 @@
if(EXISTS "${CMAKE_SOURCE_DIR}/corrosion-vendor/")
add_subdirectory("${CMAKE_SOURCE_DIR}/corrosion-vendor/")
else()
include(FetchContent)
# Don't let Corrosion's tests interfere with ours.
@ -11,6 +14,13 @@ FetchContent_Declare(
FetchContent_MakeAvailable(Corrosion)
add_custom_target(corrosion-vendor.tar.gz
COMMAND git archive --format tar.gz --output "${CMAKE_BINARY_DIR}/corrosion-vendor.tar.gz"
--prefix corrosion-vendor/ HEAD
WORKING_DIRECTORY ${corrosion_SOURCE_DIR}
)
endif()
set(fish_rust_target "fish-rust")
set(fish_autocxx_gen_dir "${CMAKE_BINARY_DIR}/fish-autocxx-gen/")