Skip to content

Commit

Permalink
update dependencies and add usage comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLartians committed Mar 26, 2021
1 parent 22ddd61 commit f8b8d41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# The MiniCppStarter
#
# Build and run by calling:
# cmake -S. -Bbuild && cmake --build build && ./build/Playground

cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

# ---- Project ----
Expand All @@ -6,28 +11,28 @@ project(Playground LANGUAGES CXX)

# ---- Fetch CPM ----

set(CPM_DOWNLOAD_VERSION 0.27.2)
set(CPM_DOWNLOAD_VERSION 0.32.0)
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")

if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "Downloading CPM.cmake v${CPM_DOWNLOAD_VERSION}")
file(DOWNLOAD https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake ${CPM_DOWNLOAD_LOCATION})
file(DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake ${CPM_DOWNLOAD_LOCATION})
endif()

include(${CPM_DOWNLOAD_LOCATION})

# ---- Add dependencies via CPM ----
# See https://github.com/TheLartians/CPM.cmake for details and examples

CPMAddPackage(
NAME Greeter
GITHUB_REPOSITORY TheLartians/ModernCppStarter
VERSION 0.10
)
# the ModernCppStarter defines an example project called 'Greeter'
CPMAddPackage("gh:TheLartians/[email protected]")

# ---- Create executable ----

# add your source files here
add_executable(Playground main.cpp)

set_target_properties(Playground PROPERTIES CXX_STANDARD 17)

target_link_libraries(Playground Greeter)
# link to your libraries' targets here
target_link_libraries(Playground Greeter::Greeter)
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <iostream>
#include <greeter.h>
#include <greeter/greeter.h>

int main() {
greeter::Greeter greeter("World");
Expand Down

0 comments on commit f8b8d41

Please sign in to comment.