User forums > Using Code::Blocks
buildnumber in filename
(1/1)
hollim:
Hi forum,
an output file in a Release target need to be named including the actual build number. Fortunately the build number is stored in a separate file inside the project dir. The manual says that back ticks could be used. So a command line in the targets' post script like the following should do it in my opinion:
--- Code: ---objdump -D $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)-`type buildnumber.dat`.dump
--- End code ---
This unfortunately doesn't work.
The manual however doesn't tell, if this is either platform dependent or to be used in a special context only.
This problem arose on a Windows 7 VM using C::B 13.12.
Can anybody give a hint, please?
Greetings
Hollim
oBFusCATed:
Are you sure there is no new line character at the end of the buildnumber.dat file?
Are you sure type is not printing one for you?
hollim:
There is a 0x0d 0x0a in the file (it's Window$).
I'm sure 'type' isn't able to do anything as it doesn't gets called at all.
Putting a line with:
--- Code: ---`find "blablabla" c:\temp\usercode.txt`
--- End code ---
in a post build script, its execution results in:
--- Code: ---Running target post-build steps
`find "blablabla" c:\temp\usercode.txt`
Execution of '`find "blablabla" c:\temp\usercode.txt`' in 'C:\Pro\newproject' failed.
--- End code ---
It does however run fine in a regular cmd window.
Ho did you implement the back ticks in the Win version of C::B? Are you sure this is available on Win?
If this isn't working, is there a way to set a (global) variable from a pre build script for using in the post build script?
Please note that I'm not aware of the C::B script engine - I'm talking about the Project Build Options / Pre/Post Build Steps.
Thanks.
oBFusCATed:
Hm, probably type is not an executable, but a build-in command of cmd.exe.
But I've tried `echo 5` and it is not executed. Probably C::B is not doing the macro expansion on the executables output... Someone needs to check the source to verify if this is the case...
Navigation
[0] Message Index
Go to full version