User forums > Using Code::Blocks
Make commands
sorinev:
I'd like to do what is shown in this answer at stackoverflow. Is this something I can have added to the build process through a C::B dialog somewhere, or is this something that would necessitate using a custom Makefile for the project?
oBFusCATed:
Have you tried to use a backtick expression?
sorinev:
Code::Blocks doesn't include a Makefile with projects, it seems to just sort of do it transparently in the background, so I can't just edit a file somewhere. What I'm asking is, is there a place in the project dialog / build options somewhere that I can place things that would normally go in a Makefile, into the Code::Blocks' build process? Or, in order to do this, do I need to change the project to use a custom Makefile? (meaning, I have to set up the wxWidgets stuff semi-manually; which is fine, I do it in a Makefile on a Linux project I have).
oBFusCATed:
Your question is pretty vague. C::B's build system has most of the makefile features, so the things described in the stackoverflow post are possible.
In place of $(GIT_VERSION) you might have to use a backtick expression (`git blabla.... `).
See this http://wiki.codeblocks.org/index.php/Variable_expansion
The only problem might happen because C::B caches the output of backtick expressions. But this is fixable.
sorinev:
I'm trying to add those two lines to the pre-build steps and I cannot for the life of me get it to work. It always returns failed for the first line. I've tried:
--- Code: ---GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
--- End code ---
--- Code: ---GIT_VERSION := `git describe --abbrev=4 --dirty --always --tags`
--- End code ---
--- Code: ---GIT_VERSION := {cmd /c git describe --abbrev=4 --dirty --always --tags}
--- End code ---
--- Code: ---GIT_VERSION := {git describe --abbrev=4 --dirty --always --tags}
--- End code ---
Output of the first one shows it removing the $(shell part, but it leaves the trailing ) in there.
I've also tried only having different variations of the second line in the pre-build steps and adding the first one to the custom variables tab (the next one over from pre/post build tab), but that didn't work either (it does substitute the variable for the command, but it still fails).
I'm obviously misunderstanding how this works. I figured it would be added to pre-build steps exactly as you would have it in a Makefile, but I guess not. This is on Windows 10, svn 10703, and I've add git's bin directory to the system path.
Navigation
[0] Message Index
[#] Next page
Go to full version