-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_cmake.sh
executable file
·31 lines (26 loc) · 965 Bytes
/
install_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
#!/bin/bash
set -e
build_prefix=${build_dir}/cmake-${cmake_version}
install_prefix=${install_dir}/cmake-${cmake_version}
rm -rfv ${build_prefix}
mkdir -pv ${build_prefix}/bld
cd ${build_prefix}
tarball=cmake-${cmake_version}.tar.gz
cmake_version_major=$(echo ${cmake_version} | cut -f1,2 -d'.')
url=https://cmake.org/files/v${cmake_version_major}/${tarball}
if [ ! -f ${dist_dir}/cmake/${tarball} ]; then wget ${url} -P ${dist_dir}/cmake/; fi
tar -xzvf ${dist_dir}/cmake/${tarball}
ln -sv cmake-${cmake_version} src
cd bld
cmake_string=
cmake_string+=" -DCMAKE_BUILD_TYPE=Release"
cmake_string+=" -DCMAKE_C_COMPILER=${CC}"
cmake_string+=" -DCMAKE_CXX_COMPILER=${CXX}"
cmake_string+=" -DCMAKE_Fortran_COMPILER=${FC}"
cmake_string+=" -DCMAKE_INSTALL_PREFIX=${install_prefix}"
if [ -n "${compiler_rpath_dirs}" ]; then
cmake_string+=" -DCMAKE_INSTALL_RPATH=${compiler_rpath_dirs}"
fi
${CMAKE} ../src ${cmake_string}
make -j${num_cpus}
make -j${num_cpus} install