diff --git a/src/api/python/setup.py b/src/api/python/setup.py index 572b0a7a735..56f310fff76 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -129,6 +129,17 @@ def _configure_z3(): for key, val in cmake_options.items(): if type(val) is bool: cmake_options[key] = str(val).upper() + + # Allow command-line arguments to add and override Z3_ options + for i in range(len(sys.argv) - 1): + key = sys.argv[i] + if key.starts_with("Z3_"): + val = sys.argv[i + 1] + if val.lower() == "true": + cmake_options[key] = "TRUE" + elif val.lower() == "false": + cmake_options[key] = "FALSE" + cmake_args = [ '-D' + key + '=' + value for key,value in cmake_options.items() ] args = [ 'cmake', *cmake_args, SRC_DIR ] if subprocess.call(args, env=build_env, cwd=BUILD_DIR) != 0: