Extend HEADER_GUARD documentation

Specify the possible values explicitly and extend the description.

Amends 4410e9c7a9

Task-number: QTBUG-125406
Pick-to: 6.9
Change-Id: Ic44b22f5959555119442672a96b0b237a6bd3813
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Alexey Edelev 2024-12-30 14:50:26 +01:00
parent c42df9cad0
commit 28f4b35830
3 changed files with 18 additions and 4 deletions

View File

@ -24,7 +24,7 @@ Usually \c qtgrpcgen is invoked through the \c qt_add_grpc CMake macro.
[EXPORT_MACRO <infix>]
[OUTPUT_HEADERS <var>]
[OUTPUT_TARGETS <var>]
[HEADER_GUARD <string>]
[HEADER_GUARD <pragma|filename>]
)
\endcode

View File

@ -26,7 +26,7 @@ invoked through CMake using the \c qt_add_protobuf command.
[EXPORT_MACRO <infix>]
[OUTPUT_HEADERS <var>]
[OUTPUT_TARGETS <var>]
[HEADER_GUARD <string>]
[HEADER_GUARD <pragma|filename>]
)
\endcode

View File

@ -75,6 +75,20 @@
//! [header_guard-li]
\li \c {HEADER_GUARD}
specifies the mechanism used for guarding generated header files from
multiple inclusion. Possible values are \c {<pragma | filename>}. Defaults
to \c {filename}
multiple inclusion. Possible values are \c pragma, \c filename. Defaults
to \c {filename}.
Setting the option to \c pragma generates the modern pragma header guard:
\code
#pragma once
...
\endcode
Omitting the option or setting the option to \c filename generates the
\c ifdef wrapping guard, and uses the '.proto' filename as the guard infix:
\code
#ifdef MYMESSAGES_QPB_H
#define MYMESSAGES_QPB_H
...
#endif // MYMESSAGES_QPB_H
\endcode
Select the preferred guard style according to your project structure.
//! [header_guard-li]