[Insight-users] VTK and ITK together - simple CmakeLists.txt example?

Dženan Zukić dzenanz at gmail.com
Mon Oct 10 03:50:17 EDT 2011


Which ITK version are you using? ITK4 has to be built in directory separate
from source, and you have to point your project to the build dir. Here is a
working example:

cmake_minimum_required(VERSION 2.6)

PROJECT(bugTester CXX)

FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})

FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})

FIND_PACKAGE(Qt4)
SET(QT_USE_QTOPENGL 1)
SET(QT_USE_QTDESIGNER ON)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})

ADD_EXECUTABLE(bugTester bugTester.cpp)

TARGET_LINK_LIBRARIES(bugTester ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(bugTester ${ITK_LIBRARIES})
TARGET_LINK_LIBRARIES(bugTester vtkVolumeRendering vtkRendering vtkCommon
QVTK)

On Fri, Oct 7, 2011 at 18:41, Rick Frank <rickf at fullspectrumsw.com> wrote:

> Hi****
>
> ** **
>
> I’m trying to configure and generate a simple Visual Studio 10 project to
> use VTK and ITK together.****
>
> ** **
>
> Here is my CmakeLists.txt file.****
>
> ** **
>
> cmake_minimum_required(VERSION 2.6)****
>
>  ****
>
> PROJECT(ReadDICOM)****
>
>  ****
>
> find_package(VTK REQUIRED)****
>
> include(${VTK_USE_FILE})****
>
> ****
>
>  ****
>
> find_package(ITK REQUIRED)****
>
> include(${ITK_USE_FILE})****
>
> ** **
>
> add_executable(ReadDICOM ReadDICOM.cxx)****
>
> ** **
>
> target_link_libraries(ReadDICOM ${VTK_LIBRARIES} ${ITK_LIBRARIES})****
>
> ** **
>
> ** **
>
> Everything goes ok with CMake, the headers and libraries seem to be in the
> project properties, but Visual Studio can only find VTK headers, etc.****
>
> ** **
>
> It can’t find the ITK headers, and doesn’t compile if I try to use ITK. Is
> there something I’m missing? ( I’m a newbie with CMake) ****
>
> ** **
>
> Thanks****
>
> ** **
>
> Rick****
>
> ** **
>
> ** **
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111010/3d945d6a/attachment.htm>


More information about the Insight-users mailing list