News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

using ${TARGET_OUTPUT_FILE} in tools is giving other result then expected

Started by Jewe, January 17, 2008, 09:18:38 AM

Previous topic - Next topic

Jewe

Hi,

I am creating a small tool to copy the result dll from a project to a certain directory
Name: Copy file
Exe: Copy
Para: ${TARGET_OUTPUT_FILE} "c:\Program Files\FitTrainer"
Dir: ${TARGET_OUTPUT_DIR}

Everything is getting filled in except the ${TARGET_OUTPUT_FILE}.
What am I doing wrong?

cheers,

Jewe
Anything curved in the hardware can be straighten with software :D
OS: Vista64 + Debian(to play with)
Compiler: mingw IDE: Code::Blocks Nightly WX: 2.8.0

thomas

Hard to tell what you're doing wrong, if anything.

Apart from the possibility of a bug (unlikely, since I've used that variable in the past, and it worked), this variable is only defined during the build (more specifically, only inside target scope, so for example it is not defined during the project's post-build steps). Thus, if you use different place, it will not be replaced.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Jewe

Thanks Thomas for the explanation.

if this is done by design, please remove the macro keyword from the window.
it looks like you could use this key word at any time.

cheers,

Jeffrey
Anything curved in the hardware can be straighten with software :D
OS: Vista64 + Debian(to play with)
Compiler: mingw IDE: Code::Blocks Nightly WX: 2.8.0

mariocup

You could do such simple things in a postbuilt step of your project and then you have access to the CB variables.


cmd /c copy $(TARGET_OUTPUT_FILE) <pathname>

thomas

Quote from: Jewe on January 17, 2008, 11:34:26 AMif this is done by design, please remove the macro keyword from the window.
it looks like you could use this key word at any time.
Well, it can be used at any time, it just doesn't make sense to do so. What this variable points to is the output file of the currently active target. Such a thing as a "currently active" target obviously only exists while the build is running and a target is being built. At all other times, any target in the project is just as much "active" or "not active" like any other.
What value different from "empty" would you expect the variable to have?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

MortenMacFly

Quote from: Jewe on January 17, 2008, 11:34:26 AM
if this is done by design, please remove the macro keyword from the window.
it looks like you could use this key word at any time.
Replace "TARGET" with the actual targets name, e.g. "DEFAULT" -> so that it reads $(DEFAULT_OUTPUT_FILE) and it'll work for the tools menu. Thomas and you spoke about different things. Thomas spoke about pre/post-build steps and you are about the tool menu.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

thomas

Quote from: MortenMacFly on January 17, 2008, 07:48:13 PMThomas spoke about pre/post-build steps and you are about the tool menu.
Same thing. It's not defined in either :)

QuoteReplace "TARGET" with the actual targets name, e.g. "DEFAULT" -> so that it reads $(DEFAULT_OUTPUT_FILE)
This will work (but it's an entirely different thing too, it refers to precisely one particular target, not the active one).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

MortenMacFly

Quote from: thomas on January 17, 2008, 08:30:49 PM
Same thing. It's not defined in either :)
But I still believe he ment $([HOWEVER_THE_TARGETS_NAME_IS]_OUTPUT_FILE) which *does* exist. ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]