# Unable to change 'Source Code Directory' for wxWidgets-3.1.15 installation

**URL:** https://discourse.cmake.org/t/unable-to-change-source-code-directory-for-wxwidgets-3-1-15-installation/3791
**Category:** Usage
**Created:** [July 20, 2021, 5:51pm UTC](https://discourse.cmake.org/t/unable-to-change-source-code-directory-for-wxwidgets-3-1-15-installation/3791 "2021-07-20T17:51:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jim\_Kucera](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@Jim\_Kucera](https://discourse.cmake.org/u/Jim_Kucera)
#### Post date: [July 20, 2021, 5:51pm UTC](https://discourse.cmake.org/t/unable-to-change-source-code-directory-for-wxwidgets-3-1-15-installation/3791/1 "2021-07-20T17:51:44Z")

</div>

Hello,

My 1st attempt at a **wxWidgets-3.1.15 installation** failed using source directory ‘demo’. On 2nd attempt I extracted wxWidget-3.1.5 to directory ‘wxWidgets-3.1.15’.

When I reran CMake, it thinks the source is located in the previous installation directory (demo). I changed the source directory to the NEW directory, but it’s still pointing at the old source directory which no longer exists. **How do I remove the old directory from CMake files?**

 ![acpdcegmedlcpabo.png](https://discourse.cmake.org/uploads/default/original/2X/1/10ef6c5d4f4ca3005087d095d1a0f11166f52dad.png)

CMake Error: The source “C:/Users/Jim/wxWidgets-3.1.5/CMakeLists.txt” does not match the source “C:/Users/Jim/demo/CMakeLists.txt” used to generate cache. Re-run cmake with a different source directory.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [July 20, 2021, 9:03pm UTC](https://discourse.cmake.org/t/unable-to-change-source-code-directory-for-wxwidgets-3-1-15-installation/3791/2 "2021-07-20T21:03:46Z")

</div>

If you need to change the source directory, delete the contents of the build directory as well (technically, you only need to delete the `CMakeCache.txt` file from the build directory). CMake caches the location of the source directory and doesn’t allow you to change it, as you’ve discovered.

---

<div class="post-metadata">

### Author: ![Jim\_Kucera](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@Jim\_Kucera](https://discourse.cmake.org/u/Jim_Kucera)
#### Post date: [July 21, 2021, 12:00am UTC](https://discourse.cmake.org/t/unable-to-change-source-code-directory-for-wxwidgets-3-1-15-installation/3791/3 "2021-07-21T00:00:34Z")

</div>

Thanks, Craig!

---

<div class="post-metadata">

### Author: ![Devanshi\_Arora](https://discourse.cmake.org/user_avatar/discourse.cmake.org/devanshi_arora/32/3296_2.png) [@Devanshi\_Arora](https://discourse.cmake.org/u/Devanshi_Arora)
#### Post date: [March 30, 2023, 9:57am UTC](https://discourse.cmake.org/t/unable-to-change-source-code-directory-for-wxwidgets-3-1-15-installation/3791/4 "2023-03-30T09:57:22Z")

</div>

The current CMakeCache.txt directory /Users/devanshiarora/downloads/ChromaticCalorimetry/spacal-simulation/build/CMakeCache.txt is different than the directory /home/spacal/Documents/LHCb/simulations/ChromaticCalorimetry/spacal-simulation/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt

CMake Error: The source “/Users/devanshiarora/downloads/ChromaticCalorimetry/spacal-simulation/CMakeLists.txt” does not match the source “/home/spacal/Documents/LHCb/simulations/ChromaticCalorimetry/spacal-simulation/CMakeLists.txt” used to generate cache. Re-run cmake with a different source directory.

Last command “cmake $CMAKE\_ARGS …/” returned with exit code 1.

I got this error, how to move from this?
