<div dir="ltr"><div>Dear Cristian,</div><div><br></div><div>It would better for me not modifying CMakeFiles.txt, because as I wrote it is 3rd party stuff (we just download it and build, but some different way).</div><div></div><div>My concern is why the command line option -DCMAKE_SHARED_LINKER_FLAGS deliberately ignores /DEF: option. It this behavior expected? What is the logic behind this behavior? Why not simply allow /DEF in CMAKE_SHARED_LINKER_FLAGS and not cut it?</div><div><br></div><div>--</div><div>Best Regards,</div><div>Alexander<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 4 Oct 2019 at 16:54, Cristian Adam <<a href="mailto:cristian.adam@gmail.com">cristian.adam@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>You should simply add the <span style="white-space:pre-wrap"><font face="monospace">my_defs.def</font> file as a source files to <font face="monospace">add_library/add_executable</font>. </span></div><div><span style="white-space:pre-wrap">CMake will automagically pass<font face="monospace"> /DEF</font>: to the linker with </span><font face="monospace">my_defs.def</font></div><div><br></div><div>Cheers,</div><div>Cristian. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 4, 2019 at 4:45 PM Alexander <<a href="mailto:alexander.samoylov@gmail.com" target="_blank">alexander.samoylov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<br><br>I would like to add an extra .defs file for linking of a DLL on
Windows. I want to use the CMake command line option
-DCMAKE_SHARED_LINKER_FLAGS="/DEF:my_defs.defs". I expect that besides
the automatically generated <project_path>/bin/<project>.dir/Release/exports.def i see additionally
/DEF:my_defs.defs
in the resulting linking command, but it does not happen.<br>
<br>
What is especially irritating that CMake deliberately removes namely
/DEF: from CMAKE_SHARED_LINKER_FLAGS. Any other word combinations (if I
write /DEF111:my_defs.def for example) are accepted and I see them the
linking command.<br>
<br><div>I tried to reach the same goal using a CMakeLists.txt like this:</div><div><pre><code>set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEF:my_defs.def")</code></pre></div>but it did not help - the same way CMake removes my /DEF: option.<br><br>
Could you please open a ticket to fix this behavior to not cut /DEF: option from CMAKE_***_LINKER_FLAGS?<br><div><br>
</div><div>On my opinion CMake should not interpret or modify the content of
CMAKE_SHARED_LINKER_FLAGS value, but should put it entirely as the user
specified it. If you have another opinion, please provide any other possibility to pass an arbitrary arguments to the linking command "as is" so that they are not modified.</div><div><br></div>
Any workaround is highly appreciated (better command-line, because we build 3rd party software and it would not really fine to change CMakeLists.txt)<br><br><div>--</div><div>Best Regards,</div><div>Alexander Samoilov<br></div><div>Build & Integration Engineer<br></div><div>Compart AG, 71034 Böblingen Germany<br></div></div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div>
</blockquote></div>