14 lines
469 B
CMake
14 lines
469 B
CMake
option(LOCAL_CBINDGEN "Download and build `cbindgen` even if one can be found on the system")
|
|
|
|
if(NOT LOCAL_CBINDGEN)
|
|
find_program(CBINDGEN cbindgen)
|
|
endif()
|
|
|
|
if(NOT CBINDGEN)
|
|
message(CONFIGURE_LOG "cbindgen not found, downloading...")
|
|
set(crates "${CMAKE_BINARY_DIR}/crates")
|
|
file(MAKE_DIRECTORY ${crates})
|
|
execute_process(COMMAND ${CARGO} install --root ${crates} cbindgen@0.29.4)
|
|
set(CACHE{CBINDGEN} TYPE FILEPATH FORCE VALUE "${crates}/bin/cbindgen")
|
|
endif()
|