Skip to content

Commit a37fc59

Browse files
committed
cmake: only add Rust object if CONFIG_RUST
Also use correct variable for object output file.
1 parent 7f13bc9 commit a37fc59

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ add_custom_command(
112112
${rust_ldscript}
113113
-Wl,--whole-archive ${rust_staticlib}
114114
-Wl,--no-whole-archive $<TARGET_OBJECTS:rust_c>
115-
-o rust_obj.obj
115+
-o ${rust_obj}
116116
DEPENDS ${rust_staticlib} $<TARGET_OBJECTS:rust_c>
117117
COMMAND_EXPAND_LISTS
118118
)
119119
add_custom_target(rust_final DEPENDS ${rust_obj})
120-
zephyr_library_import(rust ${rust_obj})
121-
add_dependencies(rust rust_final)
120+
if(CONFIG_RUST)
121+
zephyr_library_import(rust ${rust_obj})
122+
add_dependencies(rust rust_final)
123+
endif()

0 commit comments

Comments
 (0)