diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-13 09:20:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-13 09:20:02 +0300 |
commit | 99e06af9c8c2d2c92570796f76baefd405a3b67a (patch) | |
tree | d3b57a051e73ee71ebb666f33ef89d57d856ad67 /build_files/cmake/cmake_print_build_options.py | |
parent | ffe5b92325a2a75d691adfacac9b8259e5e6d577 (diff) |
Cleanup: move 'make help_features' into own file
Diffstat (limited to 'build_files/cmake/cmake_print_build_options.py')
-rw-r--r-- | build_files/cmake/cmake_print_build_options.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/build_files/cmake/cmake_print_build_options.py b/build_files/cmake/cmake_print_build_options.py new file mode 100644 index 00000000000..fb7a5b33bf0 --- /dev/null +++ b/build_files/cmake/cmake_print_build_options.py @@ -0,0 +1,25 @@ +# Apache License, Version 2.0 + +# Simple utility that prints all WITH_* options in a CMakeLists.txt +# Called by 'make help_features' + +import re +import sys + +cmakelists_file = sys.argv[-1] + +def main(): + options = [] + for l in open(cmakelists_file, 'r').readlines(): + if not l.lstrip().startswith('#'): + l_option = re.sub(r'.*\boption\s*\(\s*(WITH_[a-zA-Z0-9_]+)\s+\"(.*)\"\s*.*', r'\g<1> - \g<2>', l) + if l_option != l: + l_option = l_option.strip() + if l_option.startswith('WITH_'): + options.append(l_option) + + print('\n'.join(options)) + + +if __name__ == "__main__": + main() |