David,

Jerome's suggested structure is good.  But if you are lazy like me and just 
want to get the darn thing to work, simply adding

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)

to the MyFilter/plugin/CMakeLists.txt file should do the trick.

-Ken


On 11/28/09 1:14 AM, "Jérôme" <jerome.ve...@gmail.com> wrote:

Hi,

My own experience is the following:
I usually make a project with this directory structure:
./
./Algorithms
./Plugins
./(other stuffs)

a global CMakeLists defines different variables:
- ALGORITHM_PATH
- PLUGIN_PATH

A user-defined variable
- BUILD_PARAVIEW_PLUGIN

If the latter is on, then I add SUB_DIRS( PLUGIN_PATH )

In the Algorithm folder, a CMakeLists create a new library (say VTKAlgo lib) 
and set a ALGORITHM_SRC variable that
contains the cxx and h. Obvously INCLUDE_DIR is set to this path too.
In the Plugin folder, a CMakeLists build the plugin. After the 
ADD_PARAVIEW_PLUGIN, I add TARGET_LINK_LIBRARY( MyPlugin VTKAlgo)

This structure is quite convenient IMHO and I use it for any new project. Final 
user can choose to build only the VTK lib or the ParaView plugin. For extended 
project with other targets (such as GIMIAS), I simply have to add a folder with 
properly defined CMake variable.

HTH
Jerome




2009/11/28 David Doria <daviddo...@gmail.com>
Say I have written a VTK filter and the directory structure is as follows:
.../MyFilter/MyFilter.h
.../MyFilter/MyFilter.cxx
.../MyFilter/CMakeLists.txt

And it is built in
.../MyFilter/bin

I now want to make a Paraview plugin for it. I would like to keep it very 
separate though so I can still have something to hand out to people who just 
want the filter, and then have something extra that I could also provide if 
people want the plugin. I tried to do the following:

Make a .../MyFilter/plugin directory.
Put the MyFilter.xml and a new CMakeLists.txt in that directory.
set SERVER_MANAGER_SOURCES to ../vtkMyFilter.cxx (which is 
.../MyFilter/MyFilter.cxx)

I then made .../MyFilter/plugin/bin and tried to build the plugin in this 
directory. The problem seems to be that since vtkMyFilter.cxx includes 
"vtkMyFilter.h", this header cannot be found since we are no longer in the same 
directory that vtkMyFilter.h exists in.

I guess ideally I would like to have a .../MyFilter/CMakeListsPlugin.txt and 
build it in .../MyFilter/plugin_bin, but as far as I understand cmake will only 
let you read the configuration from a file named exactly CMakeLists.txt.
Is there an easy solution to this? How do you guys do it?

Thanks,

David

_______________________________________________
Powered by www.kitware.com <http://www.kitware.com>

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview





   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmo...@sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to