如何使用CMake执行shell脚本?应该运行的命令是my_script
,应该在构建之后执行。 CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(abc)
include_directories("/usr/lib/avr/include")
set(CMAKE_CURRENT_SOURCE_DIR /home/user/Desktop)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmcu=atmega8")
set(SOURCE_FILES main.c)
add_executable(abc ${SOURCE_FILES})
#not working ----->
add_custom_command(TARGET abc
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E my_script
)
声明
答案 0 :(得分:9)
你正在调用CMake command-line tool mode,它不会执行通用脚本或命令。
相反,例如
render() {
const {setTeam} = this.props;
return <div onClick={setTeam} />
}