Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Cmake if #288

Open
junxnone opened this issue Aug 18, 2023 · 0 comments
Open

Build Cmake if #288

junxnone opened this issue Aug 18, 2023 · 0 comments

Comments

@junxnone
Copy link
Owner

junxnone commented Aug 18, 2023

if

  • 条件控制语句
if(<condition>)
  <commands>
elseif(<condition>) # optional block, can be repeated
  <commands>
else()              # optional block
  <commands>
endif()

condition

  • Basic Expressions
    • constant
    • variable
    • string
  • Logic Operators(逻辑操作)
    • NOT
    • AND
    • OR
  • Existence Checks(存在性检查)
    • COMMAND: 如果给定的命令、宏或函数是可以调用的,则为 True
    • POLICY: Policy 存在
    • TARGET: 如果 target 已经定义(add_executable()/ add_library()/ add_custom_target())
    • TEST: test 已经定义(add_test())
    • DEFINED: 变量被定义
    • IN_LIST: 给定值存在 list 变量中
  • File Operations(文件操作)
    • EXISTS: 文件或目录存在
    • IS_NEWER_THAN: 比较文件时间戳
    • IS_DIRECTORY :判断是否是目录
    • IS_SYMLINK :是否是软连接
    • IS_ABSOLUTE : 是否是绝对路径
  • 比较
    • MATCHES
    • LESS
    • GREATER
    • EQUAL
    • LESS_EQUAL
    • GREATER_EQUAL
    • STRLESSSTRGREATER
    • STREQUAL
    • STRLESS_EQUAL
    • STRGREATER_EQUAL
  • 版本比较
    • VERSION_LESS
    • VERSION_GREATER
    • VERSION_EQUAL
    • VERSION_LESS_EQUAL
    • VERSION_GREATER_EQUAL
  • 路径比较
    • PATH_EQUAL

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant