[Day 25] 有提到如果想要快速建立一個C++/C 的 專案,可以用github上面現有的專案去實踐,因此昨天有提供了一個基礎,一個進階可以直接使用的專案供大家參考。
今天我們就利用基礎版本深入實做看看
git clone https://github.com/ttroy50/cmake-examples.git
這個時候你可以會看到一大串 cmake的檔案
如果想要先看一下基礎版本的話
cd 01-basic/A-hello-cmake
或是你可以選擇一個你想要執行的folder 直接cd 他
接著在cd的資料夾內建立 build
資料夾
mkdir build
cd build
建立完成後再到build資料夾內執行
cmake ..
接著等 makefile建立完成後再執行
make
編譯完成後會在 build/
裡產生執行檔 hello_cmake
在build裡面執行./hello_cmake
./hello_cmake
就可以得到想要的結果啦