[Insight-users] Better linking of special headers
Michael Xanadu
xanadu.michael at googlemail.com
Thu Sep 6 09:24:01 EDT 2012
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120906/d48715c9/attachment.htm>
More information about the Insight-users
mailing list