[Insight-users] cmake couldn't find ITK-4.0

Luis Ibanez luis.ibanez at kitware.com
Thu May 26 13:55:56 EDT 2011


Hi Juan,

With today's version of ITKv4.

When you install it you get subdirectories

* bin
* include
* lib
* share


For example,
I'm installing it in

           /home/ibanez/local/itk

so, I have

/home/ibanez/local/itk/bin
/home/ibanez/local/itk/include
/home/ibanez/local/itk/lib
/home/ibanez/local/itk/share


The files ITKConfig.cmake and UseITK.cmake
are in this case, in the directory

/home/ibanez/local/itk/lib/cmake/ITK-4.0

as

/home/ibanez/local/itk/lib/cmake/ITK-4.0/ITKConfig.cmake
/home/ibanez/local/itk/lib/cmake/ITK-4.0/UseITK.cmake

The headers are of course installed in

/home/ibanez/local/itk/include/ITK-4.0

and the libraries are of course installed in

/home/ibanez/local/itk/lib



The libraries have been names with the version number
(4.0) on purpose, to make possible for you to have multiple
versions of ITK installed without having conflicts between
them.

-----


      Here is the important thing to keep in mind:


When you configure with CMake your ITK-based project,
in the ITK_DIR entry you must put the directory where
UseITK.cmake is located.

In my case:

ITK_DIR:PATH=/home/ibanez/local/itk/lib/cmake/ITK-4.0

With that setting, CMake knows that it can find the headers in

/home/ibanez/local/itk/include

and the libraries in

/home/ibanez/local/itk/lib



       Luis


----------------------------------------------------
On Mon, May 23, 2011 at 3:58 PM, Juan Cardelino
<juan.cardelino at gmail.com> wrote:
> Hi Luis,
>           Thanks for your answer. I think my previous mail was a
> mess, so I will try to be clearer now. I had one installation of ITK 4
> (an early version I think) in /usr/local/, the code was downloaded in
> the folder /home/juan/juanc/soft/develop/ITK-dev/ITK and built in
> /home/juan/juanc/soft/develop/ITK-dev/ITK-build. When I did a make
> install, it will copy everything to /usr/local/include and
> /usr/local/lib and after that my cmake based project used to found ITK
> without problem.
> As a side note, files where installed in
> /usr/local/include/InsightToolikt-4.0 and
> /usr/local/lib/InsightToolikt-4.0. I think the ITKConfig.cmake was in
> /usr/local/lib/.
>
> After some time from the first git clone, I've made a git pull on the
> source directory (/home/juan/juanc/soft/develop/ITK-dev/ITK), rm -fr
> on both /usr/local/include/InsightToolikt-4.0 and
> /usr/local/lib/InsightToolikt-4.0 and after rebuilding it (cmake, make
> ,make install), I found two odd things:
> *first: the libraries were refactored to from ITKCommon, ITK-Common-4.0.
> *second: the ITKConfig.cmake was installed in /usr/local/lib/cmake/ITK-4.0
>
> As you could see, not the ITK headers nor the libs are installed in
> the cmake subfolder
>>ls -lh /usr/local/lib/cmake/ITK-4.0/
> total 64K
> -rw-r--r-- 1 root root 4.2K 2011-05-11 10:56 ITKConfig.cmake
> -rw-r--r-- 1 root root  309 2011-04-04 18:36 ITKConfigVersion.cmake
> -rw-r--r-- 1 root root 1.7K 2011-04-04 18:35
> itkImageIOFactoryRegisterManager.h.in
> -rw-r--r-- 1 root root 2.6K 2011-04-25 10:36 ITKModuleAPI.cmake
> -rw-r--r-- 1 root root 5.9K 2011-05-04 11:26 ITKTargets.cmake
> -rw-r--r-- 1 root root  27K 2011-05-11 11:55 ITKTargets-noconfig.cmake
> drwxr-xr-x 2 root root 4.0K 2011-05-04 11:35 Modules
> -rw-r--r-- 1 root root 2.7K 2011-04-25 10:36 UseITK.cmake
>
> So, short answer for you. No, I don't have two installations of ITK.
> Maybe I have some leftovers from the first installation. I did this on
> the 3 machines I work with the same result, so I'm sure I'm making a
> systematic error.
>
> Now, when I cmake on my project ITK isn't found, but when I set ITKDIR
> to /usr/local/lib/cmake/ITK-4.0/ everything works perfect.
> Any clues?
> Thanks for your time.
> Best,
>         Juan
>
>
>
> On Sat, May 21, 2011 at 4:31 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>> Hi Juan,
>>
>> I'm not sure I understand your question.
>>
>> It looks like you have multiple installations of ITK,
>> and you want to have CMake prefer one of them.
>> Is that right ?
>>
>> From your email, it looks like you have one ITK
>> installation in:
>>
>>                 /usr/local/lib/cmake/ITK-4.0
>>
>>
>> Could you please clarify your question ?
>>
>>
>>    Thanks
>>
>>
>>         Luis
>>
>>
>> --------------------------------------------------------------------
>> On Mon, May 16, 2011 at 5:01 PM, Juan Cardelino
>> <juan.cardelino at gmail.com> wrote:
>>> Hello guys,
>>> I have a silly question about cmake and ITK.
>>> Usually, when I pulled the code and built ITK myself (even in version
>>> 4.0), and tried to compile my code against it, cmake was able to find
>>> the installed ITK. After some update of the code in GIT it is not able
>>> to do it anymore. Now every project I try to compile using it, I have
>>> to tell cmake to use the ITKConfig.cmake file, which was installed in
>>> the build process in /usr/local/lib/cmake/ITK-4.0
>>> Is there anything I can do to avoid this? I'm thinking about copying
>>> the ITKConfig.cmake to some 'standard' place or something like that. I
>>> thought when you perform 'make install' in the ITK build dir it was
>>> automatically done, but I guess I was wrong.
>>> I guess if I use /usr as the install prefix everythin will work, but I
>>> don't really want to do that.
>>> Thanks in advance.
>>> Best regards,
>>>                  Juan
>>> _____________________________________
>>> 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
>>>
>>
> _____________________________________
> 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
>


More information about the Insight-users mailing list