Extension dependencies in custom apps

Hi all,

Recently the SlicerIGT extension added a dependency to SlicerIGSIO. This is all good, but it made me face a situation in a custom app that I haven’t had to deal with before.

If an extension depends on another one, we need to define a variable, like SlicerIGSIO_DIR, and then SlicerIGT would find SlicerIGSIOConfig.cmake in that folder (I assume). However, in a custom app, the extension build directories differ from a normal extension build directory. There is no such cmake file for example.

Is there a way to force an extension to generate this cmake file? Or any suggestions how to move forward with this?

Thank you so much!

Maybe we could add a check to SlicerIGT that would only call if it is not part of a custom build.

Does this change in SlicerIGT work?:

if (NOT DEFINED Slicer_EXTENSION_SOURCE_DIRS)
  find_package(SlicerIGSIO REQUIRED) 
endif()

Thanks Kyle, a solution I haven’t considered. Wouldn’t it prevent SlicerIGT from using the algorithms in SlicerIGSIO it depends on?

Good point. I think that since both SlicerIGT and SlicerIGSIO would be part of the build same build, it should be fine.

OK let me try, thanks!

Just as I suspected, without having found SlicerIGSIO the build fails with errors like this:

E:\s\sR\SlicerIGT\LandmarkDetection\Logic\vtkSlicerLandmarkDetectionLogic.cxx(38,10): fatal error C1083: Cannot open include file: 'vtkIGSIOLandmarkDetectionAlgo.h': No such file or directory [E:\s\sR\Slicer-build\E\SlicerIGT\LandmarkDetection\Logic\vtkSlicerLandmarkDetectionModuleLogic.vcxproj] [E:\s\sR\slicersources-build\Slicer.vcxproj]

Somehow we need to allow the discovery of the SlicerIGSIO sources and libraries within the custom app. What I can think of is to configure the SlicerIGSIOConfig.cmake file from an .in file and have that set all the variables.

Any other ideas @jcfr @lassoan ? If not then I’ll try with the .in configure approach. Thanks a lot!

vtkIGSIOLandmarkDetectionAlgo is from IGSIO, not SlicerIGSIO. SlicerIGSIO probably pulled in the IGSIO libraries previously.

What if you use:

if (NOT DEFINED Slicer_EXTENSION_SOURCE_DIRS)
  find_package(SlicerIGSIO REQUIRED) 
else()
  find_package(IGSIO REQUIRED) 
endif()

This makes a lot of sense, Kyle. I didn’t even think that these algorithms were in IGSIO not SliceriGSIO. I started a build and it seems to have gone past these. Will send a PR if it finishes without errors. Thank you!