# cmake part

**URL:** https://discourse.cmake.org/t/cmake-part/1646
**Category:** Usage
**Created:** [July 30, 2020, 5:45pm UTC](https://discourse.cmake.org/t/cmake-part/1646 "2020-07-30T17:45:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Tomasz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tomasz/32/381_2.png) [@Tomasz](https://discourse.cmake.org/u/Tomasz)
#### Post date: [July 30, 2020, 5:45pm UTC](https://discourse.cmake.org/t/cmake-part/1646/1 "2020-07-30T17:45:37Z")

</div>

Hi  
I have a part of CMake code ( to generate documentation in doxygen )  
which I want to use in many not related each other projects. What is  
the best way to do this?

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [July 30, 2020, 5:48pm UTC](https://discourse.cmake.org/t/cmake-part/1646/2 "2020-07-30T17:48:54Z")

</div>

The best way is to separate the reusable code into a `.cmake` module file and put a copy of this file in each project.

However, CMake already has a [`FindDoxygen`](https://cmake.org/cmake/help/latest/module/FindDoxygen.html) module, which may already do what you want.

---

<div class="post-metadata">

### Author: ![Tomasz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tomasz/32/381_2.png) [@Tomasz](https://discourse.cmake.org/u/Tomasz)
#### Post date: [August 2, 2020, 6:00am UTC](https://discourse.cmake.org/t/cmake-part/1646/3 "2020-08-02T06:00:49Z")

</div>

Very thanks for Your answer. By the way I use Find Doxygen but setting up all variable for this module expands to dozen lines. I think using separate cmake file will be more readable.
