[CMake] Conditional subdirectory build

David Cole david.cole at kitware.com
Sun Nov 29 10:12:26 EST 2009


if(BUILD_PARAVIEW_PLUGIN==ON)
  should just be
if(BUILD_PARAVIEW_PLUGIN)

cmake --help-command IF
will explain...

There is no "==" but there are EQUAL and STREQUAL operators. In the case of
a boolean option variable, the syntax "if(variable)" if preferred.


HTH,
David


On Sun, Nov 29, 2009 at 9:10 AM, David Doria <daviddoria at gmail.com> wrote:

> I am packaging a VTK filter. I am trying to give the user the option
> of additionally compiling the Paraview plugin for the filter (in the
> .../plugin directory). I wanted to make a BUILD_PARAVIEW_PLUGIN
> variable that they could set to "ON" or "OFF". If it is set to "ON",
> CMake should proceed with processing the plugin subdirectory. Else,
> just ignore it. However, when I generate the makefiles in both cases,
> they seem to be the same and neither includes the plugin subdirectory.
>
> Can anyone see where I have gone wrong?
>
> My main CMakeLists.txt file is:
> ------------------------------
> 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 ON CACHE STRING "Build Paraview plugin?" FORCE)
>
> if(BUILD_PARAVIEW_PLUGIN==ON)
>  ADD_SUBDIRECTORY(plugin)
> endif(BUILD_PARAVIEW_PLUGIN==ON)
>
> ADD_EXECUTABLE(vtkPointSetOutlierRemoval Example.cxx
> vtkPointSetOutlierRemoval.cxx)
> TARGET_LINK_LIBRARIES(vtkPointSetOutlierRemoval vtkHybrid )
>
> -------------------------------
> And the plugin subdirectory CMakeLists.txt file is:
>
> FIND_PACKAGE(ParaView REQUIRED)
> INCLUDE(${PARAVIEW_USE_FILE})
>
> ADD_PARAVIEW_PLUGIN(PointSetOutlierRemoval "1.0"
>  SERVER_MANAGER_XML PointSetOutlierRemoval.xml
> SERVER_MANAGER_SOURCES ../vtkPointSetOutlierRemoval.cxx
> )
>
>
> Thanks,
>
> David
> _______________________________________________
> 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 CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091129/fbae3f34/attachment-0001.htm>


More information about the CMake mailing list