如何使用CMake将输出二进制文件的名称更改为非a.out? [英] How to change the name of the output binary to not be a.out with CMake?

查看:209
本文介绍了如何使用CMake将输出二进制文件的名称更改为非a.out?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了更改生成的文件的名称,我将在CMakeLists.txt中进入哪里?

Where would I go within CMakeLists.txt in order to change the name of the generated file?

推荐答案

CMakeLists.txt

Here's a simple CMakeLists.txt

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(demo)

add_executable(hello hello.cpp)

此CMakeLists.txt将hello.cpp文件编译为名为hello的可执行文件。您可以使用 add_executable 语句来命名可执行文件。

This CMakeLists.txt compiles a hello.cpp file to an executable named hello. You can name the executable anything by using the add_executable statement.

add_executable(<executable-name> <source1> <source2> ...)

这篇关于如何使用CMake将输出二进制文件的名称更改为非a.out?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆