forked from json-c/json-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmake-configure
executable file
·100 lines (90 loc) · 2.11 KB
/
cmake-configure
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# Wrapper around cmake to emulate useful options
# from the previous autoconf-based configure script.
RUNDIR=$(dirname "$0")
RUNDIR=$(cd "$RUNDIR" && pwd)
CURDIR=$(pwd)
FLAGS=()
usage()
{
exitval="$1"
errmsg="$2"
if [ $exitval -ne 0 ] ; then
exec 1>&2
fi
if [ ! -z "$errmsg" ] ; then
echo "ERROR: $errmsg" 1>&2
fi
cat <<EOF
$0 [<configure_options>] [-- [<cmake options>]]
--prefix=PREFIX install architecture-independent files in PREFIX
--enable-threading Enable code to support partly multi-threaded use
--enable-rdrand Enable RDRAND Hardware RNG Hash Seed generation on
supported x86/x64 platforms.
--enable-shared build shared libraries [default=yes]
--enable-static build static libraries [default=yes]
--disable-Bsymbolic Avoid linking with -Bsymbolic-function
--disable-werror Avoid treating compiler warnings as fatal errors
--disable-extra-libs Avoid linking against extra libraries, such as libbsd
EOF
exit
}
if [ "$CURDIR" = "$RUNDIR" ] ; then
usage 1 "Please mkdir some other build directory, and run this script from there."
fi
if ! cmake --version ; then
usage 1 "Unable to find a working cmake, please be sure you have it installed and on your PATH"
fi
while [ $# -gt 0 ] ; do
case "$1" in
-h|--help)
usage 0
;;
--prefix)
FLAGS+=(-DCMAKE_INSTALL_PREFIX="$2")
shift
;;
--prefix=*)
FLAGS+=(-DCMAKE_INSTALL_PREFIX="${1##--prefix=}")
;;
--enable-threading)
FLAGS+=(-DENABLE_THREADING=ON)
;;
--enable-rdrand)
FLAGS+=(-DENABLE_RDRAND=ON)
;;
--enable-shared)
FLAGS+=(-DBUILD_SHARED_LIBS=ON)
;;
--disable-shared)
FLAGS+=(-DBUILD_SHARED_LIBS=OFF)
;;
--enable-static)
FLAGS+=(-DBUILD_STATIC_LIBS=ON)
;;
--disable-static)
FLAGS+=(-DBUILD_STATIC_LIBS=OFF)
;;
--disable-Bsymbolic)
FLAGS+=(-DDISABLE_BSYMBOLIC=ON)
;;
--disable-werror)
FLAGS+=(-DDISABLE_WERROR=ON)
;;
--disable-extra-libs)
FLAGS+=(-DDISABLE_EXTRA_LIBS=ON)
;;
--)
shift
break
;;
-*)
usage 1 "Unknown arguments: $*"
;;
*)
break
;;
esac
shift
done
exec cmake "${FLAGS[@]}" "$@" "${RUNDIR}"