diff --git a/CMakeLists.txt b/CMakeLists.txt index 76b200a..2ef6145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ endif() include(FeatureSummary) +find_program(CARGO cargo) + # Find Qt modules find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index 7899c91..1cfa171 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -43,7 +43,7 @@ add_custom_command( # compile the rust code into a static library add_custom_command( OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/rust/${RUST_TARGET_DIR}/librust.a" - COMMAND cargo build ${RUST_BUILD_FLAG} + COMMAND ${CARGO} build ${RUST_BUILD_FLAG} DEPENDS rust/src/lib.rs rust/src/fibonacci_interface.rs rust/src/fibonacci_implementation.rs diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9c66041..0a10d39 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,7 +21,7 @@ function(rust_test NAME DIRECTORY) add_custom_command( OUTPUT "${DIR}/${RUST_TARGET_DIR}/librust.a" - COMMAND cargo build ${RUST_BUILD_FLAG} + COMMAND ${CARGO} build ${RUST_BUILD_FLAG} DEPENDS "${DIR}/src/lib.rs" "${DIR}/src/implementation.rs" "${DIR}/src/interface.rs" @@ -52,7 +52,7 @@ function(rust_test NAME DIRECTORY) add_custom_command( OUTPUT "clean_${NAME}" - COMMAND cargo clean + COMMAND ${CARGO} clean WORKING_DIRECTORY "${DIR}" ) add_custom_target("clean-${NAME}" DEPENDS "clean_${NAME}")