-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
Globbing support in CMake:
file(GLOB SOURCES src/*.cpp )
add_executable(foo ${SOURCES})This results in two problems:
- When removing a .cpp file: Ninja fails because an input is missing.
- When adding a .cpp file: Linker error because of missing symbols. Or even worse, incremental build succeeds, but clean build would fail.
There's a workaround:
file(GLOB SOURCES CONFIGURE_DEPENDS src/*.cpp )
add_executable(foo ${SOURCES})But it's slow and causes other issues, e.g. #2507 and #2707.
I propose we implement a new attribute to the build manifest:
glob = src/*.cppNinja would then rerun that rule if glob changes. The result of the glob wouldn't be available.
Also I would suggest that we only support * and nothing else. Also we're always case-sensitive.
This simplifies the implementation.
Of course that makes the implementation not correct 100% of the time (at least with CMake), but currently it works 0% of the time. And perfect is the enemy is good.
If someone wanted to match CMake's exact behavior he could still use CONFIGURE_DEPENDS. Also I think that globbing is only used by pragmatists anyway ;)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels