# CMake Error at CMakeLists.txt:333 error

**URL:** https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484
**Category:** Usage
**Created:** [January 13, 2020, 9:20am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484 "2020-01-13T09:20:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![rickenator](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@rickenator](https://discourse.cmake.org/u/rickenator)
#### Post date: [January 13, 2020, 9:20am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484/1 "2020-01-13T09:20:12Z")

</div>

At the end of my rope. Trying to compile CMB-superbuild using their instructions at [https://gitlab.kitware.com/cmb/cmb-superbuild/blob/master/README.md](https://gitlab.kitware.com/cmb/cmb-superbuild/blob/master/README.md)

I’m having this error:  
CMake Error at CMakeLists.txt:333 (add\_subdirectory):  
add\_subdirectory given source “superbuild” which is not an existing  
directory.

No clue what to do.  
Any suggestions?  
Thanks!

---

<div class="post-metadata">

### Author: ![Florian\_Chevassu](https://discourse.cmake.org/user_avatar/discourse.cmake.org/florian_chevassu/32/99_2.png) [@Florian\_Chevassu](https://discourse.cmake.org/u/Florian_Chevassu)
#### Post date: [January 13, 2020, 9:24am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484/2 "2020-01-13T09:24:00Z")

</div>

Hi Rick,

The `superbuild` folder is in the git submodule. You may have forgotten to run the `git submodule update --init` command ?

Florian

---

<div class="post-metadata">

### Author: ![rickenator](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@rickenator](https://discourse.cmake.org/u/rickenator)
#### Post date: [January 13, 2020, 9:57am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484/3 "2020-01-13T09:57:41Z")

</div>

Thank you for helping, I think running the above command helped, except of course I got new errors.

using cmake-gui I got “Error in configuration process, project files may be invalid” and also the same:  
CMake Error at CMakeLists.txt:333 (add\_subdirectory):  
add\_subdirectory given source “superbuild” which is not an existing  
directory.

using cmake command line I got:  
CMake Error at superbuild/cmake/SuperbuildMacros.cmake:436 (message):  
The build tree appears to be inside of the git repository located at  
/home/cmbgit/cmb-superbuild. This interferes with the way the superbuild  
applies patches to projects and is not supported. Please relocate the  
build tree to a directory which is not under a git repository.

I think I’m getting there…

Thanks again!

---

<div class="post-metadata">

### Author: ![Florian\_Chevassu](https://discourse.cmake.org/user_avatar/discourse.cmake.org/florian_chevassu/32/99_2.png) [@Florian\_Chevassu](https://discourse.cmake.org/u/Florian_Chevassu)
#### Post date: [January 13, 2020, 10:05am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484/4 "2020-01-13T10:05:14Z")

</div>

CMB does not support _in-source builds_, meaning that you cannot build CMB in the same folder as its sources.

You should have different directories: One for the CMB sources, and one where CMake will generate the project files. For example:

- /home/cmbgit/cmb-superbuild for the sources comming from git
- /home/cmbgit/cmb-superbuild-build for the build directory.

As you have generated the build files _in_ your source directory, I advise you to restart the process from the beginning, and remove everything from /home/cmbgit/cmb-superbuild.

Florian

---

<div class="post-metadata">

### Author: ![rickenator](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@rickenator](https://discourse.cmake.org/u/rickenator)
#### Post date: [January 13, 2020, 10:07am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484/5 "2020-01-13T10:07:36Z")

</div>

Ok, Looks like I’m starting over again. I will have to do it tomorrow. Thank you! I very much appreciate it.

---

<div class="post-metadata">

### Author: ![rickenator](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@rickenator](https://discourse.cmake.org/u/rickenator)
#### Post date: [January 14, 2020, 1:45am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484/6 "2020-01-14T01:45:06Z")

</div>

Ok, I started over again and things worked out well in that I uninstalled everything and reinstalled all repository files the right way. Then using cmake-gui I was able to configure and generate without any errors.

Now…

I have no idea how to actually start the program. Cannot find any documentation or an executable which explains this. The last listed steps in the README.md says

Building a CMB Installable Package

- cd into the build directory
- run ctest -R cpack

Which I did and got the error:  
Start 1: cpack-modelbuilder-TGZ  
1/1 Test #1: cpack-modelbuilder-TGZ …\*\*\*Failed 0.03 s

Wow, where do I go from here??  
How do I run CMB?

---

<div class="post-metadata">

### Author: ![Florian\_Chevassu](https://discourse.cmake.org/user_avatar/discourse.cmake.org/florian_chevassu/32/99_2.png) [@Florian\_Chevassu](https://discourse.cmake.org/u/Florian_Chevassu)
#### Post date: [January 14, 2020, 8:23am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-333-error/484/7 "2020-01-14T08:23:59Z")

</div>

Hi Rick,

Now that everything CMake related has been fixed, I suggest that you ask the CMB related questions on the [CMB discourse](https://discourse.kitware.com/c/cmb).

Florian
