c++libcurl

Downgrade or install an earlier version of a GitHub library


I have installed CPR library in Ubuntu using the following commands:

git clone --recursive https://github.com/whoshuu/cpr.git
cd cpr/
mkdir build && cd build
cmake ..
make
sudo make install

The version installed is compatible with C++17. However, I need CPR 1.9.x, which is compatible with C++11. How do I install an earler version of CPR?


Solution

  • You can install a different version of the CPR library by checking-out a specific revision in the git repository you cloned.

    The CPR library repository includes branches for tracking minor releases (e.g. 1.9.x, 1.10.x) as well tags for each specific release (e.g. 1.9.7). To install a specific version, simply switch the working tree to the desired revision before executing the build steps.

    To install the latest revision of CPR 1.9.x, switch from the master branch to the 1.9.x branch with

    $ git switch 1.9.x
    # or
    $ git checkout 1.9.x
    

    If you want to install a specific tagged version like v1.9.7, you can use

    $ git switch --detach 1.9.7
    # or
    $ git checkout 1.9.7