<div dir="ltr"><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">></span><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Why isn't CMake doing that by default? The convention of the target<span> </span></span><br style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">platform should prevail over the convention of the toolchain, shouldn't it?'</span><br style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><div><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">CMake considers the target platform to be composed of the OS, and the compilation toolchain. Therefore MINGW uses the 'lib' prefix.</span></div><div><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> <span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">2. Should I use if(WIN32) rather than if(MINGW)?</span></span></div><div><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">No if you are using a Microsoft compiler/toolchain than the prefix is already empty.</span></span></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 10, 2018 at 3:27 AM Olivier Croquette <<a href="mailto:ocroquette@free.fr">ocroquette@free.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
some projects I am working on are built using CMake and MinGW on <br>
Windows. It works fine, unfortunately there are come inconsistencies <br>
regarding the names of the generated libraries. Some are prefixed with <br>
"lib" like on Unix systems, some are not, like usual on Windows.<br>
<br>
It seems that this can be controlled easily by adding the following <br>
lines in the top CMakeLists.txt:<br>
<br>
if(MINGW)<br>
   set(CMAKE_SHARED_LIBRARY_PREFIX "")<br>
   set(CMAKE_STATIC_LIBRARY_PREFIX "")<br>
endif()<br>
<br>
As a CMake beginner, I still have some questions though:<br>
<br>
1. Are there some side-effects? For instance, can it cause libraries not <br>
to be found when using them across projects?<br>
<br>
2. Should I use if(WIN32) rather than if(MINGW)?<br>
<br>
3. Why isn't CMake doing that by default? The convention of the target <br>
platform should prevail over the convention of the toolchain, shouldn't it?<br>
<br>
Thanks!<br>
<br>
Olivier<br>
<br>
<br>
-- <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>