我使用的openwrt的cmake版本是2.8的,但是有时候使用openwrt交叉编译编译你添加的库时要求的cmake版本要大于2.8怎么办?
1.查看openwrt的cmake版本号
查看cmake版本号的方法:
$ cd {openwrt}
$ vi tools/cmake/Makefile
查看Makefile的里面的cmake的PKG_VERSION就行了
2.获取高版本的cmake
我现在要升级升cmake3.7.2版本。获取cmake网址:https://cmake.org/files/v3.7/
下载cmake-3.7.2.tar.gz文件拷贝到{openwrt}/dl目录下载
3.修改openwrt的文件
3.1 计算cmake-3.7.2.tar.gz的md5sum
$ cd {openwrt}
$ md5sum dl/cmake-3.7.2.tar.gz
>>> 79bd7e65cd81ea3aa2619484ad6ff25a dl/cmake-3.7.2.tar.gz
3.2 修改cmake的Makefile
$ cd tools/cmake
$ mv patches temp
$ vi Makefile
-->修改PKG_VERSION:=2.8.12.2 成 PKG_VERSION:=3.7.2
-->修改 PKG_SOURCE_URL:=http://www.cmake.org/files/v2.8/ 成
PKG_SOURCE_URL:=https://cmake.org/files/v3.7/
-->修改 PKG_MD5SUM:XXXXXXX 成
PKG_MD5SUM:79bd7e65cd81ea3aa2619484ad6ff25a
修改完后为:
# # Copyright (C) 2006-2014 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # include $(TOPDIR)/rules.mk PKG_NAME:=cmake PKG_VERSION:=3.7.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://cmake.org/files/v3.7/ PKG_MD5SUM:=79bd7e65cd81ea3aa2619484ad6ff25a HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk HOST_CONFIGURE_VARS := HOST_CONFIGURE_ARGS := \ --prefix=$(STAGING_DIR_HOST) \ $(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") $(eval $(call HostBuild))
4 编译cmake
$ make tools/cmake/compile V=s
5 重新编译openwrt系统
$ make -j4 V=s