cmake可见性和AppArmor示例
This commit is contained in:
parent
0eeb4a7bb6
commit
4b4b933e3d
19 changed files with 661 additions and 0 deletions
19
cmake/visibility/app/main.cpp
Normal file
19
cmake/visibility/app/main.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <printer/printer.h>
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
Printer p;
|
||||
p.print("hello", Color::Green);
|
||||
|
||||
// COLOR_ENABLE_BRIGHT 是 color 的 PUBLIC 宏,
|
||||
// 顺着 app → printer → color 传播到这里,本分支会被编译进去:
|
||||
#ifdef COLOR_ENABLE_BRIGHT
|
||||
std::cout << brightColorCode(Color::Red) << "bright red" << "\033[0m\n";
|
||||
#endif
|
||||
|
||||
// PRINTER_TIME_FORMAT 是 printer 的 PRIVATE 宏,这里看不见:
|
||||
#ifdef PRINTER_TIME_FORMAT
|
||||
std::cout << "leaked!\n"; // 永远不会被编译进去
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue