<div dir="ltr"><div><div><div class="" itemprop="text">
<p>Hello,<br></p><p>I want to use custom executable linking command in my CMake
script, namely Synopsys VCS. VCS is a wrapper over GCC, but it uses
special syntax for passing LD options:</p>
<pre><span style="background-color:rgb(208,224,227)"><code>vcs -LDFLAGS "<LINK_FLAGS>" <LINK_LIBRARIES> <OBJECTS></code><code> </code></span><br><br><span style="font-family:arial,helvetica,sans-serif">I've tried to play with <code>CMAKE_CXX_LINK_EXECUTABLE:<br></code></span><code><br><span style="background-color:rgb(208,224,227)">set(CMAKE_CXX_LINK_EXECUTABLE "echo CXXFLAGS: <CMAKE_CXX_LINK_FLAGS> LINK_FLAGS: <LINKER_FLAGS> LINK_LIBRARIES: <LINK_LIBRARIES> OBJECTS: <OBJECTS> ")
</span></code>
</pre><p>When I build project i got:</p>
<pre><code><span style="background-color:rgb(208,224,227)">CXXFLAGS:
LINK_FLAGS:
LINK_LIBRARIES: -rdynamic ../slib/libslib.a ../dlib/libdlib.so -Wl,-rpath,/home/ripopov/proj_cmake/build/dlib
OBJECTS: CMakeFiles/sim.dir/sc_main.cpp.o</span>
</code></pre>
<p><span style="font-family:arial,helvetica,sans-serif">So all linker flags together with libraries are in <LINK_LIBRARIES>. And <LINK_FLAGS> is empty.<br></span></p><span style="font-family:arial,helvetica,sans-serif">
</span><p><span style="font-family:arial,helvetica,sans-serif">Why it works this way? And how can I extract linker flags from LINK_LIBRARIES?</span></p><span style="font-family:arial,helvetica,sans-serif">
</span></div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">I've posted same question on stackoverflow:<br><a href="http://stackoverflow.com/questions/37368434/cmake-custom-link-executable-command-how-to-extract-linker-options">http://stackoverflow.com/questions/37368434/cmake-custom-link-executable-command-how-to-extract-linker-options</a> <br></span></div><div><span style="font-family:arial,helvetica,sans-serif"><br><br>-- <br></span></div><span style="font-family:arial,helvetica,sans-serif">Best regards,<br></span></div><span style="font-family:arial,helvetica,sans-serif">Roman</span><br>
</div>