[CMake] CLANG vs GCC when linking executables

Patrick Boettcher patrick.boettcher at posteo.de
Fri May 12 12:38:09 EDT 2017


On Fri, 12 May 2017 17:30:16 +0200
Patrick Boettcher <patrick.boettcher at posteo.de> wrote:
> The problem only occurs when the compiler is coming from a custom
> build from a custom path. Running 
>   
>   CXX=clang++ cmake <src-path>
> 
> makes cmake generate the correct link options.
> 
>   CXX=/local/path/bin/clang++ cmake <src-path>
> 
> makes cmake generate wrong link options (without RPATH).
> 
> Seems to be related the compiler-ID which is wrongly determined or
> something like that. 

I continued a bit more, it turns out that the placeholder
<LINK_LIBRARIES> (using the link.txt) does not contain the
rpath-options when linking with my locally generated compiler but it
present when using system compiler.

Where is LINK_LIBRARIES filled in? What option, features makes cmake
insert -Wl,rpath or not (as in my case)

--
Patrick.


More information about the CMake mailing list