Add cmake-default script
parent
2d755b811b
commit
3718ad90e9
25
README.md
25
README.md
|
@ -67,7 +67,32 @@ limitations/properties:
|
|||
* These are only installed for the user that ran the script.
|
||||
* The thing pointed to by each symlink can change out from under you.
|
||||
|
||||
## Alternatives
|
||||
|
||||
I may have finally found a more "correct" alternative to this where I
|
||||
actually used `~/usr/local` as my install prefix. I always found it
|
||||
annoying that I couldn't change an install prefix after waiting for
|
||||
the entire `make` command to run. The default prefix is always
|
||||
`/usr/local` which requires root privileges to install into. However,
|
||||
there is apparently the [env variable `DESTDIR`][1] which will at
|
||||
least allow you to add a prefix in front of the default prefix. It
|
||||
won't "change" it, so you're always stuck with `/usr/local` unless you
|
||||
actually set the `--prefix` flag before building. But this does let
|
||||
you do `asdf/usr/local`.
|
||||
|
||||
```sh
|
||||
make DESTDIR=$HOME install
|
||||
```
|
||||
|
||||
```sh
|
||||
cmake DESTDIR=$HOME --install ./
|
||||
```
|
||||
|
||||
# Copyright
|
||||
|
||||
I think this script is too small to reasonably apply copyright
|
||||
to. It is in the Public Domain.
|
||||
|
||||
|
||||
[1]: https://cmake.org/cmake/help/latest/envvar/DESTDIR.html#envvar:DESTDIR
|
||||
[2]:
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -o errexit
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Source common settings
|
||||
. $HOME/usr/local/share/config.site
|
||||
|
||||
# Configure
|
||||
cmake .. -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=$HOME/usr/local \
|
||||
$@
|
||||
|
||||
# Build
|
||||
ninja
|
Loading…
Reference in New Issue