Specify a source directory to (re-)generate a build system for it in the current working directory. Specify an existing build directory to re-generate its build system.
Run 'cmake --help'for more information.
输出这些即为正确
使用Python3脚本进行构建
写一个普通的CMakeLists.txt,这里不多说了。
下载下面的脚本,并按要求修改
# Work With Python3 import os import stat from shutil import rmtree from subprocess import check_call
defrmtree_silent(root): defremove_readonly_handler(fn, root, excinfo): if fn is os.rmdir: if os.path.isdir(root): # if exists os.chmod(root, stat.S_IWRITE) # make writable os.rmdir(root) elif fn is os.remove: if os.path.isfile(root): # if exists os.chmod(root, stat.S_IWRITE) # make writable os.remove(root)
rmtree(root, onerror=remove_readonly_handler)
defmakedirs_silent(root): try: os.makedirs(root) except OSError: # mute if exists pass
if __name__ == "__main__": build_dir = resolve_path("build") rmtree_silent(build_dir) makedirs_silent(build_dir) os.chdir(build_dir)