How to put regex string as compiler option

Thank you for answer!
Problem with backslash still exist… CMake converts symbols \. to .. How to fix this?
Second problem with $.