[CMake] RPATH cross-compile issue with CHECK_*_EXISTS

Brad King brad.king at kitware.com
Mon Feb 27 11:43:18 EST 2017


On 02/07/2017 04:40 AM, Ray Donnelly wrote:
>>> I have a PR that asks the linker (via the compiler) what its implicit
>>> search directories are instead.
>>>
>>> It is the right way to do it IMHO, but I need to find time to finish
>>> it unfortunately.
>>
>> Do you have a link to the PR?
>
> The PR Is closed pending me writing a test-case, but I just now
> updated to the my latest version and rebased on top of master:

The MR was:

 https://gitlab.kitware.com/cmake/cmake/merge_requests/207

See discussion there for why it has not yet been accepted.  Basically
I'd like to see a clear explanation of the use case.  The case described
in the MR looks to me like the custom compiler should be configured to
always pass the needed rpath flags to the linker.

On 02/06/2017 06:16 PM, Jörg Krause wrote:
> I did a git bisect. The behaviour was introduced in commit
> 896ad251de49f167f4ce3cbbcf9a6cce85a16681 [1].

Thanks for the bisect.  I don't think there is anything wrong with that
change on its own.  It merely exposed some existing behavior in a new case.

> My suggestion is to set FIND_LIBRARY_USE_LIB32_PATHS and
> FIND_LIBRARY_USE_LIB64_PATHS to FALSE when cross-compiling on Linux.

These are set on by default in `Modules/Platform/UnixPaths.cmake` but
disabled on Debian by `Modules/Platform/Linux.cmake` except when
cross compiling.  If a toolchain file specifies CMAKE_SYSTEM_NAME
such that a custom `Platform/MySystem.cmake` file is loaded then
the latter can set them as needed for the target platform.

-Brad


More information about the CMake mailing list