Author Topic: using ${TARGET_OUTPUT_FILE} in tools is giving other result then expected  (Read 7457 times)

Offline Jewe

  • Multiple posting newcomer
  • *
  • Posts: 70
    • Fit Trainer
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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
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."

Offline Jewe

  • Multiple posting newcomer
  • *
  • Posts: 70
    • Fit Trainer
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

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

Code
cmd /c copy $(TARGET_OUTPUT_FILE) <pathname>

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
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.
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."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Thomas spoke about pre/post-build steps and you are about the tool menu.
Same thing. It's not defined in either :)

Quote
Replace "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."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ