# Packaging SlicerVMTK extension with custom Slicer build

**URL:** <https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639>\
**Category:** Development\
**Tags:** build, extensions-manager\
**Created:** [August 2, 2018, 7:49pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639 "2018-08-02T19:49:52Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 18, 2018, 7:07am UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/21 "2018-08-18T07:07:46Z")

</div>

Slicer build process automatically finds ExternalX.cmake files to build dependencies and rely on their correct implementation to find potential additional dependencies, build, and install them.

SlicerIGT, SlicerOpenIGTLink, and SlicerVirtualReality extensions are all superbuild extensions that are tested to work well when used in a custom Slicer application. Test if they work correctly for you and if they do then compare what is different in VMTK.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 18, 2018, 1:59pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/22 "2018-08-18T13:59:46Z")

</div>

Thanks, I’ll try those ones.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 30, 2018, 3:20pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/23 "2018-08-30T15:20:51Z")

</div>

I’m still trying to identify differences between the CMake scripts for SlicerOpenIGTLink and SlicerVMTK, but looking at the CDash results for the three extensions you suggested, I see that [SlicerVirtualReality](http://slicer.cdash.org/index.php?project=SlicerPreview&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=SlicerVirtualReality) is not able to build for Mac, and the build error relates to finding an include file from its external package OpenVR. I’m not sure if this is related, but [SlicerVirtualReality](http://slicer.cdash.org/index.php?project=SlicerPreview&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=SlicerVirtualReality), [SlicerVMTK](http://slicer.cdash.org/index.php?project=SlicerPreview&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=SlicerVMTK), and [SlicerElastix](http://slicer.cdash.org/index.php?project=SlicerPreview&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=SlicerElastix) are all failing to build on Mac, and Mac only. I may start a separate thread about this.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 30, 2018, 4:26pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/24 "2018-08-30T16:26:41Z")

</div>

First you need to make sure that the extension builds without problems when it is built standalone. Once it works, you can try to build it as part of a custom Slicer application. There may be additional complications in superbuild extensions, because if the extension is built as part of Slicer then Slicer’s build system must build and package all the third-party libraries that the extension depends on.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 30, 2018, 5:44pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/25 "2018-08-30T17:44:36Z")

</div>

> [@lassoan](#):
>
> First you need to make sure that the extension builds without problems when it is built standalone. Once it works, you can try to build it as part of a custom Slicer application.

Absolutely. I just re-tested the up-to-date extension and VMTK, with the most recent Slicer’s VTK and ITK, and it is able to build on its own. The problem is when I try to include it in a custom application, either by referencing the pre-downloaded extension source directory, or using the FetchContent\_Populate macro to fetch the source.

> [@lassoan](#):
>
> There may be additional complications in superbuild extensions, because if the extension is built as part of Slicer then Slicer’s build system must build and package all the third-party libraries that the extension depends on.

The SuperBuild seems able to recognize the dependence on VMTK and build it, then it puts the shared object libraries from VMTK in the main SuperBuild directory, but then when running the ExternalProject\_Include\_Dependencies macro when building Slicer itself, it can’t find External\_VMTK.cmake.  
Other than that, I ran into a minor issue when doing a completely fresh build because VMTK’s dependence on ITK and VTK wasn’t specified, but that was a quick fix.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 31, 2018, 5:07am UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/26 "2018-08-31T05:07:03Z")

</div>

The extension must store External\_(dependency).cmake files in SuperBuild subfolder.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 31, 2018, 3:17pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/27 "2018-08-31T15:17:07Z")

</div>

> [@lassoan](#):
>
> The extension must store External\_(dependency).cmake files in SuperBuild subfolder.

That’s the confusing thing - it does. The file is in SlicerExtension-VMTK/SuperBuild, but the ExternalProject\_Include\_Dependencies macro doesn’t check there when building Slicer. If I print out where it tries to access the file when building Slicer, it tries:

- ~/app-SuperBuild/slicersources-src/SuperBuild/External\_VMTK.cmake
- (blank)
- /External\_VMTK.cmake
- a foreach statement that’s not entered

The last two are supposed to use values from EXTERNAL\_PROJECT\_ADDITIONAL\_DIR and a list called EXTERNAL\_PROJECT\_ADDITIONAL\_DIRS, but they are blank.  
The relevant code is here: [https://github.com/Slicer/Slicer/blob/master/CMake/ExternalProjectDependency.cmake#L858](https://github.com/Slicer/Slicer/blob/master/CMake/ExternalProjectDependency.cmake#L858)  
For some reason, the values of EXTERNAL\_PROJECT\_ADDITIONAL\_DIR and the EXTERNAL\_PROJECT\_ADDITIONAL\_DIRS list aren’t being set, or are being cleared? At the Configure stage for the superbuild, these values are present, though.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 31, 2018, 5:50pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/28 "2018-08-31T17:50:54Z")

</div>

Try to add SlicerOpenIGTLink extension to your project, too, and see if there is any difference between where OpenIGTLink library shows up and VMTK library shows up. We would then have a better idea where the problem might be.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 31, 2018, 8:44pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/29 "2018-08-31T20:44:34Z")

</div>

I’m having trouble getting SlicerOpenIGTLink to compile, but it’s a different problem, and I can’t tell if it’s getting past the place where SlicerExtension-VMTK stops. Here’s the error:

> [97%] **Performing configure step for ‘Slicer’**  
> …  
> – Configuring extension directory: SlicerOpenIGTLink  
> – Checking EXTENSION\_NAME variable  
> – Checking EXTENSION\_NAME variable - NOTDEFINED  
> – Checking MODULE\_NAME variable  
> – Checking MODULE\_NAME variable - NOTDEFINED  
> – Checking PROJECT\_NAME variable  
> – Checking PROJECT\_NAME variable - SlicerOpenIGTLink  
> – Setting EXTENSION\_NAME …: SlicerOpenIGTLink  
> – Checking EXTENSION\_NAME variable  
> – Checking EXTENSION\_NAME variable - SlicerOpenIGTLink  
> – Looking for decorator header qSlicerOpenIGTLinkIFModuleWidgetsPythonQtDecorators.h
> 
> – Looking for decorator header qSlicerOpenIGTLinkIFModuleWidgetsPythonQtDecorators.h - Not found
> 
> – Configuring Loadable module: OpenIGTLinkIF [qSlicerOpenIGTLinkIFModuleExport.h]
> 
> CMake Error at /short/pack/PADPlanner-SB/SlicerOpenIGTLink/OpenIGTLinkIF/Testing/CMakeLists.txt:29 (list):  
> list sub-command INSERT requires at least three arguments.

I’m still not certain about what’s happening, but something that may be interesting is that with OpenIGTLink, I don’t see the message output lines that I added to ExternalProjectDependency.cmake in the build output. In both cases, I see them in the Configure stage in the CMake GUI, but with SlicerExtension-VMTK, I see them again in the Slicer build configuration phase. It makes me think that OpenIGTLink doesn’t re-run the macro during the build.

Here’s the build output leading up to the error when I try adding SlicerExtension-VMTK to Slicer. The four lines after “SuperBuild - First pass” are my additions.

> [97%] **Performing configure step for ‘Slicer’**  
> …  
> – Configuring extension directory: SlicerExtension-VMTK  
> CMake Warning (dev) at /short/pack/PADPlanner-SB/SlicerExtension-VMTK/CMakeLists.txt:4 (project):  
> Policy CMP0048 is not set: project() command manages VERSION variables.  
> Run “cmake --help-policy CMP0048” for policy details. Use the cmake\_policy  
> command to set the policy and suppress this warning.
> 
> The following variable(s) would be set to empty:
> 
> ```
> PROJECT_VERSION
> PROJECT_VERSION_MAJOR
> PROJECT_VERSION_MINOR
> PROJECT_VERSION_PATCH
> 
> ```
> 
> This warning is for project developers. Use -Wno-dev to suppress it.
> 
> – Checking EXTENSION\_NAME variable  
> – Checking EXTENSION\_NAME variable - NOTDEFINED  
> – Checking MODULE\_NAME variable  
> – Checking MODULE\_NAME variable - NOTDEFINED  
> – Checking PROJECT\_NAME variable  
> – Checking PROJECT\_NAME variable - SlicerVMTK  
> – Setting EXTENSION\_NAME …: SlicerVMTK  
> – SuperBuild - First pass  
> EXTERNAL\_PROJECT\_DIR location is /short/pack/PADPlanner-SB/slicersources-src/SuperBuild/External\_VMTK.cmake  
> dep\_FILEPATH location is  
> EXTERNAL\_PROJECT\_ADDITIONAL\_DIR location is /External\_VMTK.cmake  
> This is the whole EXTERNAL\_PROJECT\_ADDITIONAL\_DIRS list:  
> CMake Error at /short/pack/PADPlanner-SB/slicersources-src/CMake/ExternalProjectDependency.cmake:862 (message):  
> Can’t find External\_VMTK.cmake  
> Call Stack (most recent call first):  
> /short/pack/PADPlanner-SB/SlicerExtension-VMTK/SuperBuild.cmake:32 (ExternalProject\_Include\_Dependencies)  
> /short/pack/PADPlanner-SB/SlicerExtension-VMTK/CMakeLists.txt:33 (include)
> 
> -- Configuring incomplete, errors occurred!  
> See also “/short/pack/PADPlanner-SB/Slicer-build/CMakeFiles/CMakeOutput.log”.  
> See also “/short/pack/PADPlanner-SB/Slicer-build/CMakeFiles/CMakeError.log”.  
> make[2]: \*\*\* [slicersources-build/Slicer-prefix/src/Slicer-stamp/Slicer-configure] Error 1  
> make[1]: \*\*\* [slicersources-build/CMakeFiles/Slicer.dir/all] Error 2  
> make: \*\*\* [all] Error 2

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 31, 2018, 9:29pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/30 "2018-08-31T21:29:49Z")

</div>

Actually, I tried commenting out the line OpenIGTLink was failing on, the list sub-command, and the configuration carries on, and completes, without writing the messages I added to ExternalProjectDependency.cmake. Here’s the new extension configuration output for OpenIGTLink:

> – Configuring extension directory: SlicerOpenIGTLink  
> – Checking EXTENSION\_NAME variable  
> – Checking EXTENSION\_NAME variable - NOTDEFINED  
> – Checking MODULE\_NAME variable  
> – Checking MODULE\_NAME variable - NOTDEFINED  
> – Checking PROJECT\_NAME variable  
> – Checking PROJECT\_NAME variable - SlicerOpenIGTLink  
> – Setting EXTENSION\_NAME …: SlicerOpenIGTLink  
> – Checking EXTENSION\_NAME variable  
> – Checking EXTENSION\_NAME variable - SlicerOpenIGTLink  
> – Looking for decorator header qSlicerOpenIGTLinkIFModuleWidgetsPythonQtDecorators.h  
> – Looking for decorator header qSlicerOpenIGTLinkIFModuleWidgetsPythonQtDecorators.h - Not found  
> – Configuring Loadable module: OpenIGTLinkIF [qSlicerOpenIGTLinkIFModuleExport.h]  
> – Looking for decorator header qSlicerOpenIGTLinkRemoteModuleWidgetsPythonQtDecorators.h  
> – Looking for decorator header qSlicerOpenIGTLinkRemoteModuleWidgetsPythonQtDecorators.h - Not found  
> – Configuring Loadable module: OpenIGTLinkRemote [qSlicerOpenIGTLinkRemoteModuleExport.h]  
> – Looking for decorator header qSlicerPlusRemoteModuleWidgetsPythonQtDecorators.h  
> – Looking for decorator header qSlicerPlusRemoteModuleWidgetsPythonQtDecorators.h - Not found  
> – Configuring Loadable module: PlusRemote [qSlicerPlusRemoteModuleExport.h]  
> – Looking for decorator header qSlicerUltrasoundRemoteControlModuleWidgetsPythonQtDecorators.h  
> – Looking for decorator header qSlicerUltrasoundRemoteControlModuleWidgetsPythonQtDecorators.h - Not found  
> – Configuring Scripted module: UltrasoundRemoteControl  
> – Skipping extension packaging: SlicerOpenIGTLink - Slicer\_SOURCE\_DIR is defined.  
> CMake Warning at Utilities/Scripts/SlicerWizard/doc/CMakeLists.txt:41 (message):  
> Warning: sphinx-build not found: Python documentation will not be created
> 
> – Setting ‘CTEST\_MODEL’ variable with default value ‘Experimental’  
> – Setting ‘MIDAS\_PACKAGE\_URL’ variable with default value ‘[http://slicer.kitware.com/midas3](http://slicer.kitware.com/midas3)’  
> – Setting ‘MIDAS\_PACKAGE\_EMAIL’ variable with default value ‘OBFUSCATED’  
> – Setting ‘MIDAS\_PACKAGE\_API\_KEY’ variable with default value ‘OBFUSCATED’  
> – Setting CPACK\_PACKAGE\_NAME to ‘PADPlanner’  
> – Setting CPACK\_PACKAGE\_VENDOR to ‘Sunnybrook Research Institute’  
> – Setting CPACK\_PACKAGE\_VERSION\_MAJOR to ‘4’  
> – Setting CPACK\_PACKAGE\_VERSION\_MINOR to ‘9’  
> – Setting CPACK\_PACKAGE\_VERSION\_PATCH to ‘0’  
> – Setting CPACK\_PACKAGE\_VERSION to ‘4.9.0-2018-08-28’  
> – Setting CPACK\_PACKAGE\_INSTALL\_DIRECTORY to ‘PADPlanner 4.9.0-2018-08-28’  
> – Setting CPACK\_PACKAGE\_DESCRIPTION\_FILE to ‘/short/pack/PADPlanner-SB/slicersources-src/README.txt’  
> – Setting CPACK\_RESOURCE\_FILE\_LICENSE to ‘/short/pack/PADPlanner-SB/slicersources-src/License.txt’  
> – Setting CPACK\_PACKAGE\_DESCRIPTION\_SUMMARY to ‘Surgical planning tool for Peripheral Artery Disease’  
> – Setting CPACK\_PACKAGE\_ICON to ‘/Users/michaelschumaker/Development/mschumaker/Slicelets/PADFusion/CustomAppTemplateConfig/PADPlanner/Applications/PADPlannerApp/Resources/App.icns’  
> – Configuring done  
> – Generating done  
> – Build files have been written to: /short/pack/PADPlanner-SB/Slicer-build  
> [98%] **Performing build step for ‘Slicer’**

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 31, 2018, 9:47pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/31 "2018-08-31T21:47:02Z")

</div>

> [@mschumaker](#):
>
> – Configuring Loadable module: OpenIGTLinkIF [qSlicerOpenIGTLinkIFModuleExport.h]
> 
> CMake Error at /short/pack/PADPlanner-SB/SlicerOpenIGTLink/OpenIGTLinkIF/Testing/CMakeLists.txt:29 (list):  
> list sub-command INSERT requires at least three arguments.

We tried the bundling of `SlicerOpenIGTLink` with `BUILD_TESTING` set to `OFF`, this explain why you see this error. In the following bloc:

> <https://github.com/openigtlink/SlicerOpenIGTLink/blob/17ef646fe711ac7db9c48388218ee18eaf0839f5/OpenIGTLinkIF/Testing/CMakeLists.txt#L27-L29>

The fix is most likely to change it if with:

```auto
# Add '--launcher-additional-settings' to launch command unless it is bundled in Slicer
if(NOT DEFINED Slicer_SOURCE_DIR)
  list(FIND Slicer_LAUNCH_COMMAND "--launch" launch_index)
  list(INSERT Slicer_LAUNCH_COMMAND ${launch_index} ${Slicer_ADDITIONAL_LAUNCHER_SETTINGS}) 
endif()

```

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 31, 2018, 9:52pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/32 "2018-08-31T21:52:18Z")

</div>

Thanks, that makes sense. With those lines omitted, it’s able to carry on past the configuration stage.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 31, 2018, 9:55pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/33 "2018-08-31T21:55:48Z")

</div>

Now the bundling of the SlicerVMTK should be done doing something like this:

```auto
# SlicerVMTK
set(extension_name "SlicerVMTK")
set(${extension_name}_SOURCE_DIR "${CMAKE_BINARY_DIR}/${extension_name}")
FetchContent_Populate(${extension_name}
  SOURCE_DIR ${${extension_name}_SOURCE_DIR}
  GIT_REPOSITORY ${EP_GIT_PROTOCOL}://github.com/vmtk/SlicerExtension-VMTK.git
  GIT_TAG c5dd07e2df6834342035cbdb1e0c461b452009d4
  GIT_PROGRESS 1
  QUIET
  )
list(APPEND Slicer_EXTENSION_SOURCE_DIRS ${${extension_name}_SOURCE_DIR})

```

Few things would have to be updated in the extension:

- The [block dealing with CPack](https://github.com/vmtk/SlicerExtension-VMTK/blob/c5dd07e2df6834342035cbdb1e0c461b452009d4/CMakeLists.txt#L42-L49) need to be updated. For an example, see [https://github.com/openigtlink/SlicerOpenIGTLink/commit/da0bc5ce5c9a528da4f0a734c4bd099e579492d0](https://github.com/openigtlink/SlicerOpenIGTLink/commit/da0bc5ce5c9a528da4f0a734c4bd099e579492d0)

- Instead of checking out `master` of VMTK, it should be changed to specific commit. See [here](https://github.com/vmtk/SlicerExtension-VMTK/blob/c5dd07e2df6834342035cbdb1e0c461b452009d4/SuperBuild/External_VMTK.cmake#L27)

As a side note, it would be great if you could search for other occurrence that pattern and submit a PR fixing OpenIGTLinkIF.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 31, 2018, 10:05pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/34 "2018-08-31T22:05:12Z")

</div>

Ok, I can update the block dealing with CPack, and I’ll make sure to specify a commit. Once all this is sorted out, I can make that change to OpenIGTLinkIF as well.

One thing that’s confusing is the different naming of the extension. In a number of places it’s SlicerVMTK, but the repository is SlicerExtension-VMTK. I’m not sure when to use which name.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [September 4, 2018, 5:01am UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/35 "2018-09-04T05:01:11Z")

</div>

> [@mschumaker](#):
>
> One thing that’s confusing is the different naming of the extension. In a number of places it’s SlicerVMTK, but the repository is SlicerExtension-VMTK. I’m not sure when to use which name.

In doubt, use the name of the project found in the `project(NameOfProject)` statement.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [September 5, 2018, 7:28pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/36 "2018-09-05T19:28:02Z")

</div>

So after everything… the problem has been solved by setting the extension\_name to be SlicerVMTK. At the point where it was failing, the project name was being assigned as the expected extension name, and so the extension source files couldn’t be found.

As discussed, I’ve revised the block dealing with CPack, and I’ll submit a PR, though I would also like to add ITK and VTK as dependencies of the extension. When I tried a completely fresh superbuild, it attempted to build VMTK before ITK, and stopped. How can I add those dependencies correctly?

> <https://github.com/mschumak/SlicerExtension-VMTK/blob/Sept4-application-superbuild-fix/CMakeLists.txt#L19>

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 5, 2018, 8:40pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/37 "2018-09-05T20:40:12Z")

</div>

Sounds great!

You should be able to define dependencies by setting `${proj}_DEPENDS` in `External_(yourlibrary).cmake`, as it is done for example for this external library:

> <https://github.com/openigtlink/SlicerOpenIGTLink/blob/master/SuperBuild/External_OpenIGTLinkIO.cmake#L4>

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [September 5, 2018, 9:34pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/38 "2018-09-05T21:34:57Z")

</div>

Ok, thanks, I’ll do that.

Thank you for your help, @lassoan and @jcfr!

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [September 6, 2018, 8:26pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/39 "2018-09-06T20:26:18Z")

</div>

It’s almost there… but not quite. Everything compiles, but I’m unable to access the Python libraries for VMTK from the interpreter. Also, there was a problem when I attempted to package the app. The VMTK-build directory is in ~/app-SuperBuild/slicersources-build, but the script was expecting it to be in ~/app-SuperBuild, so “make package” failed.

Do you have any suggestions?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [September 6, 2018, 10:44pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/40 "2018-09-06T22:44:10Z")

</div>

> [@mschumaker](#):
>
> ~/app-SuperBuild/slicersources-build, but the script was expecting it to be in ~/app-SuperBuild, so “make package” failed.

This section

> <https://github.com/vmtk/SlicerExtension-VMTK/blob/547eb4710e1da103899e7ab63e3023c2bcfab83c/SuperBuild/External_VMTK.cmake#L20-L29>

should be updated based on

[https://github.com/Slicer/Slicer/blob/f08936e114b0cff769d6e4cb196d697848f29194/Utilities/Templates/Extensions/SuperBuild/SuperBuild/External\_Foo.cmake#L23-L45](https://github.com/Slicer/Slicer/blob/f08936e114b0cff769d6e4cb196d697848f29194/Utilities/Templates/Extensions/SuperBuild/SuperBuild/External_Foo.cmake#L23-L45)

consider also removing `git_protocol` and instead using `EP_GIT_PROTOCOL` as well as `ExternalProject_SetIfNotDefined`

[Previous page](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639.md?page=1)

[Next page](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639.md?page=3)
