Author Topic: pre-build steps  (Read 8482 times)

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
pre-build steps
« on: January 13, 2013, 12:56:38 pm »
hello,
I read : http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks
and : http://wiki.codeblocks.org/index.php?title=Variable_expansion conditional condition

With C::B12.11 Vista Pro
In a project I want to start a conditional order before compilation
Quote
cmd /c echo "Pre-build steps"
I defined in "Project build options->Custom variables"
Quote
GOOD=false
or
Quote
GOOD=true
and in "Project build options->Pre/post build steps"
Quote
$(if(GOOD) ) {cmd /c echo "Pre-build steps" }

I run the generation and I get the result:
Quote
[100,0%] Running project pre-build steps
 (false ) {cmd /c echo "Pre-build steps"} {}
Execution of ' (false ) {cmd /c echo "IRtest2 Pre-build steps"} {}' in 'U:\DONNEES\TRAVAIL_NT\CodeBlock\Arduino\IRtest2' failed.

Is it a mistake on my part or not?
Sincerely


CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: pre-build steps
« Reply #1 on: January 13, 2013, 01:26:12 pm »
Is it a mistake on my part or not?
I'm afraid so. In SVN, see how you can use such macros/scripting foo in this project file:
[C::B_SVN]\src\tools\test\macrosmanager\macrosmanager.cbp
It covers pretty much every case.

BTW: From the code its unclear to me if you want use C::B's scripting engine, variable expansion, both, or not... ???

However, the example posted above will help.
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: pre-build steps
« Reply #2 on: January 13, 2013, 01:40:59 pm »
Quote from: http://wiki.codeblocks.org/index.php?title=Variable_expansion#Conditional_Evaluation
Please do note that neither the variable syntax variants %if(...) nor $(if)(...) are supported for this construct.

In your case something like:
Code
cmd /c echo $if($GOOD){"Pre-build steps"}
should work

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: pre-build steps
« Reply #3 on: January 13, 2013, 02:38:09 pm »
thank you very much to both.
You are always as effective in your answers
I misread the text !

Error syntax !!
it's correct :
Quote
echo $if($GOOD) {"Pre-build step"}
or
Quote
cmd /c echo $if($GOOD) {"Pre-build step"}

Cordially.
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl