[Insight-users] Problem for building ITK examples out of ITK tree

Luis Ibanez luis.ibanez@kitware.com
Sun, 23 Feb 2003 18:08:42 -0500


Hi Neha,

It is good to know that the basic components
of the toolkit are building ok for you.

The problem should then be related with the
configuration of the example out of the source
tree.

Note that you should not take the full "Examples"
directory out of the source tree. Only the
"BasicIOAndFilter" directory is configured to
be built outside the tree.

The modifications you made to the CMakeLists.txt
file look good.

That left the configuration process itself as
the main suspect. I would double check that the
directory you are providing for ITK is the right
binary directory where ITK was built.



About your questions:

1) This example may require to add the ITKIO
    library after the ITKCommon library.
    This will account for "unresolved external"
    error messages.

2) If, when building the examples out of the
    tree, you get error messages concerning
    header files not found. This indicates a
    problem with the location of the ITK binary
    directory.  But, again, please note that
    the "Examples" directory is not expected
    to build outside the source tree. At least
    not with the current CMakeLists.txt files.

    Only the isolated "BasicIOAndFilter" example
    has an appropriate CMakeLists.txt file for
    this purpose. The "SampleProject" is also
    connfigured to be built out of the source
    tree without any changes to is CMakeLists.txt
    file.

    You are not expected to modify the Visual
    Studio project once you load it. This is
    a bad idea since the project is generated
    by CMake. Any manual changes you made to the
    project will be lost in the next run of
    CMake. If you find things that need to be
    modified, do this in the CMakeLists.txt
    file associated with the project, and then
    run CMake to update the VC++ project.

3) The modifications to the CMakeLists.txt file
    in BasicIOAndFilter should be enough. My guess
    is that you are providing as source dir to
    CMake the top dir of the Examples, instead of
    the "BasicIOAndFilter" directory.

    The CMakeLists.txt file in "Examples" is not
    designed to be used outside the source tree.


-----

So,
to be short:

A) Copy only the "BasicIOAndFilter" directory somewhere
    else in your disk. Modify the CMakeLists.txt according
    to the comments. (you already made this modifications
    succesfully).

B) Run CMake and provide the right path to the ITK
    binary directory.

C) Open the VC++ project and build the application.




Please let us know if you find further problems,


   Thanks


     Luis


------------------------------------------
Neha D wrote:
> Hi Luis,
> 
> Thanks once again for your reply.
> 
> yes, my actual problem is - having trouble building applications out of 
> the ITK source tree.
> 
> I have succeeded in building examples in ITK source. ( I have built ITK 
> with BUILD_EXAMPLES = on in cmake. )
> 
> Then I copy the examples/BasicIOAndFilter dir.  out of ITK source and 
> binary directories.
> 
> I have modified cmakeList.txt by removing comments in that file, 
> cmakeList.txt looks like this:
> 
> **********************************************************
> 
> PROJECT(BasicIOAndFilter)
> 
> INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
> IF (USE_ITK_FILE)
>     INCLUDE (${USE_ITK_FILE})
> ENDIF (USE_ITK_FILE)
> 
> ADD_EXECUTABLE( BasicIOAndFilter   BasicIOAndFilter.cxx )
> TARGET_LINK_LIBRARIES( BasicIOAndFilter ITKIO )
> 
> **********************************************************
> 
> Also, while configuring cmake settings, I use ITK_BINARY_PATH in which 
> executables are built.
> 
> *My Questions are :*
> 
> *1.*    So, looking at the errors I get, do I need to add more libraries 
> in TARGET_LINK_LIBRARIES command ? ( I have tried adding more libraries 
> like ITKCommon .etc )
> 
> *2.*  When I try to build the own example out of ITK tree, I get lot of 
> errors of header different files not found, when I try to build the 
> ALL_BUILD in MS vishal Studio complier ( version 6.0 ). If ALL_BUILD is 
> working, why doesn't native build works. Here, I try to include all 
> Include Directored required for that program in Tools/Option settting in 
> MS Visual studio  compiler. Is this really needed.
> 
> *3.* So, I guess, I need to know exactly what commands are needed to use 
> in CmakeList files and configuring Cmake properly.
> 
> Is there anything else I need to know. Please let me know exactly where 
> I am making mistake.
> 
> Thanks,
> 
> neha
>