JonasToth added a comment. In D55595#1328154 <https://reviews.llvm.org/D55595#1328154>, @steveire wrote:
> FYI, CMake target property `INTERFACE_SOURCES` is designed to make this easy. > > For each module you would generate a file containing > > extern volatile int ${MODULE_NAME}ModuleAnchorSource; > static int LLVM_ATTRIBUTE_UNUSED ${MODULE_NAME}ModuleAnchorDestination = > ${MODULE_NAME}ModuleAnchorSource; > > > and then put that generated file in the `INTERFACE_SOURCES` of each module. > > target_sources(${MODULE_NAME} INTERFACE ${THE_GENERATED_FILE}.cpp) > > > Then, you don't need to maintain it in C++ like this. It is DRY because the > `target_link_libraries` entry for the library is what causes the symbol to be > used. That sounds like a better solution, but i think the current pattern is common in LLVM, maybe @aaron.ballman or @alexfh could share their opinion on this one? Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55595/new/ https://reviews.llvm.org/D55595 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits