[Insight-developers] checking for itk4 settings in external software

M.Staring at lumc.nl M.Staring at lumc.nl
Tue Aug 2 03:42:15 EDT 2011


Hi all,

When using ITK4 in my software I sometimes depend on the ITK to be built in a specific manner, i.e. with certain modules on.
Instead of the software to fail to compile (usually with a non-clear error message) it would be nice to catch this during configuration, after which I can easily give a clear message to users.

I have come up with the following addition to my cmake list:

# ITKTools depends on some ITK modules. Check for them:
set( listofrequiredcomponents ITKCommon ITKIOPhilipsREC <can add more modules here>)
foreach( item ${listofrequiredcomponents} )
	# Find the item in the list of enabled modules
  	list( FIND ITK_MODULES_ENABLED ${item} found )

	# Notify the user and fail gracefully.
  	if( found EQUAL -1 )
	      message( SEND_ERROR "The module "${item}" has not been set to ON when compiling ITK. This option is mandatory for ITKTools to 			build.\nPlease recompile your ITK installation." )
	  else()
	      message( STATUS "Found required ITK module "${item} )
	  endif()
endforeach()
message( STATUS "Found all ITK modules required to build ITKTools!" )

The downside of this solution is that there are many many modules in ITK4 and its hard to tell on what it depends on exactly, and additionally it only checks if a module was build but not with what settings (for example with some compatibility option on or off).

Has anyone done something similar before?
Does this seem like a good way to check this or is there a better way ?

Regards,
Marius

Marius Staring, PhD
Division of Image Processing (LKEB)
Department of Radiology
Leiden University Medical Center
PO Box 9600, 2300 RC Leiden, The Netherlands
phone: +31 (0)71 526 2137, fax: +31 (0)71 526 6801 m.staring at lumc.nl



More information about the Insight-developers mailing list