# Build extension that depends on other extensions

**URL:** <https://discourse.slicer.org/t/build-extension-that-depends-on-other-extensions/37089>\
**Category:** Development\
**Created:** [June 28, 2024, 4:52pm UTC](https://discourse.slicer.org/t/build-extension-that-depends-on-other-extensions/37089 "2024-06-28T16:52:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [June 28, 2024, 4:52pm UTC](https://discourse.slicer.org/t/build-extension-that-depends-on-other-extensions/37089/1 "2024-06-28T16:52:43Z")

</div>

While the build documentation of Slicer is complete, I found it hard to build an extension that depends on other extensions and I had to come up on how to do it myself. So here is my code for that:

> <https://gist.github.com/mauigna06/4cb485da9358a6b58d6ecfc91c1b78cc>

I still don’t know to use the alternative SuperBuild method to do this but I’d like to learn about it because I think it should be simpler

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [June 28, 2024, 5:55pm UTC](https://discourse.slicer.org/t/build-extension-that-depends-on-other-extensions/37089/2 "2024-06-28T17:55:33Z")

</div>

This won’t solve your problem.

Slicer’s CMakeLists.txt has these lines:

```auto
# Directories can be set in three ways:
#
# (1) Automatically by specifying the label 'REMOTE_MODULE' when
# calling 'Slicer_Remote_Add' from SuperBuild.cmake.
#
# (2) Automatically by specifying the label 'REMOTE_EXTENSION' when
# calling 'Slicer_Remote_Add' from SuperBuild.cmake.
#
# (3) Explicitly by configuring the project using the following syntax:
# cmake -DSlicer_EXTENSION_SOURCE_DIRS:STRING=/path/to/ExtensionA;/path/to/ExtensionB /path/to/source/Slicer

```

I understand that #3 is what you would need. It could be as simple as adding the Slicer\_EXTENSION\_SOURCE\_DIRS variable to your command line that configures Slicer. But the " /path/to/source/Slicer" part is confusing. It’s doubtful that it refers to an executable, and it’s not in the form of a ‘-D’ cmake parameter.

Never tried that, just discovered that Slicer can build extensions and modules while being built itself.

Your method is mine also: build everything separately.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [June 28, 2024, 6:36pm UTC](https://discourse.slicer.org/t/build-extension-that-depends-on-other-extensions/37089/3 "2024-06-28T18:36:13Z")

</div>

> [@chir.set](#):
>
> But the " /path/to/source/Slicer" part is confusing.

Shame on me, it’s just the path to Slicer sources 🤔 🤪
