Skip to content

Instantly share code, notes, and snippets.

@leozz37
Last active August 12, 2020 09:48
Show Gist options
  • Save leozz37/d04b01add2b1e15742263cfc8bcadd3d to your computer and use it in GitHub Desktop.
Save leozz37/d04b01add2b1e15742263cfc8bcadd3d to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.18)
project(cpm_example)
set(CMAKE_CXX_STANDARD 17)
set(CPM_DOWNLOAD_VERSION 0.27.2)
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "Downloading CPM.cmake")
file(DOWNLOAD https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake ${CPM_DOWNLOAD_LOCATION})
endif()
include(${CPM_DOWNLOAD_LOCATION})
CPMAddPackage(
NAME spdlog
GITHUB_REPOSITORY gabime/spdlog
VERSION 1.7.0)
add_executable(cpm_example src/main.cpp)
target_link_libraries(cpm_example
spdlog)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment