CLion CMakeLists.txt 将 argv 参数添加到配置中 [英] CLion CMakeLists.txt add argv arguments to configuration

查看:53
本文介绍了CLion CMakeLists.txt 将 argv 参数添加到配置中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 CMAkeLists.txt 中有配置

I have configuration in CMAkeLists.txt

set(SOURCE_FILES client/client.cpp)
add_executable(Client ${SOURCE_FILES} client/client.cpp)

所以我可以在 CLion 中启动 client.cpp (Shift + F10).但是,如果我需要使用 argv 参数启动 client.cpp(它有一个整数作为参数),我必须更改 CLion 中的配置,添加程序参数.

So I can launch client.cpp in CLion (Shift + F10). But if I need to launch client.cpp with argv parameter (it has one integer as parameter) I must change configuration in CLion adding program arguments.

也许我可以使用 CMakeLists.txt 添加一些参数?

Maybe I can add some parameters using CMakeLists.txt?

推荐答案

CMakeList 只负责配置你的程序,它通过生成一个 Makefile 来实现,然后它会构建你的程序二进制文件.然后 Clion 使用您指定的参数启动二进制文件.

CMakeList is only responsible for configuring your program, it does so by generating a Makefile, which then will build your program binary. Clion then launch the binary using the arguments you specified.

这篇关于CLion CMakeLists.txt 将 argv 参数添加到配置中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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