[Insight-users] Better linking of special headers

Bill Lorensen bill.lorensen at gmail.com
Thu Sep 6 10:20:20 EDT 2012


When you build ITK, add
ITK_USE_REVIEW:BOOL=ON

In your project,
LINK_LIBRARIES(${ITK_LIBRARIES})

On Thu, Sep 6, 2012 at 9:24 AM, Michael Xanadu <
xanadu.michael at googlemail.com> wrote:

> Hi,
>
> I have a problem linking an ITK class to my project. At first I build the
> binaries of ITK 3.20 and linked them to my project via CMAKE. What I did
> was:
>
>
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
>   MESSAGE(FATAL_ERROR "Cannot build without ITK. Please set ITK_DIR.")
> ENDIF(ITK_FOUND)
>
> SET(ITK_LIBS
>   ITKAlgorithms
>   ITKBasicFilters
>   ITKCommon
>   ITKIO
> )
>
> LINK_LIBRARIES(${ITK_LIBS})
>
>
> Everything works fine. I can compile my project with many ITK classes in
> use. But then I tried to use
>
> #include "itkImageKernelOperator.h"
>
> in my project. Unfortunatelly, the compiler (VS 2010) says:
>
> fatal error C1083: Cannot open include file: 'itkImageKernelOperator.h':
> No such file or directory
>
> I found out that the directory C:/Libs/ITK_SRC_3.20.1/Code/Review (with
> the missing file mentioned above) of the ITK source was missing in the
> project settings. Don't know why. So I added following line to
> CMakeLists.txt:
>
> INCLUDE_DIRECTORIES(C:/Libs/ITK_SRC_3.20.1/Code/Review)
>
> OK, now it works. The missing file was found by the compiler and
> everything is fine now. But of course this line is a little bit ugly
> because I need to know the absolute path to the ITK source.
> Does anybody know a better looking solution?
>
>
> With kind regards,
> Michael
>
> _____________________________________
> 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.php
>
> 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
>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120906/4ce0855b/attachment.htm>


More information about the Insight-users mailing list