[ITK-dev] installed ITK cannot be moved due to absolute path

Matt McCormick matt.mccormick at kitware.com
Wed Dec 21 19:07:03 EST 2016


On Wed, Dec 21, 2016 at 12:05 PM, Rashad Kanavath
<mohammedrashadkm at gmail.com> wrote:
>
>
> On Wed, Dec 21, 2016 at 5:06 PM, Matt McCormick <matt.mccormick at kitware.com>
> wrote:
>>
>> Hi Rashad,
>>
>> The Find<Package>.cmake are purposely not provided because it is not
>> reliable and does not provide all the information required. The CMake
>> package configuration file allows ITK to declare what is required to
>> build it instead of requiring CMake to guess (and get it wrong).
>>
>> For this case, it is recommended to turn off ITK_USE_SYSTEM_ZLIB,
>> which will make the ITK installation portable.
>
>
> I need to use zlib, fftw and expat in that case from ITK build/
>
> But I have also providing a different build of zlib for my other projects.

ITK's zlib will play nicely with the other zlibs -- it is name mangled.

Another path forward is to use a zlib that has a CMake package
configuration file and teach ITK to use that.


> What are the missing information when using FindITK.cmake as opposed to itk
> cmake configuration files?

ITK has required build flags, configuration options, and build include
directories, third party library requirements, linking library
requirements that depend on its modular configuration and differ based
on whether it is a build tree or an install tree. This would be
difficult if not impossible to try to recreate in a FindITK.cmake
module.


> I understand that saving absolute path of libraries which link with project
> is easy to avoid any issues in linking or at runtime.
>  And that is one type of solution and IMHO does not solve the problem.
>
> Apart from that I would like to find out what are real issues with
> Find<Package>.cmake

For example, if there are multiple zlib's on your system or if they
are installed in non-standard locations, the build system will be
lucky if it finds the one ITK was built against.

Another fundamental issue: for CMake to use a Find<Package>.cmake to
find <Package>, Find<Package>.cmake must exist and be used before
<Package> is found. That is, Find<Package>.cmake must be shipped with
CMake or a library that is trying to use <Package>. The version of
Find<Package>.cmake that comes with CMake or another library does not
necessarily correspond to the configuration required by the version of
<Package> that is available.

CMake Config-file modules should be used instead of Find-file modules
as a general best practice. The package can declare its build
requirements instead of making CMake try to guess them.

HTH,
Matt


More information about the Insight-developers mailing list