[Insight-users] cmake linking problem
Martin Kavec
kavec at messi.uku.fi
Fri May 20 09:27:41 EDT 2005
Hi,
I wrote an IO object to read unsupported image format. I also have test code
for it, but have difficulties to link it. I use cmake to create Makefile and
the most likely I miss something in the local CMakeLists.txt, because if i
add the IO object to the ITK/Code/IO (update CMakeList.txt there and
recompile ITK), my test code links successfully against ITKIO library.
If I try to compile the test code it compiles fine, but throws an error while
linking. This is obvious, because my IO files don't get compiled.
I don't want to spoil my ITK installation (though it works) and rather would
keep the IO *.o files in a local directory.
Here is my local CMakeLists.txt
***********************************************
PROJECT( MyIOTest )
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build InsightApplications without ITK. Please set
ITK_DIR.")
ENDIF(ITK_FOUND)
INCLUDE_REGULAR_EXPRESSION(".*")
INCLUDE_DIRECTORIES(${MyIOTest_SOURCE_DIR})
ADD_EXECUTABLE( MyIOTest MyIOTest.cxx )
TARGET_LINK_LIBRARIES(MyIOTest ITKCommon ITKIO ITKBasicFilters )
***********************************************
Thanks for help.
Martin
More information about the Insight-users
mailing list