用CMakeLists.txt替代makefile創建openwrt軟件包(編譯自己的應用程序)

這兩天學習了CMakeLists.txt的規則和寫法

先給大家發幾個CMakeLists.txt的學習網址和官網doc

https://cmake.org/cmake-tutorial/  【入門學習步驟】

http://blog.csdn.net/sunbaigui/article/details/6625547    【簡單示例】

https://cmake.org/Wiki/CMake_Useful_Variables   【常用變量名】

https://github.com/carl-wang-cn/demo/tree/master/cmake   【大量有實用價值的demo】

ok現在開始看openwrt下的cmakelists.txt,其實完全沒啥不一樣的,就幾行代碼就可以搞定了。。。

首先helloworld的makefile相比以前的有些變化

package/helloworld/Makefile

添加一行

然後在src下沒有了makefile,而是CMakeLists.txt,注意文件的名的大小寫,出錯了就認不得了。。

#vim package/helloworld/src/CMakeLists.txt

 

把整體的源碼也貼出來吧!

hello_world.zip

 

歡迎任何人在此代碼的基礎上修改成自己的軟件包!

發佈了58 篇原創文章 · 獲贊 66 · 訪問量 29萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章