how to add ca to linux

C++
sudo cp foo.crt /usr/local/share/ca-certificates/foo.crt
sudo update-ca-certificates
Source

Also in C++: