PMM - The C++ Package Manager Manager

PMM

PMM - The Package Manager Manager

build-status release last commit stars forks issues issues-pr contributors

PMM is a module for CMake that manages... package managers.

Wha- Why?

People hate installing new software. Especially when they already have a perfectly working tool present. PMM uses the CMake scripting language to manage external packaging tools. PMM will automatically download, install, and control package managers from within your CMake project.

(As you are reading this, only Conan and VCPKG are supported.)

But This is Just Another Tool I have to Manage!

Never fear! PMM is the lowest-maintenance software you will ever use.

How Do I Use PMM?

Using PMM is simple:

  1. Download the pmm.cmake file, and place it at the top level of your repository (alongside your CMakeLists.txt).
  2. In your CMakeLists.txt, add a line include(pmm.cmake).
  3. Call the pmm() CMake function.

That's it! The pmm.cmake file is just 23 significant lines. Take a look inside if you doubt.

Wait... It's Downloading a Bunch of Stuff!

Precisely! pmm.cmake is just a bootstrapper for the real PMM code, which can be found in the pmm/ directory in the repository. The content is served over HTTPS from the gh-pages branch of the PMM repository, so it is all publicly visible.

I Don't Want to Automatically Download and Run Code from the Internet

Great! I sympathize, but remember: If you run apt, yum, pip, or even conan, you are automatically downloading and running code from the internet. It's all about whose code you trust.

Even still, you can host the PMM code yourself: Download the pmm/ directory as you want it, and modify the pmm.cmake script to download from your alternate location (eg, a corporate engineering intranet server).

Will PMM Updates Silently Break my Build?

Nope. pmm.cmake will never automatically change the version of PMM that it uses, and the files served will never be modified in-place: New versions will be added, but old versions will remain unmodified.

PMM will notify you if a new version is available, but it won't be annoying about it, and you can always disable this nagging by setting PMM_IGNORE_NEW_VERSION before including pmm.cmake.

How do I Change the PMM Version?

There are two ways:

  1. Set PMM_VERSION before including the pmm.cmake script.
  2. Modify the PMM_VERSION_INIT value at the top of pmm.cmake.

Prefer (1) for conditional/temporary version changes, and (2) for permanent version changes.

How do I Change the Download Location for PMM?

For permanent changes, set PMM_URL and/or PMM_URL_BASE in pmm.cmake. For temporary changes, set PMM_URL before including pmm.cmake

The pmm() Function

The only interface to PMM (after including pmm.cmake) is the pmm() CMake function. Using it is very simple. At the time or writing, pmm() only supports Conan and vcpkg, but other packaging solutions may be supported in the future.

The VERBOSE and DEBUG options enable verbose and debug logging, respectively. You may set PMM_{DEBUG,VERBOSE} before include(pmm.cmake) to enable these options globally and see information about the PMM bootstrapping process.

The pmm() signature:

pmm(
    # Enable verbose logging
    [VERBOSE]
    # Enable debug logging (implies VERBOSE)
    [DEBUG]
    # Use Conan
    [CONAN
        # Set additional --setting flags
        [SETTINGS ...]
        # Set additional --option flags
        [OPTIONS ...]
        # Set the --build option. (Default is `missing`)
        [BUILD 
   ]
        
   # Use a custom profile instead of the auto-generated profile created by PMM
        [PROFILE 
   
    ]
        
    # Ensure remotes are present before installing
        [REMOTES [
    
     [::no_verify] 
     
       [...]]]
        
      # Enable the Bincrafters repository
        [BINCRAFTERS]
        
      # Enable the conan-community repository
        [COMMUNITY]
    ]
    
      # Use vcpkg
    [VCPKG
        
      # Specify the revision of vcpkg that you want to use (required)
        REVISION 
      
        
       # Ensure the given packages are installed using vcpkg
        [REQUIRES [req [...]]]
        
       # Copy custom ports to the vcpkg ports directory
        [PORTS [req [...]]]
    ]
    
       # Use CMakeCM
    [CMakeCM
        
       # Either use the latest release, or specify a specific base URL to
        
       # download from
        {ROLLING | FROM 
       
        } ] )
       
      
     
    
   
  

CONAN PMM mode

In CONAN mode, PMM will find, obtain, and use Conan to manage project packages.

PMM will always use the cmake Conan generator, and will define imported targets for consumption (Equivalent of conan_basic_setup(TARGETS)). It will also set CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH for you to use find_package() and include() against the installed dependencies.

NOTE: No other CMake variables from regular Conan usage are defined.

CONAN mode requires a conanfile.txt or conanfile.py in your project source directory. It will run conan install against this file to obtain dependencies for your project.

The nitty-gritty of how PMM finds/obtains Conan:

  1. Check for the CONAN_EXECUTABLE variable. If found, it is used.
  2. Try to find a conan executable. Searches:
    1. Any pyenv versions in the user home directory
    2. ~/.local/bin for user-mode install binaries
    3. C:/Python{36,27,}/Scripts for Conan installations
    4. Anything else on PATH
  3. If still no Conan, attempts to obtain one automatically, trying first Python 3, then Python 2:
    1. Check for a venv or virtualenv executable Python module.
    2. Create a user-local virtualenv.
    3. Installs Conan within the created virtualenv and uses Conan from there.

PMM Will Not do Everything for You

While PMM will ensure that Conan has been executed for you as part of your configure stage, it is up to you to provide a Conanfile that Conan can consume to get your dependency information.

You will still need to read the Conan documentation to understand the basics of how to declare and consume your dependencies.

VCPKG PMM mode

In VCPKG mode, PMM will download the vcpkg repository at the given REVISION, build the vcpkg tool, and manage the package installation in a use-local data directory.

REVISION should be a git tree-ish (A revision number (preferred), branch, or tag) that you could git checkout from the vcpkg repository. PMM will download the specified commit from GitHub and build the vcpkg command line tool from source. You will need std::filesystem or std::experimental::filesystem support from your compiler and standard library.

If you want to copy custom ports to the vcpkg ports folder, you can define PORTS with a list of folders to copy over.

REQUIRES is a list of packages that you would like to install using the vcpkg command line tool.

When using PMM, you do not need to use the vcpkg.cmake CMake toolchain file: PMM will take care of this aspect for you.

After calling pmm(VCPKG), all you need to do is find_package() the packages that you want to use.

CMakeCM PMM mode

If CMakeCM is provided, PMM will download and make available the CMake Community Modules for you project.

Once the pmm() function is run, you may include or find_package any of the modules provided by CMakeCM.

You must also specify either ROLLING or FROM to use CMakeCM with PMM:

  • If you specify ROLLING, PMM will download the latest version of the CMakeCM module index every time you configure (with a few minutes of cooldown).
  • If you specify FROM, the module index will only be obtained from the given base URL. Note: This URL is not the URL of a CMakeCM.cmake file: It is a url that prefixes the CMakeCM.cmake module URL.

Helper Commands

After PMM has run for the first time, it will generate a sh and bat script that can be used to maintain your PMM installation

Get help with the /Help option:

> pmm-cli.sh /Help

As an example, you can rebuild a Conan package with this command:

> pmm-cli.sh /Conan /Rebuild <package name>
Comments
  • vcpkg-root error with vcpkg 2020.04

    vcpkg-root error with vcpkg 2020.04

    When using master PMM on Ubuntu 18.04 with the newest version of vcpkg 2020.4, it fails with the following error:

    -- [download 100% complete]
    -- [pmm] Extracting vcpkg archive...
    -- [pmm] Bootstrapping the vcpkg tool (This may take a minute)...
    -- [pmm] Testing bootstrapped vcpkg
    -- [pmm] vcpkg successfully bootstrapped to /home/omaralv/.local/share/pmm/1.4.2/vcpkg-2020.04
    -- [pmm] Using vcpkg executable: /home/omaralv/.local/share/pmm/1.4.2/vcpkg-2020.04/vcpkg
    -- [pmm] Installing requirements with vcpkg
    
    CMake Error at build/_pmm/1.4.2/vcpkg.cmake:185 (message):
      Failed to install requirements with vcpkg [1]:
    
      Error: Could not detect vcpkg-root.
    
  • Running pmm-cli without arguments should print help

    Running pmm-cli without arguments should print help

    Currently it prints this:

    # pmm-cli.bat
    CMake Error at _pmm/1.7.2/main.cmake:120 (message):
      PMM did not recognise the given argument list
    Call Stack (most recent call first):
      _pmm/1.7.2/entry.cmake:78 (_pmm_script_main)
       pmm.cmake:68 (include)
    
  • :art: Restyle Dev

    :art: Restyle Dev

    Automated style fixes for #57, created by Restyled.

    The following restylers made fixes:

    • whitespace

    To incorporate these changes, merge this Pull Request into the original. We recommend using the Squash or Rebase strategies.

    NOTE: As work continues on the original Pull Request, this process will re-run and update (force-push) this Pull Request with updated style fixes as necessary. If the style is fixed manually at any point (i.e. this process finds no fixes to make), this Pull Request will be closed automatically.

    Sorry if this was unexpected. To disable it, see our documentation.

  • Merge this fork back into the main repo

    Merge this fork back into the main repo

    Since the main repo is active again I think it would be a good time to merge all the changes back into te main repo

    TODO

    • [x] #5
    • [x] #8
    • [x] #12
    • [ ] #15 <-- maybe?
    • [ ] #19
    • [x] #22
    • [ ] #25
    • [ ] #26
    • [x] #38
    • [ ] #41
    • [x] Added VCPKG PORTS for copying custom ports
    • [ ] Fixed finding python on AppVeyor
    • [x] Added Clean helper command
  • Generate pmm-cli script

    Generate pmm-cli script

    If you want to call pmm helper commands from a build dir you have type cmake -P ../cmake/3rdparty/pmm.cmake /Help

    It would be easier if PMM generates a sh/bat script that you can use to call PMM helper commands

    For example: pmm-cli.sh /Help

  • Merge with Upstream?

    Merge with Upstream?

    Hello Edgar!

    It's been a while that I've been neglecting some of my open source projects. I just discovered your fork, and noted that you've make a lot of changes and additions since my own. I've also been making changes, but I've kept them mostly at $job while I've been sorting out the kinks and bugs. I've recently pushed them up, and now we have two significantly different repos that each have improvements from the other.

    I note that my own repo has more public attention simply by being the original, but I don't want your changes to fall by the way because of that.

  • Add coloured output

    Add coloured output

    See https://github.com/ixm-one/ixm/blob/master/Modules/API/Log.cmake & https://github.com/ixm-one/ixm/blob/master/Modules/API/Console.cmake & https://github.com/ixm-one/ixm/blob/master/CMakeLists.txt#L119-L269

  • Automatically cleanup old files

    Automatically cleanup old files

    PMM currently installs a new version of Conan and vcpkg every time an update has been released PMM should check every month for unused versions and remove them

    • [ ] Cleanup old PMM files
    • [ ] Cleanup old Conan virtual installs
    • [ ] Cleanup old vcpkg installs
BakePKG is a package archive that can install itself without without a package manager.

BakePKG A bad way of packaging applications. Introduction BakePKG is a package archive that can install itself without without a package manager. The

Sep 3, 2022
The decentralized package manager for C++ and friends 🏝️
The decentralized package manager for C++ and friends 🏝️

Buckaroo The decentralized package manager for C++ and friends. Why Buckaroo? Package managers like Yarn and Cargo have shown how productive developer

Jan 6, 2023
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

Jan 9, 2023
CMake driven cross-platform package manager for C/C++.

Hunter CMake driven cross-platform package manager for C/C++. Linux, Windows, macOS, iOS, Android, Raspberry Pi, etc. Documentation: https://hunter.re

Jan 3, 2023
Conan - The open-source C/C++ package manager
Conan - The open-source C/C++ package manager

Conan Decentralized, open-source (MIT), C/C++ package manager.

Jan 6, 2023
C++ package retrieval

cget Cmake package retrieval. This can be used to download and install cmake packages. The advantages of using cget are: Non-intrusive: There is no ne

Jan 3, 2023
C++ Library Manager for Windows, Linux, and MacOS

Vcpkg: Overview 中文总览 Español 한국어 Français Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This tool and ecosystem are constant

Jan 4, 2023
✔️The smallest header-only GUI library(4 KLOC) for all platforms
✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

Jan 8, 2023
Spack is a package manager, and package managers should be trivial to install.

?? Spack with batteries included (linux/x86_64) Spack is a package manager, and package managers should be trivial to install. This repo offers a sing

Dec 1, 2022
BakePKG is a package archive that can install itself without without a package manager.

BakePKG A bad way of packaging applications. Introduction BakePKG is a package archive that can install itself without without a package manager. The

Sep 3, 2022
C package manager-ish
C package manager-ish

clib(1) Package manager for the C programming language. Installation Expects libcurl to be installed and linkable. With homebrew: $ brew install clib

Jan 6, 2023
C++ Package Manager
C++ Package Manager

CPM Note CPM is not being actively maintained. I plan on keeping the website active but don't plan on making further modifications to the codebase. If

Dec 18, 2022
The decentralized package manager for C++ and friends 🏝️
The decentralized package manager for C++ and friends 🏝️

Buckaroo The decentralized package manager for C++ and friends. Why Buckaroo? Package managers like Yarn and Cargo have shown how productive developer

Jan 6, 2023
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

Jan 9, 2023
CMake driven cross-platform package manager for C/C++.

Hunter CMake driven cross-platform package manager for C/C++. Linux, Windows, macOS, iOS, Android, Raspberry Pi, etc. Documentation: https://hunter.re

Jan 3, 2023
Package manager for linux that installs windows apps through wine

Winepkg A package manager for linux that installs windows apps through wine. Usage winepkg -Si mspaint Install Dependencies: wine winetricks wget cur

May 27, 2022
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

Jan 9, 2023
Windows Package Manager CLI (aka winget)
Windows Package Manager CLI (aka winget)

Welcome to the Windows Package Manager Client (aka winget.exe) repository This repository contains the source code for the Windows Package Manager Cli

Dec 27, 2022
ZPM - The C++ package manager based on premake5

ZPM ZPM is the C++ package manager built for everyone who uses premake! We designed it to make it easy to use libraries, modules and assets. PLEASE NO

Oct 10, 2022
Example of downloading/installing dependencies using Hunter package manager.

Linux/OSX Windows Example of downloading/installing dependencies using Hunter package manager. Requirements CMake version 3.0 Usage Set HUNTER_ROOT en

Dec 30, 2022