Need to update extensions that other extensions may depend on

Extensions were failed to build last night that depend on extensions that don’t provide a (ExtensionName)Config.cmake file. The error is changed to a warning for now, so extension builds will succeed tomorrow, but developers who maintain extensions that other extensions may depend on, should make a small change in their CMakeLists.txt files.

Reason for the change: For importing path variables (library paths, python paths, etc.) from dependent extensions, find_package() must be able to find the dependent extension.

How to make sure find_package() can find a dependent extension: Add this line near the end of the top-level CMakeLists.txt (just before Slicer_EXTENSION_CPACK configuration, see this example):

include(${Slicer_EXTENSION_GENERATE_CONFIG})

Hi Andras,

I added the line locally to all dependent extensions and build each one.

When I configure the extensions which has dependencies it still gives the following error:

CMake Warning at /Users/christian/sources/cpp/Slicer/Extensions/CMake/SlicerBlockAdditionalLauncherSettings.cmake:48 (MESSAGE):
  Dependent extension SlicerDevelopmentToolbox DCMQI PETDICOMExtension cannot
  be found by CMake find_package(), therefore paths variables cannot be
  imported from this extension.  The problem can be resolved by generating
  SlicerDevelopmentToolbox DCMQI PETDICOMExtensionConfig.cmake by adding
  include(${Slicer_EXTENSION_GENERATE_CONFIG}) to the top-level
  CMakeLists.txt of the dependent exension.
Call Stack (most recent call first):
  /Users/christian/sources/cpp/Slicer/Build/Slicer-build/UseSlicer.cmake:282 (include)
  CMakeLists.txt:19 (include)

Am I missing anything?

Christian

Note that at least some of those extensions already generate config file (I think dcmqi does, without using the line Andras mentioned), and also it appears that none of the extensions we maintain had build failures (see filtered list here).

I added the line (for now only locally) for testing to all dependent extensions, but cmake still drops that error message when configuring QuantitativeReporting

The *Config.cmake file that Slicer generates contains directories that has to be added to AdditionalLauncherSettings.ini file. If you generate your own *Config.cmake file already then you may need to disable that mechanism (when you build it as a Slicer extension) and use Slicer’s *Config.cmake generator instead. You can inject your own content into the Slicer-generated *Config.cmake files.

Ok and how do I do that?

To add custom content to your MyExtensionConfig.cmake file, set MyExtension_CUSTOM_CONFIG variable above include(${Slicer_EXTENSION_GENERATE_CONFIG}). See details and example here: