-
Notifications
You must be signed in to change notification settings - Fork 5
Visual C internal versions v.s. public versions
Why use 19.1 in the following codes?
Here is the explanation about VC internal and public versions
src/CMakeLists.txt
elseif (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 18 AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 19) # Visual C++ 2013
set_target_properties(yage PROPERTIES OUTPUT_NAME_DEBUG yagevc12d)
set_target_properties(yage PROPERTIES OUTPUT_NAME_RELEASE yagevc12)
elseif (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 19 AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 19.1) # Visual C++ 2015
set_target_properties(yage PROPERTIES OUTPUT_NAME_DEBUG yagevc14d)
set_target_properties(yage PROPERTIES OUTPUT_NAME_RELEASE yagevc14)
Here is an example about using CMAKE_CXX_COMPILER_VERSION
When CMake (current version: 3.2.2) generates project files for Visual Studio, it appears to define an variable that seems quite useful to me: CMAKE_CXX_COMPILER_VERSION. It appears to be the full compiler version. For example, for my VS2010 installation, CMAKE_CXX_COMPILER_VERSION is "16.0.40219.1", and for my VS2013 installation, CMAKE_CXX_COMPILER_VERSION is "18.0.31101.0".
It seems useful to me to pass this CMake variable to the resource compiler, which does not have direct access to the macro's predefined by the C++ compiler (like _MSC_FULL_VER and _MSC_BUILD), for example by adding a "-D" flag:
add_definitions(-DMY_COMPILER_VERSION="${CMAKE_CXX_COMPILER_VERSION}")
Do you agree that it would be a good idea to add CMAKE_CXX_COMPILER_VERSION to the list of useful CMake variables, at http://www.cmake.org/Wiki/CMake_Useful_Variables ?