[CMake] How to get current visualstudio version?

Xi Shen davidshen84 at gmail.com
Mon Dec 28 00:50:24 EST 2015


Strange, the FindBoost module expects boost libraries start with "boost_"
by default. But the libraries I got from the default build configuration
start with "libboost_". No wonder it did not work the first I tried.


Thanks,
David


On Mon, Dec 28, 2015 at 1:15 PM Xi Shen <davidshen84 at gmail.com> wrote:

> Yes, the official FindBoost works better xD
>
>
> On Fri, Dec 25, 2015 at 8:40 PM Nils Gladitz <nilsgladitz at gmail.com>
> wrote:
>
>> On 25.12.2015 10:36, Xi Shen wrote:
>> > Hi,
>> >
>> > I know I can check MSVC to determine if the Visual Studio generator is
>> > used. But how do I find out which version is been used?
>>
>> MSVC indicates that the Visual C++ compiler (or something compatible) is
>> being used; which does not necessarily mean a Visual Studio generator.
>> If you do need to make that distinction you can check MSVC_IDE [1]
>> instead.
>>
>> >
>> > The reason I want to find the the version of VS being used, is because
>> > I need to link to the Boost libraries. Boost create its libraries with
>> > suffixes like "-vs120-mt", etc. and "vs120" indicates Visual Studio
>> 2013.
>>
>> Why aren't you using the Boost find module[2] included with CMake? It
>> already accounts for Boost's library name mangling.
>>
>> The module uses e.g. the MSVC12 [3] variable to detect "vc120".
>> But I am guessing CMAKE_<LANG>_COMPILER_VERSION [4] might work for this
>> use case nowadays as well.
>>
>> Nils
>>
>> [1] https://cmake.org/cmake/help/v3.4/variable/MSVC_IDE.html
>> [2] https://cmake.org/cmake/help/v3.4/module/FindBoost.html
>> [3] https://cmake.org/cmake/help/v3.4/variable/MSVC12.html
>> [4]
>>
>> https://cmake.org/cmake/help/v3.4/variable/CMAKE_LANG_COMPILER_VERSION.html
>>
> --
>
> Regards,
> David
>
-- 

Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151228/3ef39834/attachment.html>


More information about the CMake mailing list