Skip to content

Commit

Permalink
Ex07
Browse files Browse the repository at this point in the history
  • Loading branch information
chalonverse committed Nov 2, 2020
1 parent 839d99a commit 3dff7cb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ add_subdirectory(Ex04)
add_subdirectory(Ex05Lib)
add_subdirectory(Ex05Exe)
add_subdirectory(Ex06)
add_subdirectory(Ex07)
23 changes: 23 additions & 0 deletions Ex07/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This says we require C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# This is required to issue any FetchContent commands
include(FetchContent)

# This declares "catch" as a git repository we depend on
FetchContent_Declare(
catch
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.3
)

# This says we want the "catch" we declared available
FetchContent_MakeAvailable(catch)

# The ${catch_SOURCE_DIR} variable is set by MakeAvailable
# In this case we want catch.hpp to be in the include path
include_directories(${catch_SOURCE_DIR}/single_include/catch2)

# This says to create an executable target called Ex07 that compiles Main.cpp
add_executable(Ex07 Main.cpp)
9 changes: 9 additions & 0 deletions Ex07/Main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <iostream>
#include <catch.hpp>

int main()
{
std::cout << "Hello, C++ Catch world!\n";

return 0;
}
1 change: 1 addition & 0 deletions Ex07/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This demonstrates how to use FetchCOntent to get and use the Catch library.

0 comments on commit 3dff7cb

Please sign in to comment.