假设我有一个像这样的简单项目:
main
|-- CMakeLists.txt
|-- sub1
|------ CMakeLists.txt
|------ sub1.cpp
|------ sub1.h
|-- sub2
|------ CMakeLists.txt
|------ sub2.cpp
|------ sub2.h
然后在main/CMakeLists.txt
我有
add_subdirectory(sub1) # Build an executable file called exec1
add_subdirectory(sub2) # Build an executable file called exec2
add_custom_target(exec_all DEPENDS exec1 exec2)
如果make exec_all
或exec1
尚未成功构建,是否允许exec2
运行?为了更清楚,我希望能够make exec_all
,但如果make exec1
失败,它仍然会运行并打印出消息说
ERROR: exec1 was not successfully built. exec_all will only run exec2
这在当前的CMake
中是否可行,还是相当长的?
答案 0 :(得分:1)
如果您不想要scrict依赖,那么您不需要使用$('#vendoridpopupp').popup({
history: false
}).popup('open');
}
选项。只需创建执行所需操作的脚本并通过DEPENDS
选项传递它:
<强> run.sh 强>:
COMMAND
<强>的CMakeLists.txt 强>:
# Usage: run.sh target [target ...]
for target in $@; do
if make ${target}; then
bin/${target} # Expect executables under bin/ directory.
else
echo "ERROR: ${target} was not succeffully built. Do not run it"
fi
done