-
Notifications
You must be signed in to change notification settings - Fork 17
/
configure.cmake
executable file
·52 lines (47 loc) · 1.31 KB
/
configure.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# This is a small wrapper that makes cmake work in autoconf setting
# (C)2021 Simon Urbanek, License: MIT
# based on ideas by Brian Ripley
echo -n 'Checking for cmake ... '
: ${CMAKE=`which cmake`}
# on macOS CMake is an application
if [ -z "$CMAKE" -a -e "/Applications/CMake.app/Contents/bin/cmake" ]; then
CMAKE=/Applications/CMake.app/Contents/bin/cmake
fi
if [ -z "$CMAKE" ]; then
echo 'NOT FOUND'
echo 'ERROR: cannot find cmake! This package requires cmake to build'
exit 1
fi
echo $CMAKE
echo -n 'Checking if it works ...'
if $CMAKE --version >/dev/null; then
echo yes
else
echo NO
echo 'ERROR: cannot find cmake! This package requires cmake to build'
exit 1
fi
BD="`pwd`"
SD="`dirname $0`"
SD="`(cd $SD && pwd)`"
echo Collecting env vars from arguments:
while (( "$#" )); do
if echo "$1" | grep -E '^[A-Z]+=' >/dev/null; then
export "$1"
echo " $1"
else
if echo "$1" | grep '^--prefix='; then
PREFIX=`echo $1 | sed 's:^--prefix=/*::'`
MARGS+=("-DCMAKE_INSTALL_PREFIX=/$PREFIX")
else
MARGS+=("$1")
fi
fi
shift
done
echo Invoking cmake:
set -x
(cd "$BD" && $CMAKE "$SD" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:bool=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON "${MARGS[@]}" ) || (echo '*** FAILED' >&2; exit 1)
set +x
echo "Makefile generated."