-
Notifications
You must be signed in to change notification settings - Fork 12
/
run_cmake.sh
executable file
·42 lines (32 loc) · 937 Bytes
/
run_cmake.sh
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
#! /bin/bash
# set -x
IFS="/" read -ra ARR <<< `pwd`
BUILD_DIR=${ARR[-1]}
##- common build variables
##
debug="-DCMAKE_BUILD_TYPE=Debug"
release="-DCMAKE_BUILD_TYPE=Release"
target="-G 'CodeBlocks - Unix Makefiles'"
clang="-DCXX_COMPILER=clang++"
gcc="-DCXX_COMPILER=g++"
if [ ${BUILD_DIR} = "build-debug-gcc" ]
then
cmd="CC=`which gcc` cmake $target $debug $gcc .."
elif [ ${BUILD_DIR} = "build-release-gcc" ]
then
cmd="CC=`which gcc` cmake $target $release $gcc .."
elif [ ${BUILD_DIR} = "build-debug-clang" ]
then
cmd="CC=`which clang` cmake $target $debug $clang .."
elif [ ${BUILD_DIR} = "build-release-clang" ]
then
cmd="CC=`which clang` cmake $target $release $clang .."
elif [ ${BUILD_DIR} = "cmake-build-debug" ]
then
cmd="CC=`which gcc` cmake $target $debug $gcc .."
elif [ ${BUILD_DIR} = "cmake-build-release" ]
then
cmd="CC=`which gcc` cmake $target $release $gcc .."
fi
echo $cmd
eval $cmd