Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: ouch on April 23, 2011, 12:03:12 am

Title: is $if(){}{} broken in svn 7121?
Post by: ouch on April 23, 2011, 12:03:12 am
it hides the $if part but passes the rest to the command lines...

going by the wiki it says:

$if(condition){true clause}{false clause}

located at the bottom of:

http://wiki.codeblocks.org/index.php?title=Variable_expansion

has the context changed or something?

running win 7
Title: Re: is $if(){}{} broken in svn 7121?
Post by: ouch on April 25, 2011, 12:52:04 am
Can someone at least try it and see if it works for you with what ever version you have? It's breaking my build process and to fix it I have to do a lot of manual configuring.
Title: Re: is $if(){}{} broken in svn 7121?
Post by: stahta01 on April 25, 2011, 04:50:23 am
I do not use the feature; but, I see no difference in how it worked for me between 10.05 and current SVN build. Tested in pre-build step.

If you want something done, post how to duplicate the problem.

Tim S
Title: Re: is $if(){}{} broken in svn 7121?
Post by: ouch on April 25, 2011, 05:05:06 pm
really? it works for you?

maybe I'm using it wrong then.

in my link libraries I have this:

libSQLite3_$if($(SQLite3Ver)){$(SQLite3Ver)}{$(#sqlite3.ver)}

SQLite3Ver is created but undefined.

sqlite3.ver is equal to 3070602 (defined in global variables)

The output looks like this:

-lSQLite3_(){}{3070602}

That's not right is it? or am I placing it somewhere I shouldn't?
Title: Re: is $if(){}{} broken in svn 7121?
Post by: stahta01 on April 25, 2011, 05:40:12 pm
Your use is much more complex than mine. You might try using a defined/constant value as the test.
I use 1==1 in a pre-step and it looked like it worked.
No idea if it works in the Library name area.

Edit: Tried below and it looked like it worked OK in the library name list.

Code
libSQLite3_$if(%SQLite3Ver%){$(SQLite3Ver)}{$(#sqlite3.ver)}

Tim S.
Title: Re: is $if(){}{} broken in svn 7121?
Post by: ouch on April 25, 2011, 05:57:02 pm
indeed, seems like it doesn't like variable declared like $(var) in the conditional section. Maybe it interferes with the parenthesis of the the if declaration?

should be added to the wiki (or even better, fixed...) if it turns out to be so.

thanks for your time!

edit:
omg! this rocks so hard! I had multiple global vars defined for each version of the library used. Now I have one for each library with a default version defined to use. This can be overridden in the project root's custom var section. just enter in the version you want to use and everything just works. I love it!