Like some other developers, I need to copy external dependency DLLs to executable’s directory.
I’ve checked this topic. Unfortunately, suggested solution doesn’t fit that well
First of all, it lists all dependency DLLs, both project, thirdparty and system ones. Thus it requires additional filtering. Second, it takes considerable time due to multiple calls to dumpbin. Third, it doesn’t work as expected if libraries were already copied to runtime output directory.
My investigation shows that it’s virtually impossible to list whole dependency subtree. LINK_LIBRARIES property is properly populated (albeit with direct deps) only when generator expressions are expanded. Even if you get that list during file(GENERATE …), you won’t be able to enumerate even second level - because CMake context is not accessible at that point.
My best bet is to list all transitive deps subtree manually and use file(GENERATE) to manually copy all files.
Is there some proper way to list whole dependency subtree and work with it at generation time, like we work with normal variables?
IMO CMake requires more systematic way to tap into generation time. Generator expressions are “black box” in this regard. You can neither expand them at will nor properly process expansion results when they’re available.