diff --git a/src/lib.rs b/src/lib.rs index 5f7da21..f6b98c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -232,7 +232,7 @@ pub fn compile_for, J: Display, I: IntoIterator, Ms: As } } -/// Likewise, but only link the resource to test binaries. +/// Likewise, but only link the resource to test binaries (select types only. unclear which (and likely to change). you may prefer [`compile_for_everything()`]). /// /// Only available since rustc 1.60.0, does nothing before. pub fn compile_for_tests, Ms: AsRef, Mi: IntoIterator>(resource_file: T, macros: Mi) { @@ -259,6 +259,15 @@ pub fn compile_for_examples, Ms: AsRef, Mi: IntoIterator, Ms: AsRef, Mi: IntoIterator>(resource_file: T, macros: Mi) { + if let Some((_, _, out_file)) = compile_impl(resource_file.as_ref(), macros) { + println!("cargo:rustc-link-arg={}", out_file); + } +} + fn compile_impl, Mi: IntoIterator>(resource_file: &Path, macros: Mi) -> Option<(&str, String, String)> { let comp = ResourceCompiler::new(); if comp.is_supported() {