[CMake] [ITK-dev] find_package issues with ITK and VTK (and SlicerExecution Model)

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Sep 30 11:13:22 EDT 2014


Brad,

Do you have a suggestion on how to conditionally include a module if it's available? e.g. Use ITKDeprecated if ITK was configure with it?

Thanks,
Brad

On Sep 30, 2014, at 10:48 AM, Brad King <brad.king at kitware.com> wrote:

> On 09/30/2014 10:14 AM, Williams, Norman K wrote:
>> find_package(VTK REQUIRED)
>> find_package(ITK REQUIRED)
>> 
>> You can’t real compile anything that needs VTK, because down in
>> the ITK deployment stuff, it calls find_package(VTK) like this:
> [snip]
>> Which blows away the larger list of include directories and libraries
> 
> One may use the itk_module_config and vtk_module_config macros
> from the *ModuleAPI.cmake modules that come with the respective
> packages to compute the list of libraries and include dirs for
> a given list of components.  All ITKConfig and VTKConfig do with
> the list of components is:
> 
> itk_module_config(ITK ${ITK_MODULES_REQUESTED})
> # sets ITK_LIBRARIES, ITK_INCLUDE_DIRS, etc.
> 
> and
> 
> vtk_module_config(VTK ${VTK_MODULES_REQUESTED})
> # sets VTK_LIBRARIES, VTK_INCLUDE_DIRS, etc.
> 
> One can invoke these directly:
> 
> itk_module_config(ITK ${MY_LIST_OF_ITK_COMPONENTS})
> vtk_module_config(VTK ${MY_LIST_OF_VTK_COMPONENTS})
> 
> at any time after the find_package calls.  One could even use
> a different prefix:
> 
> itk_module_config(MyITK ${MY_LIST_OF_ITK_COMPONENTS})
> # sets MyITK_LIBRARIES, MyITK_INCLUDE_DIRS, etc.
> 
> In the long run the plan is to stop recommending use of component
> lists at find_package time and instead use imported targets and
> usage requirements:
> 
> http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#build-specification-and-usage-requirements
> 
> but that will have to wait until we can require CMake 3.0.
> 
> -Brad
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-developers



More information about the CMake mailing list