Skip to content

Commit 6c94838

Browse files
jnboothLeonMatthesKDAB
authored andcommitted
qt-build-utils: treat .obj files as object files
1 parent ab544c7 commit 6c94838

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

crates/qt-build-utils/src/parse_cflags.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ fn extract_lib_from_filename<'a>(target: &str, filename: &'a str) -> Option<&'a
7373
}
7474
}
7575

76+
/// Tests whether a file is an object file to be linked.
77+
fn is_object_file(path: &std::path::Path) -> bool {
78+
let Some(ext_os) = path.extension() else {
79+
return false;
80+
};
81+
let Some(ext) = ext_os.to_str() else {
82+
return false;
83+
};
84+
ext == "o" || ext == "obj"
85+
}
86+
7687
/// Split link_args produced by pkg-config --cflags and / or --libs into separate flags.
7788
///
7889
/// Backslash in link_args is used to preserve literal meaning of following byte. Different words are
@@ -172,7 +183,7 @@ pub(crate) fn parse_libs_cflags(name: &str, link_args: &[u8], _builder: &mut cc:
172183
(path.parent(), path.file_name(), &target)
173184
{
174185
let file_name = file_name.to_string_lossy();
175-
if file_name.ends_with(".o") {
186+
if is_object_file(path) {
176187
#[cfg(feature = "link_qt_object_files")]
177188
{
178189
let path_string = path.to_string_lossy().to_string();

0 commit comments

Comments
 (0)