[ITK-users] Access to ITK_LIBRARY_DIRS during CMake

Matt McCormick matt.mccormick at kitware.com
Mon Sep 19 11:21:04 EDT 2016


Hi Mike,

The ITK_RUNTIME_LIBRARY_DIRS variable was added in ITK 4.9.0 as
explained here [1] [2]

Hope this helps,
Matt

[1] https://issues.itk.org/jira/browse/ITK-3026

[2] http://review.source.kitware.com/#/c/20473

On Mon, Sep 19, 2016 at 10:55 AM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
> we need the directory for the BundleUtilities to be able to find the Itk
> libraries because the Itk libraries are built with @rpath as the
> "install_name" instead of an absolute path. I wrote the following cmake
> code:
>
>   # get the ITKCommon library absolute path
>   STRING(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UPPER)
>   get_target_property(ITK_COMMON_LIB ITKCommon
> IMPORTED_LOCATION_${BUILD_TYPE_UPPER})
>   #message(STATUS "ITK_COMMON_LIB: ${ITK_COMMON_LIB}")
>   # Now get the absolute PATH to that library. We assume this is the library
> directory (Which might fail on Windows)
>   GET_FILENAME_COMPONENT (ITK_LIBRARY_DIRS "${ITK_COMMON_LIB}" PATH)
>
>   #message(STATUS "ITK_LIBRARY_DIRS:\n    ${ITK_LIBRARY_DIRS}")
>
>   # Now append that path to the SIMPLibSearchDirs property
>   get_property(SIMPLibSearchDirs GLOBAL PROPERTY SIMPLibSearchDirs)
>   if(NOT "${SIMPLibSearchDirs}" STREQUAL "")
>     file(APPEND "${SIMPLibSearchDirs}" "${ITK_LIBRARY_DIRS};")
>   endif()
>
> I think ItkCommon is the lowest level of the Itk libraries so if we can find
> that we should be OK. If that does not exist then I am assuming Itk is
> probably not build correctly.
>
> --
> Mike Jackson  [mike.jackson at bluequartz.net]
>
>
>
> Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote:
>>
>> Hello,
>>
>> I would look at ITKConfig.cmake and ITKTargets.cmake.
>>
>> ITK now uses the libraries as “IMPORTED” targets with properties to
>> specify the full path to the libraries.
>>
>> After that there are a variety of “rpath” complication at link and run
>> time to ensure the correct library is loaded. I have to spend a while
>> reading the documentation to understand the issues again.
>>
>> These are considered the “new” and “better” way of doing things. I would
>> look into why you need “ITK_LIBRARY_DIRS” for you project, and then see if
>> there is a newer and better way to now do that with imported targets or
>> “rpaths”.
>>
>> HTH,
>> Brad
>>
>>
>>
>>> On Sep 19, 2016, at 10:26 AM, Michael
>>> Jackson<mike.jackson at bluequartz.net>  wrote:
>>>
>>> I have a self built ITK 4.9.1 on OS X 10.10.5 with Xcode 7.2. I am trying
>>> to get the "ITK_LIBRARY_DIRS" but that variable seems to be empty when I run
>>> CMake. This is after I do the "FindPackage(ITK...)" cmake code. Is that
>>> variable supposed to be empty? Is there a better way to get the Library
>>> directory? I need it for one of my scripts that packages our OS X
>>> application.
>>>
>>> Thanks
>>>
>>> --
>>> Michael A. Jackson
>>> BlueQuartz Software, LLC
>>> [e]: mike.jackson at bluequartz.net
>>> _____________________________________
>>> 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.php
>>>
>>> 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://public.kitware.com/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.php
>
> 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://public.kitware.com/mailman/listinfo/insight-users


More information about the Insight-users mailing list