[vtk-developers] How to determine if a module is available without a cmake error

David Doria daviddoria at gmail.com
Wed Aug 15 10:33:48 EDT 2012


On Wed, Aug 15, 2012 at 10:31 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>
> How to determine ia a module is present in a built VTK without generating a cmake error?
>
> Find_Package(VTK COMPONENTS vtkXXX) will report a cmake error if vtkXXX is not present.
>
> I thought I could do this:
>
> Find_Package(VTK QUIET COMPONENTS vtkXXX)
> if (NOT VTK_FOUND)
>   message(STATUS "Warning vtkXXX is required but not available")
> endif()
>
> but Find_Package(VTK QUIET COMPONENTS vtkXXX) also reports an error.
>
> CMake Error at CMake/vtkModuleAPI.cmake:90 (message):
>   Requested modules not available:
>
>     vtkXXX
> Call Stack (most recent call first):
>   /Users/lorensen/ProjectsGIT/VTK-build/VTKConfig.cmake:72 (vtk_module_config)
>   /Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/FindVTK.cmake:73 (FIND_PACKAGE)
>   Examples/CMakeLists.txt:10 (FIND_PACKAGE)
>
> I want to disable certain builds if a given component is missing.
>
> Bill


There are _LOADED variables that get set when the modules are found:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/CMakeTechniques/CheckForModule

Is that what you were looking for?

David



More information about the vtk-developers mailing list