cmakelists.txt中的变量如何在程序中使用?

13302657252
Posts: 10
Joined: Thu Jun 01, 2023 10:58 am

cmakelists.txt中的变量如何在程序中使用?

Postby 13302657252 » Fri Jun 02, 2023 1:47 am

大家好,
我有个问题请教,cmakelists.txt中的变量如何在程序中使用?比如以下cmakelists.txt文件中的PROJECT_VER变量,我如何在c程序中使用?试了很多办法不知如何使用。


# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(PROJECT_VER "0.1.4.1")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(hello-world)

ESP_LiuH
Posts: 42
Joined: Fri Feb 10, 2023 7:20 am

Re: cmakelists.txt中的变量如何在程序中使用?

Postby ESP_LiuH » Tue Jun 06, 2023 11:21 am

请使用 add_compile_option ,具体使用方式见如下链接说明:https://cmake.org/cmake/help/latest/com ... ile_option

Who is online

Users browsing this forum: No registered users and 107 guests