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
--
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:
http://public.kitware.com/mailman/listinfo/cmake