File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ /build *
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.14 FATAL_ERROR)
2+
3+ # ---- Project ----
4+
5+ project (Playground LANGUAGES CXX)
6+
7+ # ---- Fetch CPM ----
8+
9+ set (CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR} /cmake/CPM.cmake" )
10+ set (CPM_VERSION 0.18)
11+
12+ if (NOT EXISTS ${CPM_DOWNLOAD_LOCATION} )
13+ message (STATUS "Downloading CPM.cmake" )
14+ file (DOWNLOAD https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_VERSION} /CPM.cmake ${CPM_DOWNLOAD_LOCATION} )
15+ endif (NOT EXISTS ${CPM_DOWNLOAD_LOCATION} )
16+
17+ include (${CPM_DOWNLOAD_LOCATION} )
18+
19+ # ---- Add dependencies via CPM ----
20+
21+ CPMAddPackage(
22+ NAME Greeter
23+ GITHUB_REPOSITORY TheLartians/ModernCppStarter
24+ VERSION 0.9
25+ )
26+
27+ # ---- Create executable ----
28+
29+ add_executable (Playground main.cpp)
30+ set_target_properties (Playground PROPERTIES CXX_STANDARD 17)
31+
32+ target_link_libraries (Playground Greeter)
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ #include < greeter.h>
3+
4+ int main () {
5+ greeter::Greeter greeter (" World" );
6+ std::cout << greeter.greet () << std::endl;
7+ return 0 ;
8+ }
You can’t perform that action at this time.
0 commit comments