Reputation: 43
I am currently able to set up and compile a a visual studio project using cmake however I am unable to breakpoint in source at all. Originally I was warned by VS when I tried to run with the debugger that debug symbols could not be found. To fix this I simply went to the projects properties and selected Linker->Debugging and set "Generate Debug Info" to yes. Now it generates the necessary pdb file, however if I put a break point in the source code it will hollow out and tell me that no symbols where loaded for the document.
So my question is why is it not matching the source to the pdb file and what can I do to correct this?
Thanks.
Here's a git repo with a simple example: https://github.com/Samurai336/CmakeSimple
Upvotes: 0
Views: 2439
Reputation: 43
Ok I figured out what the problem was, thanks to digging deeper into user Fraser's comment, where he asked if I set my debug information format to "/Zi or /ZI". Well it was set to Zi so to put the science back in computer science I gave /ZI a shot. The compiler yelled at me that " '/ZI' and '/02' are incompatible." So today I looked into what the /02 flag is and realized that it was max speed optimization flag and had a hunch that was why it was having issues debugging. Sure enough when I changed the flag to '/Od'(disabled) everything break pointed accordingly.
This leaves me with a one major question though: How do I set these flags for the VS compiler from cmake?
I'll probably pose this as a separate question if I don't find it already answered.
Thanks for the help everyone.
Upvotes: 3