[vtk-developers] Check if VTK was built with testing

David Cole david.cole at kitware.com
Sun Jun 10 10:35:44 EDT 2012


Seems like:

  if(vtkTestingCore_LOADED)

should work. (Tested against a build tree of VTK, not sure if the same
applies to an install tree...)

Hopefully one of the modularization gurus chimes in to say if that's the
canonical way we're expected to do that. There are other ways to tell, even
though BUILD_TESTING itself is not available after a "find_package(VTK)"...


I used the following CMake code to see what variables are available (and
there are many, many, many) after a find_package(VTK):

cmake_minimum_required(VERSION 2.8)
project(VTK-cli1)

function(echo_all_cmake_variables)
  message(STATUS "")
  get_cmake_property(vs VARIABLES)
  foreach(v ${vs})
    message(STATUS "${v}='${${v}}'")
  endforeach(v)
  message(STATUS "")
endfunction()

message(STATUS "")
message(STATUS "before find_package(VTK)")
echo_all_cmake_variables()

find_package(VTK)

message(STATUS "")
message(STATUS "after find_package(VTK)")
echo_all_cmake_variables()


Then I ran CMake, pointing it to a build of VTK, and just searched the
output for "Testing":

  cmake -DVTK_DIR="/Users/.../VTK-build" .. > out.txt


HTH,
David C.


On Sun, Jun 10, 2012 at 7:50 AM, David Doria <daviddoria at gmail.com> wrote:

> In the vtkwikiexamples repository, we get a compiler error:
>
> fatal error: vtkTesting.h: No such file or directory
>
> if VTK was not built with BUILD_TESTING=ON. Is there a way to check the
> value of this variable in an external project?
>
> Thanks,
>
> David
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120610/fccf63dd/attachment.html>


More information about the vtk-developers mailing list