cmake CMD execute_process

execute_process

执行一个或更多个子进程。运行一条或多条命令,使得前一条命令的标准输出以管道的方式成为下一条命令的标准输入。所有进程公用一个单独的标准错误管道。

cmd1 在ubuntu环境可以是shell的commond  如cp、mkdir之类

如:

execute_process(COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/libs)   创建文件夹

execute_process(COMMAND cp ${PROJECT_SOURCE_DIR}/lib/libx264.a ${CMAKE_CURRENT_BINARY_DIR}/libs) 拷贝

cmd1 填入 CMAKE_COMMAND(CMAKE_COMMAND指向CMake可执行文件的完整路径 )

拷贝指令如下:

execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/lib/libx264.a ${CMAKE_CURRENT_BINARY_DIR})

命令集合如下:

Usage: /home/user/bin/cmake -E [command] [arguments …]

Available commands:

build build_dir - build the project in build_dir.

chdir dir cmd [args]… - run command in a given directory

compare_files file1 file2 - check if file1 is same as file2

copy file destination - copy file to destination (either file or directory)

copy_directory source destination - copy directory ‘source’ content to directory ‘destination’

copy_if_different in-file out-file - copy file if input has changed

echo [string]… - displays arguments as text

echo_append [string]… - displays arguments as text but no new line

environment - display the current environment

make_directory dir - create a directory

md5sum file1 […] - compute md5sum of files

remove [-f] file1 file2 … - remove the file(s), use -f to force it

remove_directory dir - remove a directory and its contents

rename oldname newname - rename a file or directory (on one volume)

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.

Available on UNIX only:

create_symlink old new - create a symbolic link new -> old

你可能感兴趣的:(cmake CMD execute_process)