Skip to content

Instantly share code, notes, and snippets.

@saxbophone
Created February 19, 2024 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saxbophone/6e7373eb9fadf55e82004d0a2831358b to your computer and use it in GitHub Desktop.
Save saxbophone/6e7373eb9fadf55e82004d0a2831358b to your computer and use it in GitHub Desktop.
For transforming autoheader defines into CMake configure_file() defines
#include <iostream>
#include <regex>
#include <string>
int main() {
std::regex find_undefs{"(?:#undef\\s+)([_A-z][_0-9A-z]*)"};
std::cout << std::regex_replace("#undef _1FOO_BAR_BAZ1234_", find_undefs, "#cmakedefine $1 1") << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment