Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,227
    • Issues 3,227
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 12
    • Merge Requests 12
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #19895

Closed
Open
Opened Oct 30, 2019 by slonm@slonm

Regex AND support

Operation AND on Perl regex could be expressed as:

perl -e "q{some stuff and things} =~ /(?=some)(?=stuff)(?=things)/ ? print 'yes' : print 'no'" prints 'no'

(See https://stackoverflow.com/questions/469913/regular-expressions-is-there-an-and-operator for more details)

Looks this syntax is not supported by Cmake. This example:

if(CMAKE_BUILD_TYPE MATCHES (?=x86_64)(?=linux))
#do stuff
endif()

Give error on compilation:

CMake Error at configurations.cmake:137 (if):                             
  if given arguments:                                                     
                                                                          
    "CMAKE_BUILD_TYPE" "MATCHES" "(" "?=x86_64" ")" "(" "?=linux" ")"
                                                                          
  Unknown arguments specified                                             

And now i see only way for AND:

if(CMAKE_BUILD_TYPE MATCHES x86_64 AND CMAKE_BUILD_TYPE MATCHES linux)
#do stuff
endif()

It looks bad on two AND operands and will looks ugly on more operands

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: cmake/cmake#19895