如何使用 CMake 将输出二进制文件的名称更改为不是 a.out? [英] How to change the name of the output binary to not be a.out with CMake?
本文介绍了如何使用 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屋!
查看全文