-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_gtest.sh
executable file
·46 lines (35 loc) · 1.12 KB
/
install_gtest.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
43
44
45
46
#!/bin/bash
# Set Google Test version
GTEST_VERSION="release-1.11.0"
# Set installation path
INSTALL_DIR="${PWD}/usr"
# Marker file path
MARKER_FILE="${INSTALL_DIR}/.installed_gtest"
# Check if already installed
if [ -f "${MARKER_FILE}" ]; then
echo "Google Test has already been installed. Skipping the compilation process."
else
# Check if already downloaded
if [ -d "googletest" ]; then
echo "The 'googletest' directory already exists. Skipping the download process."
else
# Clone the Google Test repository
git clone --branch ${GTEST_VERSION} --depth 1 https://github.com/google/googletest.git
fi
# Enter the 'googletest' directory
cd googletest
# Create the 'build' directory
mkdir -p build && cd build
# Build and install using CMake
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ..
make
make install
# Create a marker file in the target directory
touch "${MARKER_FILE}"
# Return to the original directory
cd ../..
# Remove the downloaded source code
rm -rf googletest
fi
# Continue with the rest of the script
echo "start ..."