[cmake-developers] [PATCH] Correct platform related variables for Open Watcom compilers

Brad King brad.king at kitware.com
Fri Mar 14 11:41:39 EDT 2014


On 03/14/2014 11:27 AM, Jiri Malak wrote:
> It is now a litle complicated because numbering used by CMake is old Watcom. By example for Watcom
> 10.6 CMake reported 10.6 (CMAKE_C_COMPILER_VERSION variable), but for Open Watcom numbering is
> shifted by 1100 that for Open Watcom 1.0 CMake reports 12.0 (CMAKE_C_COMPILER_VERSION value).
> Fix ensure that Open Watcom 1.0 will be reported correctly as 1.0 and CMAKE_C_COMPILER_VERSION
> will be 1.0 etc.
> 
> Now question, how Open Watcom 1.9 should be identified. If it will be "Watcom" then version should
> be 12.90 if it will be "OpenWatcom" then version will be 1.9.

We could do something like:

#elif defined(__WATCOMC__)
# if __WATCOMC__ >= 1200
#  define COMPILER_ID "OpenWatcom"
   /* __WATCOMC__ = VVRR + 1100, Open Watcom */
#  define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100 ) / 100)
#  define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# else
#  define COMPILER_ID "Watcom"
   /* __WATCOMC__ = VVRR, Old Watcom */
#  define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
#  define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
# endif

> Correct is "OpenWatcom", but in this case old configuration will not understand "OpenWatcom" ID.

Policies CMP0025 and CMP0047 change some existing compiler ids.
Another one could be introduced for this case to map OpenWatcom
back to Watcom and add 11 to the compiler major version.  Of
course it will cause warnings in every project when building
with OpenWatcom until their cmake_minimum_required version is
high enough to set the policy.

-Brad




More information about the cmake-developers mailing list