>Why isn't CMake doing that by default? The convention of the target platform should prevail over the convention of the toolchain, shouldn't it?'
CMake considers the target platform to be composed of the OS, and the compilation toolchain. Therefore MINGW uses the 'lib' prefix. > 2. Should I use if(WIN32) rather than if(MINGW)? No if you are using a Microsoft compiler/toolchain than the prefix is already empty. On Tue, Jul 10, 2018 at 3:27 AM Olivier Croquette <ocroque...@free.fr> wrote: > Hello, > > some projects I am working on are built using CMake and MinGW on > Windows. It works fine, unfortunately there are come inconsistencies > regarding the names of the generated libraries. Some are prefixed with > "lib" like on Unix systems, some are not, like usual on Windows. > > It seems that this can be controlled easily by adding the following > lines in the top CMakeLists.txt: > > if(MINGW) > set(CMAKE_SHARED_LIBRARY_PREFIX "") > set(CMAKE_STATIC_LIBRARY_PREFIX "") > endif() > > As a CMake beginner, I still have some questions though: > > 1. Are there some side-effects? For instance, can it cause libraries not > to be found when using them across projects? > > 2. Should I use if(WIN32) rather than if(MINGW)? > > 3. Why isn't CMake doing that by default? The convention of the target > platform should prevail over the convention of the toolchain, shouldn't it? > > Thanks! > > Olivier > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake