Skip to content

Commit 0c13d02

Browse files
pkubanekhorenmar
authored andcommitted
Update documentation - add pkg-config examples.
Use -std=c++14 (instead of c++11). Pointers how to integrate with pkg-config for non-CMake projects.
1 parent 3644b41 commit 0c13d02

8 files changed

+13
-9
lines changed

docs/migrate-v2-to-v3.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ compilation times in the v3 version. The basic steps to do so are:
5050

5151
1. Change your CMakeLists.txt to link against `Catch2WithMain` target if
5252
you use Catch2's default main. (If you do not, keep linking against
53-
the `Catch2` target.)
53+
the `Catch2` target.). If you use pkg-config, change `pkg-config catch2` to
54+
`pkg-config catch2-with-main`.
5455
2. Delete TU with `CATCH_CONFIG_RUNNER` or `CATCH_CONFIG_MAIN` defined,
5556
as it is no longer needed.
5657
3. Change `#include <catch2/catch.hpp>` to `#include <catch2/catch_all.hpp>`

examples/010-TestCase.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TEST_CASE( "Factorials of 1 and higher are computed (pass)", "[single-file]" ) {
1919
}
2020

2121
// Compile & run:
22-
// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success
22+
// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success
2323
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 010-TestCase.cpp && 010-TestCase --success
2424

2525
// Expected compact output (all assertions):

examples/020-TestCase-1.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:
1010
// Here just to show there are two source files via option --list-tests.
1111

1212
// Compile & run:
13-
// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp
14-
// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success
13+
// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp
14+
// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success
1515
//
1616
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 020-TestCase-1.cpp
1717
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -Fe020-TestCase.exe 020-TestCase-1.obj 020-TestCase-2.cpp && 020-TestCase --success

examples/030-Asn-Require-Check.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ TEST_CASE( "Assert that something is false (continue after failure)", "[check-fa
5353
}
5454

5555
// Compile & run:
56-
// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 030-Asn-Require-Check 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success
56+
// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 030-Asn-Require-Check 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success
5757
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success
5858

5959
// Expected compact output (all assertions):

examples/100-Fix-Section.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
4545
}
4646

4747
// Compile & run:
48-
// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp && 100-Fix-Section --success
48+
// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp && 100-Fix-Section --success
4949
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 100-Fix-Section.cpp && 100-Fix-Section --success
5050

5151
// Expected compact output (all assertions):

examples/110-Fix-ClassFixture.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ TEST_CASE_METHOD( UniqueTestsFixture, "Create Employee/Normal", "[create]" ) {
5252
}
5353

5454
// Compile & run:
55-
// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success
55+
// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success
5656
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success
57+
//
58+
// Compile with pkg-config:
59+
// - g++ -std=c++14 -Wall $(pkg-config catch2-with-main --cflags) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp $(pkg-config catch2-with-main --libs)
5760

5861
// Expected compact output (all assertions):
5962
//

examples/120-Bdd-ScenarioGivenWhenThen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ SCENARIO( "vectors can be sized and resized", "[vector]" ) {
4848
}
4949

5050
// Compile & run:
51-
// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 120-Bdd-ScenarioGivenWhenThen 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success
51+
// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 120-Bdd-ScenarioGivenWhenThen 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success
5252
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success
5353

5454
// Expected compact output (all assertions):

examples/210-Evt-EventListeners.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ TEST_CASE_METHOD( Fixture, "3: Testcase with class-based fixture", "[tag-C][tag-
420420
}
421421

422422
// Compile & run:
423-
// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 210-Evt-EventListeners 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success
423+
// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 210-Evt-EventListeners 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success
424424
// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success
425425

426426
// Expected compact output (all assertions):

0 commit comments

Comments
 (0)