1.由于ninja需要GLIBC_2.15,CentOS 6.X的glibc只有GLIBC_2.12,所以需要更新glibc,可以使用下面的脚本进行更新:

 1#! /bin/sh
 2# update glibc to 2.17 for CentOS 6
 3
 4wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm
 5wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm
 6wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm
 7wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm
 8
 9sudo rpm -Uvh glibc-2.17-55.el6.x86_64.rpm \
10glibc-common-2.17-55.el6.x86_64.rpm \
11glibc-devel-2.17-55.el6.x86_64.rpm \
12glibc-headers-2.17-55.el6.x86_64.rpm

2.先从官方下载Ninja的Linux二进制文件 ninja,目前最新版本为1.9.0,解压并复制到/usr/local/bin 3.在写好的CMake项目使用以下命令进行构建

1mkdir build
2cd build
3cmake .. -G "Ninja"
4ninja