Re: [Vala] Debugging Vala w/ CMake



On 02/05/2015 01:10 PM, Steven Oliver wrote:
I want to start debugging my Vala code so a simple good turned up some
pretty easy directions, the only problem is I can't seem to integrate those
directions with CMake.

The instructions I found on the Vala webiste actually work very well for
the example given [1]. My problem is when combining those with the CMake
files from Jakob Westhoff [2] that are so popular these days, I always get
the error that you can't combine the valac option -C with --save-temps.

Does anyone know a way to do both without breaking my existing CMake setup?

TL;DR: Use -DCMAKE_BUILD_TYPE=Debug

CMake is passing the -C option to valac which means generate .c files but don't compile them. CMake then later calls gcc itself to compile the generated .c files instead of the valac command calling gcc.

The --save-temps means save the .c files, so obviously it is redundant when using the -C option and should be left out.

If you read the readme from J. Westhoff[1], you will find that you need to set -DCMAKE_BUILD_TYPE=Debug to get a debug build. I assume the fork you linked works the same way. Setting this will pass the -g option to valac (and gcc), so you don't have to add it in the OPTIONS section. If you just try to add -g to OPTIONS, it does not get passed to gcc when compiling the generated .c files and of course you won't be able to debug.

[1]: https://github.com/jakobwesthoff/Vala_CMake


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]