Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding command line arguments to project

Tags:

cmake

My question is somewhat similar to this SO but not the same.

I created a HelloWorld program with the following:

add_executable( HelloWorld ${SRC} )

When I generate a project file (for example a Visual Studio .sln file, or an XCode .xcodeproj file). I want to hit the run button and pass in some command line arguments to HelloWorld when it executes the program, like the following:

./HelloWorld --gtest_filter=Test_Cases1*

Also see this SO for how this is done in Visual Studio.

Is it possible to do this in CMakeList file? If not, why?

like image 334
Yuchen Avatar asked May 07 '15 14:05

Yuchen


1 Answers

CMake 3.13.0 looks like it will add support for this in the form of the following target properties:

  • VS_DEBUGGER_COMMAND_ARGUMENTS - Sets the local debugger command line arguments for Visual Studio C++ targets.
  • VS_DEBUGGER_ENVIRONMENT - Sets the local debugger environment for Visual Studio C++ targets.

It extends use with these commands, available since CMake 3.12:

  • VS_DEBUGGER_COMMAND - Sets the local debugger command for Visual Studio C++ targets.
  • VS_DEBUGGER_WORKING_DIRECTORY - Sets the local debugger working directory for Visual Studio C++ targets.
like image 168
KymikoLoco Avatar answered Sep 24 '22 10:09

KymikoLoco