The goal is to allow a project to directly include the CMakeLists.txt of mlir via something such as add_directory. This currently doesn't work because the exported targets then end up being imported in the same top-level project and cmake is not happy. LLVM works around this by guarding the exports based on the existence of the LLVMSupport library. This change does the same using MLIRSupport. In our experience, no targets need to be added to the export in the case.
If there's a preferred way of doing this or a better lib to use as the main target to check for, please let me know.
It would be useful to have a comment here along the lines of your commit title.