参考:

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,放在当前目录下。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2022-02-12
  • 2021-10-07
  • 2022-02-23
  • 2022-12-23
  • 2021-04-27
猜你喜欢
  • 2021-08-17
  • 2022-12-23
  • 2021-05-25
  • 2021-07-01
  • 2021-07-23
  • 2022-01-05
  • 2021-10-19
相关资源
相似解决方案