[CMake] if/else statment based on VTK version

Brad King brad.king at kitware.com
Mon May 22 14:38:56 EDT 2006


Kathryn Hayes wrote:
> We're building teem against VTK 4 and VTK 5, and it looks like we're going
> to build it with different flags depending on the VTK version to get it to
> compile.  Is there a good way to test for the VTK version in CMake so we
> can use the same CMakeLists.txt for both cases?

FIND_PACKAGE(VTK)
IF("${VTK_MAJOR_VERSION}" EQUAL 5)
   SET(MYPROJ_VTK_5 1)
ELSE("${VTK_MAJOR_VERSION}" EQUAL 5)
   SET(MYPROJ_VTK_5 0)
ENDIF("${VTK_MAJOR_VERSION}" EQUAL 5)

-Brad


More information about the CMake mailing list