Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,923
    • Issues 3,923
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #23207
Closed
Open
Created Feb 09, 2022 by Valentin Milea@vmilea

if: Documentation incorrectly implies AND binds before OR

The boolean operator AND should be evaluated before OR, but the following incorrectly prints "FALSE":

cmake_minimum_required(VERSION 3.22)

if(YES OR NO AND NO)
    message("TRUE")
else()
    message("FALSE") # branch taken
endif()

This bug doesn't occur when evaluating variables:

cmake_minimum_required(VERSION 3.22)

set (X YES)
set (Y NO)

if(X OR Y AND Y)
    message("TRUE") # branch taken
else()
    message("FALSE")
endif()
Edited Feb 09, 2022 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking