1. 程式人生 > >linux: cmake(未完,更新中)

linux: cmake(未完,更新中)

linux add ++ required version options tail rect exec

參考:

http://blog.csdn.net/netnote/article/details/4051620

http://blog.csdn.net/fan_hai_ping/article/details/42524205

栗子:

1 project(es)
2 SET(CMAKE_BUILD_TYPE Debug CACHE STRING "set build type to debug")
3 SET(CMAKE_C_COMPILER g++)
4 SET(CMAKE_CXX_FLAGS -g)
5 add_compile_options(-std=c++11)
6 cmake_minimum_required(VERSION 2.8
) 7 aux_source_directory(. DIR_SRCS) 8 add_executable(es ${DIR_SRCS})

第一行,指定項目名稱為es;

第二行,指定項目版本為debug;

第三行,指定編譯器為g++;

第四行,指定編譯參數為-g;

第五行,添加c++11支持;

第六行,指定cmake版本;

第七行,指定文件目錄為.,即當前目錄;

第八行,添加可執行文件,名字為es,放在當前目錄下。

linux: cmake(未完,更新中)