cmake_minimum_required(version 3.6)
專案名稱project(boostcoroutinedemo)
c++標準set(cmake_cxx_standard 11)
指定生成的版本set(cmake_build_type debug)
指定編譯選項set(cmake_cxx_flags_debug"-g -wall")
指定源**set(source_files main.cpp)
指定頭檔案目錄include_directories("/usr/local/boost-1.57/include/")
指定靜態和動態檔案目錄link_directories("/usr/local/boost-1.57/lib")
生成目標檔案add_executable(boostcoroutinedemo $)
鏈結庫檔案target_link_libraries(boostcoroutinedemo libboost_system.a libboost_thread.a)
target_link_libraries(boostcoroutinedemo pthread)
cmake指令系列
指令 變數 指令作用 cmake minimum required cmake最低版本要求 project 新增專案名稱 add executable 指定輸出檔案 add subdirectory 新增專案子資料夾 set設定變數 install 將專案安裝在系統的環境變數 include dir...
CMake 學習筆記 04 常用變數和指令
源 見 cmake 中支援變數來控制構建過程。乙個變數可通過 取得其值,在 if 語句裡面,直接使用變數名而不需要取值。通過 set 指令能顯式地自定義變數,有一些指令會隱式地建立變數,如 project 指令,會同時建立 source dir和 binary dir變數。常用的一些變數 proje...
CMake幾個基本指令
參考資料 指令推薦大寫 大小寫不敏感 變數使用 if語句中直接使用變數,不需要 下面是乙個例子 project hello set src list main.c message status this is binary dir message status this is source dir ...