摘要: 一, 通用范式 cmake_minimum_required(VERSION 2.8) project (hello_cpp11) # 检查c++编译器标志,设置c++11支持变量include(CheckCXXCompilerFlag)CHECK_CXX_COMPILER_FLAG("-std=c 阅读全文
posted @ 2019-04-14 12:52 流浪侠客 阅读(17698) 评论(0) 推荐(1) 编辑
摘要: 前言 大多数的工程都会添加第三方库。cmake中find_package()函数能够支持查找这些库的路径。 但是必须先为cmake配置查找配置的cmake模块,模块文件名称形如“FindXXX.cmake”,这些 模块文件通常会放到一个指定的目录中,然后将CMAKE_MODULE_PATH变量设置为 阅读全文
posted @ 2019-04-14 11:47 流浪侠客 阅读(21090) 评论(0) 推荐(0) 编辑
摘要: 前言 cmake支持多种不同方式设置编译器标志: 1.使用 target_compile_definitions()设置编译器标志 2. 使用CMAKE_C_FLAGS和CMAKE_CXX_FLAGS设置编译标志 一, 目录结构 ├── CMakeLists.txt├── main.cpp * li 阅读全文
posted @ 2019-04-14 10:40 流浪侠客 阅读(12347) 评论(0) 推荐(0) 编辑
摘要: 前言 cmake可以设设置多种编译选项。这些编译选项可以设置编译优化级别以及是否添加debug信息。 一, 目录结构 ├── CMakeLists.txt├── main.cpp * link:CMakeLists.txt[] - Contains the CMake commands you wi 阅读全文
posted @ 2019-04-14 10:01 流浪侠客 阅读(6037) 评论(0) 推荐(0) 编辑
摘要: 一, 目录结构 ├── cmake-examples.conf├── CMakeLists.txt├── include│ └── installing│ └── Hello.h└── src ├── Hello.cpp └── main.cpp * link:CMakeLists.txt[] - 阅读全文
posted @ 2019-04-14 01:13 流浪侠客 阅读(1563) 评论(0) 推荐(0) 编辑
摘要: 一, 目录结构 ├── CMakeLists.txt├── include│ └── shared│ └── Hello.h└── src ├── Hello.cpp └── main.cpp * link:CMakeLists.txt[] - Contains the CMake commands 阅读全文
posted @ 2019-04-14 00:36 流浪侠客 阅读(9554) 评论(0) 推荐(0) 编辑
摘要: 一, 目录结构 ├── CMakeLists.txt├── include│ └── static│ └── Hello.h└── src ├── Hello.cpp └── main.cpp * link:CMakeLists.txt[] - Contains the CMake commands 阅读全文
posted @ 2019-04-13 22:58 流浪侠客 阅读(10559) 评论(0) 推荐(0) 编辑
摘要: 一, 目录结构 ├── CMakeLists.txt├── include│ └── Hello.h└── src ├── Hello.cpp └── main.cpp * link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake comman 阅读全文
posted @ 2019-04-13 22:28 流浪侠客 阅读(3561) 评论(0) 推荐(0) 编辑
摘要: 一, 目录结构 ├── CMakeLists.txt├── main.cpp * link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake commands you wish to run* link:main.cpp[main.cpp] - 阅读全文
posted @ 2019-04-13 21:55 流浪侠客 阅读(279) 评论(0) 推荐(0) 编辑
摘要: CMAKE_BINARY_DIR : if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise this is the top level directory of your build tree C 阅读全文
posted @ 2019-04-13 20:30 流浪侠客 阅读(361) 评论(0) 推荐(0) 编辑