Fix build on older CMake versions

MAKE_C_IDENTIFIER seem to only be available on relatively new CMake
versions, so replace it with similar REGEX REPLACE.