Skip to content

BUG: Disable adding dependency for externally built modules#5763

Merged
blowekamp merged 1 commit intoInsightSoftwareConsortium:mainfrom
blowekamp:cmake_cmake_external_factory
Feb 4, 2026
Merged

BUG: Disable adding dependency for externally built modules#5763
blowekamp merged 1 commit intoInsightSoftwareConsortium:mainfrom
blowekamp:cmake_cmake_external_factory

Conversation

@blowekamp
Copy link
Member

@blowekamp blowekamp commented Feb 3, 2026

When a module is built outside of the ITK source, do not add the module as a dependency to the factory meta-module.

Addresses #5760

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

@github-actions github-actions bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots labels Feb 3, 2026
@dzenanz dzenanz requested a review from SimonRit February 3, 2026 17:37
Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good.

When a module is built outside of the ITK source, do not add the
module as a dependency to the factory meta-module.
@blowekamp blowekamp force-pushed the cmake_cmake_external_factory branch from 7f8833c to 77c1df1 Compare February 3, 2026 20:41
@blowekamp blowekamp changed the title BUG: Disable adding dependency for externally build modules BUG: Disable adding dependency for externally built modules Feb 3, 2026
Copy link

@SimonRit SimonRit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, that does not seem to work for me. It does configure and compile with the following message at configuration

-- Cannot add RTKModule(ImageIO::DCMImagX) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::His) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::Hnc) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::Hnd) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::ImagX) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::Ora) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::XRad) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::Xim) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).

but the factories are not registered as far as I can tell.

@SimonRit
Copy link

SimonRit commented Feb 3, 2026

Sorry, that does not seem to work for me. It does configure and compile with the following message at configuration

-- Cannot add RTKModule(ImageIO::DCMImagX) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::His) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::Hnc) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::Hnd) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::ImagX) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::Ora) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::XRad) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).
-- Cannot add RTKModule(ImageIO::Xim) to factory meta-module ITKImageIO because is undefined (outside ITK source tree).

but the factories are not registered as far as I can tell.

Sorry, the problem is different, the problem seems to be with the ITK factories actually:

ExceptionObject caught with itk::WriteImage(streamerBP->GetOutput(), args_info.output_arg) in file /home/srit/src/rtk/rtk/applications/rtkfdk/rtkfdk.cxx line 207

itk::ImageFileWriterException (0x59134053b650)
Location: "unknown" 
File: /home/srit/src/itk/itk/Modules/IO/ImageBase/include/itkImageFileWriter.hxx
Line: 117
Description:  Could not create IO object for writing file fdk.mha
  Tried to create one of the following:
    HndImageIO
    HncImageIO
    XimImageIO
    HisImageIO
    ImagXImageIO
    DCMImagXImageIO
    EdfImageIO
    XRadImageIO
    OraImageIO
    HndImageIO
    HncImageIO
    XimImageIO
    HisImageIO
    ImagXImageIO
    DCMImagXImageIO
    EdfImageIO
    XRadImageIO
    OraImageIO
    GDCMImageIO
  You probably failed to set a file suffix, or
    set the suffix to an unsupported type.

Something must have changed...

@blowekamp
Copy link
Member Author

blowekamp commented Feb 3, 2026

Please see the documentation here:
https://docs.itk.org/en/latest/migration_guides/itk_6_migration_guide.html#application-configuration

I see you are also disabling ITK_USE_FILE. If that is done then itk_generate_factory_registration() must be called instead.

P.S. You also may need to link to ITK::RTKModule, to get all the properties, but the RTK target likely has all the needed dependencies already.

@SimonRit
Copy link

SimonRit commented Feb 3, 2026

Please see the documentation here: docs.itk.org/en/latest/migration_guides/itk_6_migration_guide.html#application-configuration

I see you are also disabling ITK_USE_FILE. If that is done then itk_generate_factory_registration() must be called instead.

P.S. You also may need to link to ITK::RTKModule, to get all the properties, but the RTK target likely has all the needed dependencies already.

Thanks, I had missed that obviously. If I keep ITK_USE_FILE it works. But I still have the problem when I try to adjust the code according to the software guide. See PR here, comments are welcome there, I'm approving this PR meanwhile as the issue seems independent.

@blowekamp blowekamp merged commit f5c7277 into InsightSoftwareConsortium:main Feb 4, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants