Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMAKE - Add default command line arguments to a cmake project

I am creating and building a c++ project using cmake from scratch.
The executable requires command line arguments.
I am specifying them in Visual studio.

Is it possible to specify them by default when cmake builds the project (in my CmakeLists.txt for example) ? So that I (or others) won't need to specify these arguments each time I build the project for the first time (I would want to just run the project without worrying about that but still can change them in visual studio of course if needed) ?

enter image description here

like image 377
Mohamed Benmahdjoub Avatar asked Sep 05 '25 10:09

Mohamed Benmahdjoub


1 Answers

If you are using CMake 3.13 and above you can add the VS_DEBUGGER_COMMAND_ARGUMENTS property to your executable target in order specify those arguments.

like image 86
StoryTeller - Unslander Monica Avatar answered Sep 08 '25 06:09

StoryTeller - Unslander Monica