Paraview Make building Paraview plugin optional
If you develop a VTK filter for which you would like to make a Paraview plugin, it is nice to distribute it in a way that it can be used by users with only VTK as strictly a VTK filter, or by users with both VTK and Paraview as a VTK filter and a Paraview plugin. To do this, the directory structure should be as follows: <source lang="text"> ..../MyFilter/MyFilter.h ..../MyFilter/MyFilter.cxx ..../MyFilter/CMakeLists.txt ..../MyFilter/plugin/CMakeLists.txt ..../MyFilter/plugin/MyFilter.xml </source>
The MyFilter/CMakeLists.txt should look like <source lang="text"> cmake_minimum_required(VERSION 2.6)
if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) endif(COMMAND cmake_policy)
PROJECT(vtkPointSetOutlierRemoval)
FIND_PACKAGE(VTK REQUIRED) INCLUDE(${VTK_USE_FILE})
SET(BUILD_PARAVIEW_PLUGIN OFF CACHE BOOL "Build Paraview plugin?")
if(BUILD_PARAVIEW_PLUGIN)
SUBDIRS(plugin)
endif(BUILD_PARAVIEW_PLUGIN)
ADD_EXECUTABLE(vtkMyFilter Demo.cxx vtkMyFilter.cxx) TARGET_LINK_LIBRARIES(vtkMyFilter vtkHybrid )
</source>
and the MyFilter/plugin/CMakeLists.txt should look like <source lang="text"> FIND_PACKAGE(ParaView REQUIRED) INCLUDE(${PARAVIEW_USE_FILE})
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ../)
ADD_PARAVIEW_PLUGIN(MyFilter "1.0"
SERVER_MANAGER_XML MyFilterxml
SERVER_MANAGER_SOURCES ../MyFilter.cxx )
</source>