Sibbo
Sibbo

Reputation: 3914

Let CMake rescan a directory (Usage of GLOB_RECURSE)

When using GLOB_RECURSE to add a certain directory structure to a list, CMake doesn't detect if new files are added to the directory.

How can I make CMake rescan the directory structure on every run, so that new files are detected?

Upvotes: 1

Views: 412

Answers (1)

spraff
spraff

Reputation: 33395

You have to touch CMakeLists.txt whenever you change the directory contents.

What you're doing goes counter to official advice, but I do it too. You could knock up a script which monitors a directory for changes, but CMake considers this to be not its business.

The reason, I suspect, is that directory modification timestamp attributes aren't very cross-platform.

Upvotes: 2

Related Questions