From d8862c82c634adebcb85be98ea8b1fd90f0fcf06 Mon Sep 17 00:00:00 2001 From: Julien Peeters <julien.peeters@eove.fr> Date: Mon, 9 Dec 2024 09:50:22 +0000 Subject: [PATCH] cmake: use project name instead of hardcoded name This commit offers to give an arbitrary name to the Rust application project under CMake. Indeed, before this commit, the CMake project for the Rust application had the name `librustapp`. Now, it can be set with any value. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 637e48ce..35a418bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,8 +86,9 @@ function(rust_cargo_application) endif() set(BUILD_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${RUST_TARGET}/${RUST_BUILD_TYPE}") + set(RUST_LIBRARY_NAME "${CMAKE_PROJECT_NAME}") set(CARGO_TARGET_DIR "${CMAKE_CURRENT_BINARY_DIR}/rust/target") - set(RUST_LIBRARY "${CARGO_TARGET_DIR}/${RUST_TARGET}/${RUST_BUILD_TYPE}/librustapp.a") + set(RUST_LIBRARY "${CARGO_TARGET_DIR}/${RUST_TARGET}/${RUST_BUILD_TYPE}/lib${RUST_LIBRARY_NAME}.a") set(SAMPLE_CARGO_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/rust/sample-cargo-config.toml") # The generated C binding wrappers. These are bindgen-generated wrappers for the inline functions