# Mlir-hlo repo cmake setup for dependent projects

**URL:** <https://discuss.ai.google.dev/t/mlir-hlo-repo-cmake-setup-for-dependent-projects/30349>\
**Category:** MLIR\
**Tags:** help\_request\
**Created:** [January 20, 2022, 10:22am UTC](https://discuss.ai.google.dev/t/mlir-hlo-repo-cmake-setup-for-dependent-projects/30349 "2022-01-20T10:22:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![uday](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/uday/32/9508_2.png) [@uday](https://discuss.ai.google.dev/u/uday)\
**Post date:** [January 20, 2022, 10:22am UTC](https://discuss.ai.google.dev/t/mlir-hlo-repo-cmake-setup-for-dependent-projects/30349/1 "2022-01-20T10:22:44Z")

</div>

This is a question related to projects that would like to depend on mlir-hlo and set it up as a submodule (while using a cmake setup).  
[https://github.com/tensorflow/mlir-hlo](https://github.com/tensorflow/mlir-hlo)

As far as I could tell, mlir-hlo doesn’t include something equivalent to `MLIRHLOConfig.cmake.in` that would allow a user project to find it and see all its targets. As a result, one approach would be to set it up with proper `target_link` options to point to the submodule’s build dir. This creates issues with transitive dependencies and rebuilding after updates. I haven’t tried the approaches of cmake external projects [ExternalProject — CMake 3.30.0 Documentation](https://cmake.org/cmake/help/latest/module/ExternalProject.html) or simply an `add_subdirectory`.

Is there a recommended setup for projects that would like to depend on mlir-hlo via a submodule? Would a contribution of Config.cmake be acceptable in the repo or does one already exist somewhere? Thanks!

---

<div class="post-metadata">

**Author:** ![Mehdi\_AMINI](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/mehdi_amini/32/8112_2.png) [@Mehdi\_AMINI](https://discuss.ai.google.dev/u/Mehdi_AMINI)\
**Post date:** [January 20, 2022, 10:34am UTC](https://discuss.ai.google.dev/t/mlir-hlo-repo-cmake-setup-for-dependent-projects/30349/2 "2022-01-20T10:34:05Z")

</div>

I don’t know about the solution here, but we’d take a patch 🙂

---

<div class="post-metadata">

**Author:** ![uday](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/uday/32/9508_2.png) [@uday](https://discuss.ai.google.dev/u/uday)\
**Post date:** [January 24, 2022, 7:24am UTC](https://discuss.ai.google.dev/t/mlir-hlo-repo-cmake-setup-for-dependent-projects/30349/4 "2022-01-24T07:24:26Z")

</div>

Here it is:  
[https://github.com/polymage-labs/mlir-hlo/pull/3](https://github.com/polymage-labs/mlir-hlo/pull/3)  
I can raise a PR on the official tensorflow repo.
