CMake Error at CMakeLists.txt:333 error

At the end of my rope. Trying to compile CMB-superbuild using their instructions at

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

No clue what to do.
Any suggestions?

Hi Rick,

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


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

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!

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.


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

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.


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 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?

Hi Rick,

Now that everything CMake related has been fixed, I suggest that you ask the CMB related questions on the CMB discourse.