CMake and configure_file: what if I need $ONLY instead of @ONLY? -
as documentation of configure_file, has useful @only parameter used to:
restrict variable replacement references of form
@var@. useful configuring scripts use${var}syntax.
so far good.
now i'm in case i've file contains both @foo@ , ${bar} , want replace s{bar} variable comes cmakelists.tx. on other side don't want configure_file tries replace @foo@.
in other terms, need $only parameter works @only opposite case.
is there chance can have right now?
tried putting backslashes in front of @, way obtain file contains couple of \@ , not need.
at least found solution works, if i'm not sure that's best approach ever.
leave answer future readers in case no solutions come up.
suppose line elaborated looks this:
@donttouchme@/${project_name} to able skip @donttouchme@ part when pass file configure_file, can change line follows:
@@workaround@donttouchme@workaround@@/${project_name} configure_file match , replace @workaround@ parts empty string , forget other @ around, obtain following line after substitution:
@donttouchme@/thenameoftheproject quite dirty , break out future releases of cmake exploits bug (uhm, i'm not sure can call way actually) of tool.
anyway, works , can viable approach out there still looking possible solution.
Comments
Post a Comment