Cppkg
cmake dependencies auto install package
Add dependencies
First. Search package
cppm cppkg search Catch
Name Version Repository Description Use
===================================================================================================================================================================
Catch2 git cppkg modern, C++-native, header-only, test framework f$Catch2="git"
Catch2 2.9.1 cppkg modern, C++-native, header-only, test framework f$Catch2="2.9.1"
Catch latest hunter https://docs.hunter.sh/en/latest/packages/pkg/Catch.html#index-
# hunter example Catch2 = {module="Catch2", hunter=true}
Second. add this option in cppm.toml
[dependencies]
exam = {module="exam::exam", version="latest"}
Catch2 = "2.9.1"
# Catch2 = {module="Catch2", hunter=true}
If you can't find package, add new package in local repo
Generate New Cppkg and Add your local repository
First. Initialize cppkg
cppm cppkg init exam
Second. Edit exam.toml file
[package]
name = "exam"
version = "lastest" # git repo version is lastest
description = "cppkg example"
global=false # install prefix if global is false, install to $HOME/.cppm/local/
cmake = {name = {exam cmake library name}}
download = {git="{git repo}"} # or url
Third. Build exam.toml
cppm cppkg build exam
${version}/
+-- cppkg.toml # same exam.toml
+-- eaxm.cmake.in # cppkg library auto installer
Fourth. Add options in cppkg.toml and eaxm.cmake.in
[package]
name = "exam"
version = "lastest" # git repo version is lastest
description = "cppkg example"
global = false
cmake = {name = {exam cmake library name}, finlib={Findlib.cmake file}}
download = {git="{git repo}"} # or url
cmake.findlib options, auto install your project 'cmake/Modules' path Find{name}.cmake is none cmake project finder 'download_package()' is External_Project_Add wrapper
cmake_minimum_required(VERSION 3.10)
project(exam--install NONE)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_tool.cmake)
download_package(exam lastest GIT https://github.com/exam/exam.git LOCAL)
# Other Options:
# - Linux Configure:
# L_CONFIGURE {...}, L_BUILD {...}, L_INSTALL {...}
# - Windows Configure:
# W_CONFIGURE {...}, W_BUILD {...}, W_INSTALL {...}
# - Install Path Option:
# LOCAL(default) GLOBAL
Fifth. Add cppkg in your local repository
cppm cppkg push exam
Fast Add and Generate Cppkg
if dependency is cmake base project, you can add too simple git repo default version is lastest Option: --git [-g] {repo} :add git repo --git_tag [-t] {tag} :add git tag --global : not cppm local install --help [-h] :show cppm command and options --module [-m] {module} :add module name --p [-p] :cmake base library install to local cppkg repo, Require --url or --git --url [-u] {url} :add url repo Require --version --version [-v] {version} :add library version Require --version --p [-p] :cmake base library install to local cppkg repo, Require --url or --git
cppm cppkg init -g {git repo} -m "exam::exam" exam
#or
cppm cppkg init -u {url} -v {version} -m "exam::exam" exam
Last updated
Was this helpful?