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) ?
1 Answer
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.
1 Comment
Mben.
This is the line to add to
CmakeLists.txt in case someone needs that : set_target_properties(TargetName PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "arg1 arg2 ... argN")
CmakeLists.txt:set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT projectname)config.hfile (like here) and then add some additional instructions toCMakeLists.txtfile (like here) and then use info fromconfig.hfile as default.