我想通过 add_custom_command(...) 在 CMakeLists.txt 中使用 Linux if 条件,因为我需要运行这些 if 条件并在 makefile 中做一些判断。像这样:
cmake_minimum_required(VERSION 2.8)
add_custom_target(temp_target ALL)
add_custom_command(TARGET temp_target
PRE_BUILD
COMMAND if ["a" != "b"]; then echo 1; fi;
VERBATIM )
Run Code Online (Sandbox Code Playgroud)
如果我想使用我该怎么办
if ["a" != "b"]; then echo 1; fi;
Run Code Online (Sandbox Code Playgroud)
什么时候制作makefile?非常感谢您的帮助!
我的工作是将Linux命令转换为CMake execute_process(COMMAND ...),并且它们之间存在一些差异,因此我需要了解每个Linux命令。但是这个m4命令确实击败了我。m4命令如下:
m4 -Isource/analyzer/ -P < source/analyzer/aParser.m4y > source/analyzer/aParser.by
Run Code Online (Sandbox Code Playgroud)
该命令是什么意思?
我之前阅读过m4文档,它说m4命令的格式为: m4 [option…] [file…],所以我认为在命令中:
m4 -Isource/analyzer/ -P < source/analyzer/aParser.m4y > source/analyzer/aParser.by
Run Code Online (Sandbox Code Playgroud)
该-Isource/analyzer/ -P是[option...]的m4,这m4commad使用<阅读文件source/analyzer/aParser.m4y为M4 [file...],我有没有正确的理解呢?