# Using cmake to make an executable in LAMMPS

**URL:** https://discourse.cmake.org/t/using-cmake-to-make-an-executable-in-lammps/2836
**Category:** Usage
**Created:** [February 24, 2021, 8:13pm UTC](https://discourse.cmake.org/t/using-cmake-to-make-an-executable-in-lammps/2836 "2021-02-24T20:13:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ognjano3](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@ognjano3](https://discourse.cmake.org/u/ognjano3)
#### Post date: [February 24, 2021, 8:13pm UTC](https://discourse.cmake.org/t/using-cmake-to-make-an-executable-in-lammps/2836/1 "2021-02-24T20:13:28Z")

</div>

I need to download this package in order to make an executable on lammps but I keep getting this error.

 ![image](https://discourse.cmake.org/uploads/default/original/2X/7/7fb614cd6fd0eaa1b23788b58e1b654eb93541e7.png)

---

<div class="post-metadata">

### Author: ![erk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/erk/32/114_2.png) [@erk](https://discourse.cmake.org/u/erk)
#### Post date: [February 24, 2021, 8:58pm UTC](https://discourse.cmake.org/t/using-cmake-to-make-an-executable-in-lammps/2836/2 "2021-02-24T20:58:59Z")

</div>

You probably run cmake in-source once, so the source tree gets polluted with CMake generated file which prevent from running out-of-source properly afterwards.

Can you:

1. remove the build dir
2. clean-up the source tree
3. create a pristine build dir and cd into it
4. run cmake as shown from the freshly created build dir

Do you confirm the LAMMPS you are refering to is: [GitHub - lammps/lammps: Public development project of the LAMMPS MD software package](https://github.com/lammps/lammps)

---

<div class="post-metadata">

### Author: ![ognjano3](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@ognjano3](https://discourse.cmake.org/u/ognjano3)
#### Post date: [February 25, 2021, 6:35pm UTC](https://discourse.cmake.org/t/using-cmake-to-make-an-executable-in-lammps/2836/3 "2021-02-25T18:35:05Z")

</div>

The lammps I am using is the one you referred to, I am new to all of this and would greatly appreciate if you could explain what it means to clean-up the source tree and how to do it.

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [February 26, 2021, 9:44am UTC](https://discourse.cmake.org/t/using-cmake-to-make-an-executable-in-lammps/2836/4 "2021-02-26T09:44:52Z")

</div>

> [@ognjano3](#):
>
> if you could explain what it means to clean-up the source tree and how to do it.

The error message you posted actually contains all the information. Quoting it:

> To clean up after this aborted in-place compilation: rm -r CMakeCache.txt CMakeFiles
