0

I have a cross-platform project which uses cmake in order to generate Visual Studio solution files. The project has external dependencies (.dlls, resources etc) and the only place where the executable can be run is the installation directory. In that directory I have access all the resources, plugins, translations etc. I can install the project both in debug or release in that directory.

How can I debug a project in the installed location?

There are two problems with this case:

  1. Sometimes I may debug the main application (Main.exe) (a target in cmake project)
  2. Sometimes I may debug some plugins that Main.exe loads when started (I have a different cmake project for the plugins)

Is there a clean way of doing this in Visual C++ without actually create some custom project that is configured to start each time the Main.exe from the installed location? ("C:\Program Files\MainProject\Main.exe" )

Thank you, Iulian

INS
  • 10,594
  • 7
  • 58
  • 89
  • With Visual Studio debugger you can access an already running process. The amount of debug information will vary depending on how the process was compiled and linked. I believe you just start up Visual Studio, attach to the process and it will ask you where the source code is located. – Richard Chambers Feb 23 '14 at 17:00
  • @RichardChambers yes, but how about adding a breakpoint on startup? This approach (Attach to process) makes it hard to debug the start of the program. – INS Feb 23 '14 at 19:32
  • this answer may offer some hints http://stackoverflow.com/a/2681175 – INS Feb 23 '14 at 20:36

1 Answers1

0

I managed to do it by 'configuring' with cmake a .user file for the specified project.

The only thing that the user needs to do is to use a template like in this bitbucket project.

In the project you can find a template file.

The cmake script command needed is:

CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/scripts/windows/VS201x_Template.vcxproj.user.in"
"${PROJECT_BINARY_DIR}/INSTALL.vcxproj.user"
)

If you need a custom .user file you can always do it manually by saving the generated Visual Studio and creating a template from it similarly to the above example.

INS
  • 10,594
  • 7
  • 58
  • 89