问题描述
我在CMAkeLists.txt中具有配置
I have configuration in CMAkeLists.txt
set(SOURCE_FILES client/client.cpp)
add_executable(Client ${SOURCE_FILES} client/client.cpp)
所以我可以在CLion(Shift + F10)中启动client.cpp.但是,如果我需要使用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来完成,该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参数添加到配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!