summaryrefslogtreecommitdiff
path: root/cmake-configure
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2019-12-01 23:42:40 -0500
committerEric Haszlakiewicz <erh+git@nimenees.com>2019-12-01 23:42:40 -0500
commit581b94b3bdf9f129a15dc3ca01558c4af6dc53c4 (patch)
tree3815a960b4fac8182451b72b206641a0d91f5aa5 /cmake-configure
parent11a638048da0344a3bd5f38722ddecdf5ec22041 (diff)
downloadjson-c-581b94b3bdf9f129a15dc3ca01558c4af6dc53c4.tar.gz
Add a shim script to ease shift from autoconf to cmake.
Diffstat (limited to 'cmake-configure')
-rwxr-xr-xcmake-configure87
1 files changed, 87 insertions, 0 deletions
diff --git a/cmake-configure b/cmake-configure
new file mode 100755
index 0000000..7a06b66
--- /dev/null
+++ b/cmake-configure
@@ -0,0 +1,87 @@
+#!/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
+
+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
+ ;;
+ --enable-threading)
+ FLAGS+=(-DENABLE_THREADING=ON)
+ ;;
+ --enable-rdrand)
+ FLAGS+=(-DENABLE_RDRAND=ON)
+ ;;
+ --enable-shared)
+ FLAGS+=(-DBUILD_SHARED_LIBS=ON)
+ ;;
+ --enable-static)
+ FLAGS+=(-DBUILD_SHARED_LIBS=OFF)
+ ;;
+ --disable-Bsymbolic)
+ FLAGS+=(-DDISABLE_BSYMBOLIC=ON)
+ ;;
+ --disable-werror)
+ FLAGS+=(-DDISABLE_WERROR=ON)
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ usage 1 "Unknown arguments: $*"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+exec cmake "${FLAGS[@]}" "$@" "${RUNDIR}"