cmake_parser/doc/command/deprecated/
qt_wrap_ui.rs

1use cmake_parser_derive::CMake;
2
3use crate::{
4    doc::command_scope::{CommandScope, ToCommandScope},
5    Token,
6};
7
8/// Manually create Qt user interfaces Wrappers.
9///
10/// Reference: <https://cmake.org/cmake/help/v3.26/command/qt_wrap_ui.html>
11#[derive(CMake, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[cmake(pkg = "crate", positional)]
13pub struct QtWrapUi<'t> {
14    pub lib: Token<'t>,
15    pub headers_dest: Token<'t>,
16    pub sources_dest: Token<'t>,
17    pub source_lists: Vec<Token<'t>>,
18}
19
20impl<'t> ToCommandScope for QtWrapUi<'t> {
21    fn to_command_scope(&self) -> CommandScope {
22        CommandScope::Deprecated
23    }
24}
25
26#[cfg(test)]
27mod tests {
28    use super::*;
29    use crate::doc::cmake_parse::tests::{token, tokens_vec};
30    use crate::*;
31    use pretty_assertions::assert_eq;
32
33    #[test]
34    fn qt_wrap_ui() {
35        let src = include_bytes!("../../../../../fixture/commands/deprecated/qt_wrap_ui");
36        let cmakelists = parse_cmakelists(src).unwrap();
37        let doc = Doc::from(cmakelists);
38        assert_eq!(
39            doc.commands(),
40            Ok(vec![Command::QtWrapUi(Box::new(QtWrapUi {
41                lib: token(b"lib1"),
42                headers_dest: token(b"headers_dest1"),
43                sources_dest: token(b"sources_dest1"),
44                source_lists: tokens_vec([b"source_lists1", b"source_lists2"]),
45            })),])
46        )
47    }
48}