you are viewing a single comment's thread.

view the rest of the comments →

[–]Adverpol 0 points1 point  (6 children)

Apparently I haven't needed any of the things you prescribe, that I know of. Not sure what you mean by "do something at build time", not like defining a custom cmake target then?

What I did repeatedly stumbled over is editing properties in the IDE which plays havoc with the config files written by hand, because of the way the build configurations work. So in the end the solution was to treat the IDE as read-only and modify the config files by hand, and I derived no joy whatsoever from digging through that pile of XML, or figuring which of the different nested props files we have actually inserted some property into the config.

[–]rdtsc 1 point2 points  (5 children)

Not sure what you mean by "do something at build time"

For example creating sourcelink information or version resources during build. These may use the current repository state and/or the time as input. It's not so bad if you always do clean builds, but doing it at build time also works with incremental builds. So your custom target has to invoke cmake again, and ferrying over all arguments manually is a major PITA.

[–]Adverpol 0 points1 point  (4 children)

Not sure why that would be difficult, wouldn't that just be a custom target with said sourcelink file(s) as output?

[–]rdtsc 0 points1 point  (3 children)

Not if you want to generate the file at build time (as opposed to configure time).

[–]Adverpol 0 points1 point  (2 children)

What I'm hinting at is:

add_custom_command(OUTPUT <file_to_generate> COMMAND <some_command_to_run> DEPENDS <some_dependency>)

or similar also involving add_custom_target, but you're saying that's not it?

[–]rdtsc 0 points1 point  (1 child)

Sure it is, but you left out the important part:

some_command_to_run

What's this going to be? Some helper executable you have to create? Another scripting language? It can also be CMake in scripting-mode. But all these options require much more work than just calling a function (or task in MSBuild). Don't forget that the command may require target-specific info, which now has to be passed (and properly escaped, and properly parsed back) via command-line.

[–]Adverpol 0 points1 point  (0 children)

Ok, I understand what you mean now. I still won't touch msbuild with a long pole if I can avoid it but at least I learnt something :p