Re: [CMake] [ITK-dev] find_package issues with ITK and VTK (and SlicerExecution Model)
On 09/30/2014 11:13 AM, Bradley Lowekamp wrote: > 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? find_package(ITK REQUIRED) set(MY_ITK_COMPONENTS ...) # list required mods here if(";${ITK_MODULES_ENABLED};" MATCHES ";ITKDeprecated;") list(APPEND MY_ITK_COMPONENTS ITKDeprecated) endif() itk_module_config(ITK ${MY_ITK_COMPONENTS}) I think the if() line could also be written if(TARGET ITKDeprecated) but I don't remember off the top of my head whether the library names and module names always match exactly. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] [ITK-dev] find_package issues with ITK and VTK (and SlicerExecution Model)
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 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 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] [ITK-dev] find_package issues with ITK and VTK (and SlicerExecution Model)
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 Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] [ITK-dev] find_package issues with ITK and VTK (and SlicerExecution Model)
Here is what I do for the WikiExamples remote module: find_package(VTK REQUIRED) include(${VTK_USE_FILE}) set(VTK_COMPONENTS ${VTK_LIBRARIES}) find_package(ITK REQUIRED) include(${ITK_USE_FILE}) set(ITK_LIBRARIES ${ITK_LIBRARIES} ${VTK_COMPONENTS}) On Tue, Sep 30, 2014 at 10:14 AM, Williams, Norman K wrote: > This is a problem that has been cropping up in our projects that use ITK, > VTK and SlicerExecutionModel. > > You won’t see it UNLESS you turn on the ITKVTK/ITKVtkGlue modules. > > The problem is this: if you find packages in this order: > > 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: > find_package(VTK COMPONENTS > vtkCommonCore > vtkRenderingCore > vtkRenderingOpenGL > vtkRenderingFreeType > vtkInteractionStyle > vtkIOImage > vtkImagingSources > REQUIRED) > > Which blows away the larger list of include directories and libraries that > the first find_package(VTK REQUIRED) built. > > Even better — or worse — > Modules/Segmentation/LevelSetsv4Visualization/CMakeLists.txt also include > find_package(VTK) — so ITK tries to import VTK twice, with different module > lists. > > It doesn’t even help to reverse the order: > find_package(ITK REQUIRED) > find_package(VTK REQUIRED) > > because apparently there’s some hangover from the find_package(VTK) inside > the ITK CMake deployment files. The only thing that works is to use > COMPONENTS, i.e. > > find_package(ITK REQUIRED) > find_package(VTK COMPONENTS vtkCommonCore vtkRenderingAnnotation … REQUIRED) > > Which seems to trigger a proper re-scan and build of the library/include > lists. > > It gets even worse if you use find_package(SlicerExecutionModel) after > find_package(ITK), for the same reason — SlicerExecutionModel depends on > ITK, so it clobbers the include/library lists from the first > find_package(ITK). > > > > > > Notice: This UI Health Care e-mail (including attachments) is covered by the > Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential > and may be legally privileged. If you are not the intended recipient, you > are hereby notified that any retention, dissemination, distribution, or > copying of this communication is strictly prohibited. Please reply to the > sender that you have received the message in error, then delete it. Thank > you. > > > ___ > 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 > -- Unpaid intern in BillsBasement at noware dot com -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake