cmake: add compilation test for VTK

This commit is contained in:
Vladislav Sovrasov 2017-05-18 13:49:46 +03:00 committed by Alexander Alekhin
parent ca922443db
commit e7e29cb63c
2 changed files with 22 additions and 0 deletions

View File

@ -52,5 +52,18 @@ if(HAVE_QT AND ${VTK_VERSION} VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION}
endif()
endif()
try_compile(VTK_COMPILE_STATUS
"${OpenCV_BINARY_DIR}"
"${OpenCV_SOURCE_DIR}/cmake/checks/vtk_test.cpp"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${VTK_INCLUDE_DIRS}"
LINK_LIBRARIES ${VTK_LIBRARIES}
OUTPUT_VARIABLE OUTPUT
)
if(NOT ${VTK_COMPILE_STATUS})
message(STATUS "VTK support is disabled. Compilation of the sample code has failed.")
return()
endif()
set(HAVE_VTK ON)
message(STATUS "Found VTK ${VTK_VERSION} (${VTK_USE_FILE})")

View File

@ -0,0 +1,9 @@
#include <vtkSmartPointer.h>
#include <vtkTransform.h>
#include <vtkMath.h>
int main()
{
vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
return 0;
}