Skip to content

file(GLOB ...): add support for extended glob syntax

API to which I'm refering to: https://cmake.org/cmake/help/latest/command/file.html#glob CMake 3.20.3

Given directory tree:

/nanopb/generator
|-- __pycache__
|   `-- nanopb_generator.cpython-39.pyc
|-- nanopb_generator.py
|-- nanopb_generator.py2
|-- proto
|   |-- __init__.py
|   |-- __pycache__
|   |   |-- __init__.cpython-39.pyc
|   |   |-- _utils.cpython-39.pyc
|   |   `-- nanopb_pb2.cpython-39.pyc
|   |-- _utils.py
|   |-- google
|   |   `-- protobuf
|   |       `-- descriptor.proto
|   |-- nanopb.proto
|   `-- nanopb_pb2.py
|-- protoc
|-- protoc-gen-nanopb
|-- protoc-gen-nanopb-py2
|-- protoc-gen-nanopb.bat
`-- protoc.bat

Given CMake code:

file(GLOB files_list LIST_DIRECTORIES false /nanopb/generator/!(.bat))

I expect to have in my files_list every file except those with .bat extension. However it's not the case, as files_list is empty after calling this line. If I modify glob expression to /nanopb/generator/* then it lists all files properly.

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information