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.
libSQLite3_$if(%SQLite3Ver%){$(SQLite3Ver)}{$(#sqlite3.ver)}
Tim S.