p-ranav / argparse

Argument Parser for Modern C++
MIT License
2.59k stars 244 forks source link

Tip: how to avoid 'cannot create directory: /usr/local/lib/cmake/argparse' errors in Termux #351

Open Manamama opened 4 months ago

Manamama commented 4 months ago

If:

~/downloads/argparse $ uname -a
Linux localhost 4.14.186+ #1 SMP PREEMPT Thu Mar 17 16:28:22 CST 2022 aarch64 Android

and you get:

~/.../argparse/build $ cmake -P cmake_install.cmake
-- Install configuration: "RelWithDebInfo"
CMake Error at cmake_install.cmake:62 (file):
  file cannot create directory: /usr/local/lib/cmake/argparse.  Maybe need
  administrative privileges.

after the successful make, instead run it with:

~/.../argparse/build $ cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -P cmake_install.cmake
-- Install configuration: "RelWithDebInfo"
-- Installing: /data/data/com.termux/files/usr/lib/cmake/argparse/argparseConfig.cmake
-- Installing: /data/data/com.termux/files/usr/include/argparse/argparse.hpp
-- Installing: /data/data/com.termux/files/usr/lib/cmake/argparse/argparseConfig-version.cmake
-- Installing: /data/data/com.termux/files/usr/lib/pkgconfig/argparse.pc
~/.../argparse/build 

It may be worth to add it somewhere to that resulting Makefile itself, as an OS check.