ThirdPartyVTK.cmake 1.64 KB
Newer Older
1
OPTION(NEKTAR_USE_VTK "Use VTK library for utilities." OFF)
2

3 4 5
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_VTK
    "Build VTK library from ThirdParty" OFF
    "NEKTAR_USE_VTK; FALSE" OFF)
6 7

IF( NEKTAR_USE_VTK )
8 9 10 11 12 13 14 15 16 17
    IF( THIRDPARTY_BUILD_VTK )
        INCLUDE( ExternalProject )

        # The cmake package has been modified due to a bug in the CMake files
        # which causes it to produce an error when the path includes a '+'.
        # Obviously this is inconvenient for us.
        EXTERNALPROJECT_ADD(
            vtk-5.10.1
            URL ${TPURL}/vtk-5.10.1-nek.tar.bz2
            URL_MD5 "f4e2c6b848d3873d44479baa9e7e4d35"
18
            STAMP_DIR ${TPBUILD}/stamp
19
            DOWNLOAD_DIR ${TPSRC}
20 21 22 23
            SOURCE_DIR ${TPSRC}/vtk-5.10.1
            BINARY_DIR ${TPBUILD}/vtk-5.10.1
            TMP_DIR ${TPBUILD}/vtk-5.10.1-tmp
            INSTALL_DIR ${TPDIST}
24 25 26 27 28 29
            CONFIGURE_COMMAND ${CMAKE_COMMAND} 
                -G ${CMAKE_GENERATOR}
                -DCMAKE_INSTALL_PREFIX:PATH=${TPDIST} 
                -DBUILD_SHARED_LIBS:BOOL=ON 
                -DCMAKE_BUILD_TYPE:STRING=Release 
                ${TPSRC}/vtk-5.10.1
30
        )
31
        SET(VTK_DIR ${TPDIST}/lib/vtk-5.10)
32 33 34 35
        SET(VTK_FOUND 1)
        SET(VTK_USE_FILE ${VTK_DIR}/UseVTK.cmake)
        INCLUDE (${VTK_DIR}/VTKConfig.cmake)
    ELSE()
36
        FIND_PACKAGE(VTK)
37 38 39
        IF (VTK_FOUND)
            MESSAGE(STATUS "Found VTK: ${VTK_USE_FILE}")
        ELSE (VTK_FOUND)
40
            MESSAGE(FATAL_ERROR "VTK not found")
41
        ENDIF (VTK_FOUND)
42 43
    ENDIF()
    
44 45 46 47 48
    INCLUDE (${VTK_USE_FILE})
    MARK_AS_ADVANCED(VTK_DIR)
    ADD_DEFINITIONS(-DNEKTAR_USING_VTK)
ENDIF( NEKTAR_USE_VTK )