liyujie
2025-08-28 b3810562527858a3b3d98ffa6e9c9c5b0f4a9a8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// 200-Rpt-CatchMain.cpp
 
// In a Catch project with multiple files, dedicate one file to compile the
// source code of Catch itself and reuse the resulting object file for linking.
 
// Let Catch provide main():
#define CATCH_CONFIG_MAIN
 
#include <catch2/catch.hpp>
 
#ifdef   CATCH_EXAMPLE_RPT_1
#include CATCH_EXAMPLE_RPT_1
#endif
 
#ifdef   CATCH_EXAMPLE_RPT_2
#include CATCH_EXAMPLE_RPT_2
#endif
 
#ifdef   CATCH_EXAMPLE_RPT_3
#include CATCH_EXAMPLE_RPT_3
#endif
 
// That's it
 
// Compile implementation of Catch for use with files that do contain tests:
// - g++ -std=c++11 -Wall -I$(CATCH_ROOT) -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -o 200-Rpt-CatchMainTeamCity.o -c 200-Rpt-CatchMain.cpp
// cl -EHsc -I%CATCH_ROOT% -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -Fo200-Rpt-CatchMainTeamCity.obj -c 200-Rpt-CatchMain.cpp