这里以if()/elseif()/else()/endif()举个例子,for/while循环也是类似的: set(EMPTY_STR "") if (NOT EMPTY_STR AND FLAG AND NUM LESS 50 AND NOT NOT_DEFINE_VAR) message("The first if branch...") elseif (EMPTY_STR) message("EMPTY_STR is not empty") else () message("All other cas...
4. set(var a;b;c) <=> set(var a b c) #定义变量var并赋值为a;b;c这样一个string list 5. Add_executable(${var}) <=> Add_executable(a b c) #变量使用${xxx}引用 6. 条件语句: if(var) #var 非empty 0 N No OFF FALSE... #非运算使用NOT … else()/elseif() … endif(var) ...
OFF, NO, FALSE, N, IGNORE, NOTFOUND, the emptystring, or endsinthe suffix -NOTFOUND. Named boolean constants arecase-insensitive. If the argument is not one of these constants, it is treated as a variable.if(<variable>)
条件控制流if ```cmake some_command will be called if the variable's value is not: empty, 0, N, NO, OFF, FALSE, NOTFOUND, or -NOTFOUND. if(var) some_command(...) endif(var) ``` 循环结构:foreach和while ```cmake set(VAR a b c) ...
cmake_minimum_required(VERSION 3.20.0) project(PropagatedProperties CXX) add_library(source1 empty.cpp) set_property(TARGET source1 PROPERTY INTERFACE_LIB_VERSION 4) set_property(TARGET source1 APPEND PROPERTY COMPATIBLE_INTERFACE_STRING LIB_VERSION ) add_library(source2 empty.cpp) set_property(TARG...
conditionEvaluator.IsTrue(expandedArguments, errorString, status); if(!errorString.empty()) { std::string err = cmStrCat("if",cmIfCommandError(expandedArguments), errorString); if(status == MessageType::FATAL_ERROR) { makefile.IssueMessage(MessageType::FATAL_ERROR, err); ...
Each variable reference will be replaced with the current value of the variable, or the empty string if the variable is not defined. Furthermore, input lines of the form: 拷贝一个 (输入文件) 文件到 (输出文件),并且替换输入文件中被 @VAR@ 或者 ${VAR} 引用的变量值。每一个变量将被替换成...
False if the constant is 0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND. Named boolean constants are case-insensitive. If the argument is not one of these constants, it is treated as a variable. 判断表达式中常用的指令: 命令名变量说明 NOT ...
The output variable value will be "OLD" or "NEW" if the policy is set, and empty otherwise. CMake keeps policy settings on a stack, so changes made by the cmake_policy command affect only the top of the stack. A new entry on the policy stack is managed automatically for each ...
True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. False if the constant is 0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND. Named boolean constants are case-insensitive. If the argument is not one of these constants...