当前位置: 首页 > 工具软件 > cpp-project > 使用案例 >

cpp-cmake中的config编写

鲜于华容
2023-12-01

关于cpp-cmake的config编写,本文枚列几个关键文件。
方便大家实现,注意到config.h是通过cmake自动生成,但是要注意下configure_file时候的路径。另外就是configure_file前要事先定义好宏变量。

例子来源于:https://www.hahack.com/codes/cmake/

CMakeLists.txt编辑

# CMakeList.txt: CMakeProject2 的 CMake 项目,在此处包括源代码并定义
# 项目特定的逻辑。
#


cmake_minimum_required (VERSION 3.8)

#project(Tutorial VERSION 1.0)

project(DEMO VERSION 1.0)

set (MyDemoVersion 1)

option (USE_MYMATH
       "Use provided math impl
 类似资料: