# cmake SupperBuild how to include source file for local project

**URL:** https://discourse.cmake.org/t/cmake-supperbuild-how-to-include-source-file-for-local-project/9939
**Category:** Usage
**Created:** [January 26, 2024, 1:08am UTC](https://discourse.cmake.org/t/cmake-supperbuild-how-to-include-source-file-for-local-project/9939 "2024-01-26T01:08:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![BlackCat\_Ruelle](https://discourse.cmake.org/user_avatar/discourse.cmake.org/blackcat_ruelle/32/3214_2.png) [@BlackCat\_Ruelle](https://discourse.cmake.org/u/BlackCat_Ruelle)
#### Post date: [January 26, 2024, 1:08am UTC](https://discourse.cmake.org/t/cmake-supperbuild-how-to-include-source-file-for-local-project/9939/1 "2024-01-26T01:08:40Z")

</div>

Hi,  
I use the ExternalPorject\_Add to added external dependencies to my local projects. Specifically, I use EExternalPrject\_Add to add my local projects such that my projects’ external dependencies can be build properly. Here is the example of my local project:

ExternalProject\_Add(my\_example  
DEPENDS  
VTK\_external  
SOURCE\_DIR  
${CMAKE\_CURRENT\_LIST\_DIR}/my\_example  
CMAKE\_ARGS  
-DVTK\_DIR = ${VTK\_DIR}  
CMAKE\_CACHE\_ARGS  
-DCMAKE\_PREFIX\_PATH:PATH=${CMAKE\_PREFIX\_PATH}  
BUILD\_ALWAYS  
1  
INSTALL\_COMMAND  
“”  
)

Here my project depends on VTK external project. In the generated solution files for visual studio I only see the CMakeLists.txt but not the actual C++ source files. How can I include the source files so that I can debug my project in Visual Studio?

Thanks,  
BC

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 26, 2024, 2:14pm UTC](https://discourse.cmake.org/t/cmake-supperbuild-how-to-include-source-file-for-local-project/9939/2 "2024-01-26T14:14:52Z")

</div>

That project lives inside of a separate CMake generation step. Something like `my_example-prefix/src/build` or the like in the build tree.

---

<div class="post-metadata">

### Author: ![BlackCat\_Ruelle](https://discourse.cmake.org/user_avatar/discourse.cmake.org/blackcat_ruelle/32/3214_2.png) [@BlackCat\_Ruelle](https://discourse.cmake.org/u/BlackCat_Ruelle)
#### Post date: [January 26, 2024, 2:49pm UTC](https://discourse.cmake.org/t/cmake-supperbuild-how-to-include-source-file-for-local-project/9939/3 "2024-01-26T14:49:10Z")

</div>

Thanks for the reply, but I am quite new to cmake. I don’t quite understand what you mean. Could you give a simple example?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 26, 2024, 5:34pm UTC](https://discourse.cmake.org/t/cmake-supperbuild-how-to-include-source-file-for-local-project/9939/4 "2024-01-26T17:34:41Z")

</div>

`ExternalProject` sets up a source/build directory in the top-level build directory (though providing the source directory like you do will skip the source bit). Looking for the `CMakeCache.txt` file related to `my_example` in the build tree will help you find the project that needs loaded in Visual Studio.
