CMake 入門/常用命令列參數

命令列參數 编辑

替代系統指令 编辑

CMake 提供以下命令以取代系統內建的命令,便於撰寫跨平台腳本。所有的命令都可以透過以下方式執行:

cmake -E 命令內容
chdir dir cmd [args]...
run command in a given directory
rename oldname newname
rename a file or directory (on one volume)
copy file destination
copy file to destination (either file or directory)
copy_if_different in-file out-file
copy file if input has changed
copy_directory source destination
copy directory 'source' content to directory 'destination'
compare_files file1 file2
check if file1 is same as file2
echo [string]...
displays arguments as text
echo_append [string]...
displays arguments as text but no new line
environment
display the current enviroment
make_directory dir
create a directory
md5sum file1 [...]
compute md5sum of files
remove_directory dir
remove a directory and its contents
remove [-f] file1 file2 ...
remove the file(s), use -f to force it
tar [cxt][vfz][cvfj] file.tar file/dir1 file/dir2 ...
create a tar archive
time command [args] ...
run command and return elapsed time
touch file
touch a file.
touch_nocreate file
touch a file but do not create it.
build build_dir
build the project in build_dir.
write_regv key value
write registry value
delete_regv key
delete registry value
comspec
on windows 9x use this for RunCommand

Generator 名稱 编辑

cmake -G "Generator 名稱"
Borland Makefiles
生成 Borland makefiles.
MSYS Makefiles
生成 MSYS makefile.
MinGW Makefiles
生成 mingw32-make 的 makefile
NMake Makefiles
生成 NMake makefiles.
NMake Makefiles JOM
生成 JOM makefiles.
Unix Makefiles
生成 standard UNIX makefiles.
Visual Studio 10
生成 Visual Studio 10 專案檔。
Visual Studio 10 Win64
生成 Visual Studio 10 Win64 專案檔。
Visual Studio 6
生成 Visual Studio 6 專案檔。
Visual Studio 7
生成 Visual Studio .NET 2002 專案檔。
Visual Studio 7 .NET 2003
生成 Visual Studio .NET 2003 專案檔。
Visual Studio 8 2005
生成 Visual Studio .NET 2005 專案檔。
Visual Studio 8 2005 Win64
生成 Visual Studio .NET 2005 Win64 專案檔。
Visual Studio 9 2008
生成 Visual Studio 9 2008 專案檔。
Visual Studio 9 2008 Win64
生成 Visual Studio 9 2008 Win64 專案檔。
Watcom WMake
生成 Watcom WMake makefiles
CodeBlocks - MinGW Makefiles
生成 CodeBlocks 專案檔。
CodeBlocks - NMake Makefiles
生成 CodeBlocks 專案檔。
CodeBlocks - Unix Makefiles
生成 CodeBlocks 專案檔。
Eclipse CDT4 - MinGW Makefiles
生成 Eclipse CDT 4.0 專案檔。
Eclipse CDT4 - NMake Makefiles
生成 Eclipse CDT 4.0 專案檔。
Eclipse CDT4 - Unix Makefiles
生成 Eclipse CDT 4.0 專案檔。

進階 Help 功能 编辑