[CMake] How to use VTK as an ExternalProject
Nicolas Rannou
nicolas_rannou at hms.harvard.edu
Mon Feb 7 18:01:40 EST 2011
Hello,
I would like to set up a "superbuild" for my project.
I would like it to be as clean/basic as possible.
Let's say I want to build VTK as my "ExternalProject". How should I
proceed to link it to my current project.
My current project requires VTK to be built.
So FIND_PACKAGE cannot work. (vtk source code not there during the
configuration step)
And I didn't get any success manually setting VTK_DIR, VTK_INCLUDE_DIRS,
etc. at the end of my External-VTK.cmake file. Is it the way to go?
How should I proceed to do it?
Is there any tutorial on the net? (I couldn't find any)
I had a look at CTK's and Slicer's superbuilds but we would like
something more basic and straight forward. Is it possible?
Is there a special option in CMake/ExternalProjects to be enabled or
anything we can do about it?
A workaround was to build "myProject" as an ExternalProject linked to
the "VTK ExternalProject", and to turn off USE_SUPERBUILD but I don't
really like this solution.
Any help would be greatly appreciated,
Thanks
*_CMAKELISTS.TXT_
PROJECT*( MYPROJECT )
...
*OPTION*( USE_SUPERBUILD "Use SuperBuild" ON )
...
*IF*( USE_SUPERBUILD )
*INCLUDE*( "${GOFIGURE2_SOURCE_DIR}/CMake/SuperBuild/External-VTK.cmake" )
*ENDIF*( USE_SUPERBUILD )
...
*FIND_PACKAGE*( VTK )??? //NOT WORKING
...
_*
External-VTK.cmake*_
set(proj VTK)
...
ExternalProject_Add(${proj}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
GIT_REPOSITORY "${git_protocol}://vtk.org/VTK.git"
GIT_TAG "origin/release"
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${ep_common_args}
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
-DVTK_USE_PARALLEL:BOOL=ON
-DVTK_DEBUG_LEAKS:BOOL=${USE_VTK_DEBUG_LEAKS}
-DVTK_USE_RPATH:BOOL=ON
-DVTK_INSTALL_LIB_DIR:PATH=${MyProject_INSTALL_LIB_DIR}
${VTK_QT_ARGS}
${VTK_MAC_ARGS}
INSTALL_COMMAND ""
DEPENDS
${VTK_DEPENDENCIES}
)
...
set(VTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)??? // NOT WORKING
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110207/785371e7/attachment.htm>
More information about the CMake
mailing list