<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks JC,<div><br></div><div>That's how we did it but we were wondering if there was another straight forward solution without calling GOFIGURE2 as an External Project with&nbsp;-<b style="color: rgb(0, 153, 0); ">DUSE_SUPERBUILD:BOOL=OFF</b>.</div><div><br></div><div>So we will stay with this "SuperBuild style" but we might have to meet the "CTK SuperBuild style" at some point.</div><div>We will let you know if we have any question regarding the implementation in CTK!</div><div><br></div><div>Have a nice Hackfest!</div><div><br></div><div>Nicolas</div><div><font class="Apple-style-span" color="#009900"><b><br></b></font></div><div><font class="Apple-style-span" color="#009900"><b><br></b></font><div><div>Le Feb 7, 2011 à 11:03 PM, Jean-Christophe Fillion-Robin a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Nicolas, <br><br>To properly use the superbuild feature, you could structure your project as described below:<br><br>&lt;PROJ-SRC&gt;/CMakeLists.txt<br>&lt;PROJ-SRC&gt;/Superbuild.cmake<br>&lt;PROJ-SRC&gt;/CMakeExternals/External-VTK.cmake<br>

<br>Within CMakeLists.txt, by default the variable USE_SUPERBUILD will be ON.<br>If this variable is ON, it means a file named, for example Superbuild.cmake will have to be included.<br>Then, within superbuild.cmake, the "ExternalProject_add" command will have to be invoked. <br>

<br>You will find below some hints regarding the content of these different file:<br><br><small><b><u>CMAKELISTS.TXT</u><br>
        PROJECT</b>( MYPROJECT )<br>
      ...<br>
      <b>OPTION</b>( USE_SUPERBUILD "Use SuperBuild" ON )<br>
      ...<br>
      <b>IF</b>( USE_SUPERBUILD )<br>
      &nbsp; <b>INCLUDE</b>(
      "${CMAKE_CURRENT_SOURCE_DIR}/Superbuild.cmake" )<br><span style="color: rgb(0, 153, 0);">&nbsp;<b> RETURN()</b></span><br>
      <b>ENDIF</b>( USE_SUPERBUILD )</small><br>
    <small>...<br>
      <b>FIND_PACKAGE</b>( VTK )</small>??? //NOT WORKING<br>
    ...<br>
    <u><b><br><br></b></u><small><b><u>Superbuild.cmake</u></b></small><br><br># Compute -G arg for configuring external projects with the same CMake generator:<br>IF(CMAKE_EXTRA_GENERATOR)<br>&nbsp; SET(gen "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")<br>

ELSE()<br>&nbsp; SET(gen "${CMAKE_GENERATOR}")<br>ENDIF()<br><br>INCLUDE(CMakeExternals/External-VTK.cmake)<br><br><b>ExternalProject_Add(GoFigure2</b><br>&nbsp;&nbsp; DOWNLOAD_COMMAND ""<br>&nbsp;&nbsp; CMAKE_GENERATOR ${gen}<br>

&nbsp;&nbsp; CMAKE_ARGS<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -<b style="color: rgb(0, 153, 0);">DUSE_SUPERBUILD:BOOL=OFF</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .....<br>&nbsp; SOURCE_DIR ${GoFigure2_SOURCE_DIR}<br>&nbsp; BINARY_DIR ${GoFigure2_BINARY_DIR}/GoFigure2-build<br>&nbsp; DEPENDS<br>&nbsp;&nbsp;&nbsp;&nbsp; VTK<br>

&nbsp; )<br><br>Looking at both <a href="http://viewvc.slicer.org/viewcvs.cgi/trunk/?root=Slicer4">Slicer</a> and <a href="https://github.com/commontk/CTK">CTK</a>, you will also be able to grab some code ... <br><br>Nevertheless, note that CTK buildsystem is a little bit more complex since it's able to <a href="http://www.commontk.org/index.php/Documentation/BuildSystem_Description">include the external project dynamically depending on the enabled libraries</a>, plugin ... <br>

<br><br>Thanks<br>Jc<br><br><div class="gmail_quote">On Mon, Feb 7, 2011 at 6:01 PM, Nicolas Rannou <span dir="ltr">&lt;<a href="mailto:nicolas_rannou@hms.harvard.edu">nicolas_rannou@hms.harvard.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

  

    
  
  <div text="#000000" bgcolor="#ffffff">
    <small>Hello,<br>
      <br>
      I would like to set up a "superbuild" for my project.<br>
      I would like it to be as clean/basic as possible.<br>
      <br>
      Let's say I want to build VTK as my "ExternalProject". How should
      I proceed to link it to my current project.<br>
      <br>
      My current project requires VTK to be built.<br>
      So FIND_PACKAGE cannot work. (vtk source code not there during the
      configuration step)<br>
      And I didn't get any success manually setting VTK_DIR,
      VTK_INCLUDE_DIRS, etc. at the end of my </small><small>External-VTK.cmake
      file. Is it the way to go?<br>
      <br>
      How should I proceed to do it?<br>
      Is there any tutorial on the net? (I couldn't find any)<br>
      I had a look at CTK's and Slicer's superbuilds but we would like
      something more basic and straight forward. Is it possible?<br>
      Is there a special option in CMake/ExternalProjects to be enabled
      or anything we can do about it?<br>
      <br>
      A workaround was to build "myProject" as an ExternalProject linked
      to the "VTK </small><small>ExternalProject"</small><small>, and
      to turn off USE_SUPERBUILD but I don't really like this solution.<br>
      <br>
      Any help would be greatly appreciated,<br>
      <br>
      Thanks<br>
    </small><small><br>
      <b><u>CMAKELISTS.TXT</u><br>
        PROJECT</b>( MYPROJECT )<br>
      ...<br>
      <b>OPTION</b>( USE_SUPERBUILD "Use SuperBuild" ON )<br>
      ...<br>
      <b>IF</b>( USE_SUPERBUILD )<br>
      &nbsp; <b>INCLUDE</b>(
      "${GOFIGURE2_SOURCE_DIR}/CMake/SuperBuild/External-VTK.cmake" )<br>
      <b>ENDIF</b>( USE_SUPERBUILD )</small><br>
    <small>...<br>
      <b>FIND_PACKAGE</b>( VTK )</small>??? //NOT WORKING<br>
    ...<br>
    <u><b><br>
        <small>External-VTK.cmake</small></b></u><br>
    <small><br>
      set(proj VTK)<br>
      ...<br>
      &nbsp; ExternalProject_Add(${proj}<br>
      &nbsp;&nbsp;&nbsp; SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}<br>
      &nbsp;&nbsp;&nbsp; BINARY_DIR ${proj}-build<br>
      &nbsp;&nbsp;&nbsp; GIT_REPOSITORY "${git_protocol}://<a href="http://vtk.org/VTK.git" target="_blank">vtk.org/VTK.git</a>"<br>
      &nbsp;&nbsp;&nbsp; GIT_TAG "origin/release"<br>
      &nbsp;&nbsp;&nbsp; CMAKE_GENERATOR ${gen}<br>
      &nbsp;&nbsp;&nbsp; CMAKE_ARGS<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${ep_common_args}<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DBUILD_EXAMPLES:BOOL=OFF<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DBUILD_SHARED_LIBS:BOOL=ON<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DVTK_USE_PARALLEL:BOOL=ON<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DVTK_DEBUG_LEAKS:BOOL=${USE_VTK_DEBUG_LEAKS}<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DVTK_USE_RPATH:BOOL=ON<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DVTK_INSTALL_LIB_DIR:PATH=${MyProject_INSTALL_LIB_DIR}<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${VTK_QT_ARGS}<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${VTK_MAC_ARGS}<br>
      &nbsp;&nbsp;&nbsp; INSTALL_COMMAND ""<br>
      &nbsp;&nbsp;&nbsp; DEPENDS<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${VTK_DEPENDENCIES}<br>
      &nbsp;&nbsp;&nbsp; )<br>
      ...</small><br>
    set(VTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)??? // NOT WORKING<br>
  </div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br><br clear="all"><br>-- <br>Direct: 1-518-836-2174<br>Ext: 304<br>
</blockquote></div><br></div></body></html>