News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

pre-build steps

Started by LETARTARE, January 13, 2013, 12:56:38 PM

Previous topic - Next topic

LETARTARE

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
Quotecmd /c echo "Pre-build steps"
I defined in "Project build options->Custom variables"
QuoteGOOD=false
or
QuoteGOOD=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-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

MortenMacFly

Quote from: LETARTARE on January 13, 2013, 12:56:38 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: [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]

Jenna

Quote from: http://wiki.codeblocks.org/index.php?title=Variable_expansion#Conditional_EvaluationPlease do note that neither the variable syntax variants %if(...) nor $(if)(...) are supported for this construct.

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

LETARTARE

thank you very much to both.
You are always as effective in your answers
I misread the text !

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

Cordially.
CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'