mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-05 19:55:47 +03:00
rust: find cargo with find_program to give a better error message when cargo isn't available
Summary: If you build Watchman from source on a machine without cargo, the error message was confusing. You'd see "command not found" somewhere mixed into ninja's output. Change RustStaticLibrary, which is only used by Watchman and EdenFS, to find cargo with find_program instead of guessing its name and assuming it exists. This gives a much less confusing error message at CMake configure time. Reviewed By: genevievehelsel Differential Revision: D40441374 fbshipit-source-id: eeafe615616775c660c700e14cf1f6b2fd9715a8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
183aafb352
commit
1bb69c04c1
@@ -58,6 +58,8 @@ if(GENERATE_CARGO_VENDOR_CONFIG)
|
||||
)
|
||||
endif()
|
||||
|
||||
find_program(CARGO_COMMAND cargo REQUIRED)
|
||||
|
||||
# Cargo is a build system in itself, and thus will try to take advantage of all
|
||||
# the cores on the system. Unfortunately, this conflicts with Ninja, since it
|
||||
# also tries to utilize all the cores. This can lead to a system that is
|
||||
@@ -119,11 +121,6 @@ function(rust_static_library TARGET)
|
||||
set(staticlib_name "${CMAKE_STATIC_LIBRARY_PREFIX}${crate_name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
set(rust_staticlib "${CMAKE_CURRENT_BINARY_DIR}/${target_dir}/${staticlib_name}")
|
||||
|
||||
set(cargo_cmd cargo)
|
||||
if(WIN32)
|
||||
set(cargo_cmd cargo.exe)
|
||||
endif()
|
||||
|
||||
if(DEFINED ARG_FEATURES)
|
||||
set(cargo_flags build $<IF:$<CONFIG:Debug>,,--release> -p ${crate_name} --features ${ARG_FEATURES})
|
||||
else()
|
||||
@@ -142,7 +139,7 @@ function(rust_static_library TARGET)
|
||||
"${CMAKE_COMMAND}" -E env
|
||||
"CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${extra_cargo_env}
|
||||
${cargo_cmd}
|
||||
${CARGO_COMMAND}
|
||||
${cargo_flags}
|
||||
COMMENT "Building Rust crate '${crate_name}'..."
|
||||
JOB_POOL rust_job_pool
|
||||
@@ -195,11 +192,6 @@ function(rust_executable TARGET)
|
||||
set(features )
|
||||
endif()
|
||||
|
||||
set(cargo_cmd cargo)
|
||||
if(WIN32)
|
||||
set(cargo_cmd cargo.exe)
|
||||
endif()
|
||||
|
||||
if(DEFINED ARG_FEATURES)
|
||||
set(cargo_flags build $<IF:$<CONFIG:Debug>,,--release> -p ${crate_name} --features ${ARG_FEATURES})
|
||||
else()
|
||||
@@ -219,7 +211,7 @@ function(rust_executable TARGET)
|
||||
"${CMAKE_COMMAND}" -E env
|
||||
"CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${extra_cargo_env}
|
||||
${cargo_cmd}
|
||||
${CARGO_COMMAND}
|
||||
${cargo_flags}
|
||||
COMMENT "Building Rust executable '${crate_name}'..."
|
||||
JOB_POOL rust_job_pool
|
||||
|
Reference in New Issue
Block a user