User forums > Using Code::Blocks

pre-build steps

(1/1)

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

--- Quote ---cmd /c echo "Pre-build steps"
--- End quote ---
I defined in "Project build options->Custom variables"

--- Quote ---GOOD=false
--- End quote ---
or

--- Quote ---GOOD=true
--- End quote ---
and in "Project build options->Pre/post build steps"

--- Quote ---$(if(GOOD) ) {cmd /c echo "Pre-build steps" }
--- End quote ---

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.

--- End quote ---

Is it a mistake on my part or not?
Sincerely


MortenMacFly:

--- Quote from: LETARTARE on January 13, 2013, 12:56:38 pm ---Is it a mistake on my part or not?

--- End quote ---
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.

Jenna:

--- 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.
--- End quote ---

In your case something like:

--- Code: ---cmd /c echo $if($GOOD){"Pre-build steps"}
--- End code ---
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 :

--- Quote ---echo $if($GOOD) {"Pre-build step"}
--- End quote ---
or

--- Quote ---cmd /c echo $if($GOOD) {"Pre-build step"}
--- End quote ---

Cordially.

Navigation

[0] Message Index

Go to full version