From: Vladislav Sovrasov Date: Thu, 18 May 2017 10:49:46 +0000 (+0300) Subject: cmake: add compilation test for VTK X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1^2~637^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7e29cb63c5fa13562d285fa6b9aa20a9e9fc838;p=platform%2Fupstream%2Fopencv.git cmake: add compilation test for VTK --- diff --git a/cmake/OpenCVDetectVTK.cmake b/cmake/OpenCVDetectVTK.cmake index f160777..702069b 100644 --- a/cmake/OpenCVDetectVTK.cmake +++ b/cmake/OpenCVDetectVTK.cmake @@ -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})") diff --git a/cmake/checks/vtk_test.cpp b/cmake/checks/vtk_test.cpp new file mode 100644 index 0000000..2096133 --- /dev/null +++ b/cmake/checks/vtk_test.cpp @@ -0,0 +1,9 @@ +#include +#include +#include + +int main() +{ + vtkSmartPointer transform = vtkSmartPointer::New(); + return 0; +}