[Cmake-commits] CMake branch, next, updated. v3.0.0-rc4-2642-g245904d

Stephen Kelly steveire at gmail.com
Wed Apr 30 12:49:06 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  245904daf0c56385cd4e4b39f00a2a193d88a3b0 (commit)
       via  50d43cf5555f98c3811bd7897eb43bc27bf8d215 (commit)
       via  9ab0cab2c6ccf61764c8a7390489545b0ff73e0b (commit)
       via  37ec7cdbe2434ae02480e712b5add3a77d51c8a3 (commit)
       via  5db4e315808e0492c79cb74eddb0274673972b7f (commit)
       via  65a7046fa27b091a3401977221f25e0590eacf4a (commit)
       via  b0f8c612fa5a56dec83502d5cc8788aadb0e5766 (commit)
       via  4a6e962c1bbdb0c3b7469b7e553c405a24582c4c (commit)
       via  66d424e5a43e04f35e2b8d0ed9959188b443b76e (commit)
      from  7770e68229ec829f613b2f6e3a3168d0caa40f80 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=245904daf0c56385cd4e4b39f00a2a193d88a3b0
commit 245904daf0c56385cd4e4b39f00a2a193d88a3b0
Merge: 7770e68 50d43cf
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 30 12:49:04 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Apr 30 12:49:04 2014 -0400

    Merge topic 'WriteCompilerDetectionHeader-module' into next
    
    50d43cf5 Add the WriteCompilerDetectionHeader module.
    9ab0cab2 CompilerId: Allow specifying a prefix for preprocessor defines.
    37ec7cdb CompilerId: Guard the platform-default compiler code with a parameter.
    5db4e315 CompilerId: Add option to generate compiler-id-specific defines.
    65a7046f CompilerId: Allow specifying the compiler-specific components to generate.
    b0f8c612 Project: Split the compiler id detection into a separate function.
    4a6e962c Project: Generate the CXX compiler Id test from multiple files.
    66d424e5 Project: Clarify comment about platform-native compilers.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=50d43cf5555f98c3811bd7897eb43bc27bf8d215
commit 50d43cf5555f98c3811bd7897eb43bc27bf8d215
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 21 16:59:40 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 30 18:48:29 2014 +0200

    Add the WriteCompilerDetectionHeader module.
    
    Provide a function to write a portable header to detect compiler
    features.

diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index 2bbe622..ecc9cc4 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -232,3 +232,4 @@ All Modules
    /module/UsewxWidgets
    /module/Use_wxWindows
    /module/WriteBasicConfigVersionFile
+   /module/WriteCompilerDetectionHeader
diff --git a/Help/module/WriteCompilerDetectionHeader.rst b/Help/module/WriteCompilerDetectionHeader.rst
new file mode 100644
index 0000000..4c81b48
--- /dev/null
+++ b/Help/module/WriteCompilerDetectionHeader.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/WriteCompilerDetectionHeader.cmake
diff --git a/Help/release/dev/module-WriteCompilerDetectionHeader.rst b/Help/release/dev/module-WriteCompilerDetectionHeader.rst
new file mode 100644
index 0000000..d355d2c
--- /dev/null
+++ b/Help/release/dev/module-WriteCompilerDetectionHeader.rst
@@ -0,0 +1,5 @@
+module-WriteCompilerDetectionHeader
+-----------------------------------
+
+* The WriteCompilerDetectionHeader module was added to allow creation of
+  a portable header file for compiler optional feature detection.
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
new file mode 100644
index 0000000..89a1808
--- /dev/null
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -0,0 +1,367 @@
+#.rst:
+# WriteCompilerDetectionHeader
+# ----------------------------
+#
+# This module provides the function write_compiler_detection_header().
+#
+# The ``WRITE_COMPILER_DETECTION_HEADER`` function can be used to generate
+# a file suitable for preprocessor inclusion which contains macros to be
+# used in source code::
+#
+#    write_compiler_detection_header(
+#              FILE <file>
+#              PREFIX <prefix>
+#              COMPILERS <compiler> [...]
+#              FEATURES <feature> [...]
+#              [VERSION <version>]
+#              [PROLOG <prolog>]
+#              [EPILOG <epilog>]
+#    )
+#
+# The ``write_compiler_detection_header`` function generates the
+# file ``<file>`` with macros which all have the prefix ``<prefix>``.
+#
+# ``VERSION`` may be used to specify a generation compatibility with older
+# CMake versions.  By default, a file is generated with compatibility with
+# the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION`.  Newer CMake versions may
+# generate additional code, and the ``VERSION`` may be used to maintain
+# compatibility in the generated file while allowing the minimum CMake
+# version of the project to be changed indepenendently.
+#
+# ``PROLOG`` may be specified as text content to write at the start of the
+# header. ``EPILOG`` may be specified as text content to write at the end
+# of the header
+#
+# At least one ``<compiler>`` and one ``<feature>`` must be listed. Compilers
+# which are known to CMake, but not specified are detected and a preprocessor
+# ``#error`` is generated for them.  A preprocessor macro matching
+# ``${PREFIX}_COMPILER_IS_${CompilerId}`` is generated for each compiler
+# known to CMake to contain the value ``0`` or ``1``.
+#
+# Feature Test Macros
+# ===================
+#
+# For each compiler, a preprocessor test of the compiler version is generated
+# denoting whether the each feature is enabled.  A preprocessor macro
+# matching ``${PREFIX}_COMPILER_${FEATURE_NAME_UPPER}`` is generated to
+# contain the value ``0`` or ``1`` depending on whether the compiler in
+# use supports the feature:
+#
+# .. code-block:: cmake
+#
+#    write_compiler_detection_header(
+#      FILE climbingstats_compiler_detection.h
+#      PREFIX ClimbingStats
+#      COMPILERS GNU Clang MSVC
+#      FEATURES cxx_variadic_templates
+#    )
+#
+# .. code-block:: c++
+#
+#    #if ClimbingStats_COMPILER_CXX_VARIADIC_TEMPLATES
+#    template<typename... T>
+#    void someInterface(T t...) { /* ... */ }
+#    #else
+#    // Compatibility versions
+#    template<typename T1>
+#    void someInterface(T1 t1) { /* ... */ }
+#    template<typename T1, typename T2>
+#    void someInterface(T1 t1, T2 t2) { /* ... */ }
+#    template<typename T1, typename T2, typename T3>
+#    void someInterface(T1 t1, T2 t2, T3 t3) { /* ... */ }
+#    #endif
+#
+# Symbol Macros
+# =============
+#
+# Some additional symbol-defines are created for particular features for
+# use as symbols which may be conditionally defined empty. The macros for
+# such symbol defines match ``${PREFIX}_DECL_${FEATURE_NAME_UPPER}``:
+#
+# .. code-block:: c++
+#
+#    class MyClass ClimbingStats_DECL_CXX_FINAL
+#    {
+#        ClimbingStats_DECL_CXX_CONSTEXPR int someInterface() { return 42; }
+#    };
+#
+# The ``ClimbingStats_DECL_CXX_FINAL`` macro will expand to ``final`` if the
+# compiler (and its flags) support the ``cxx_final`` feature, and the
+# ``ClimbingStats_DECL_CXX_CONSTEXPR`` macro will expand to ``constexpr``
+# if ``cxx_constexpr`` is supported.
+#
+# The following features generate corresponding symbol defines:
+#
+# ========================== ===============
+#         Feature                 Symbol
+# ========================== ===============
+# ``cxx_constexpr``           ``constexpr``
+# ``cxx_deleted_functions``   ``= delete``
+# ``cxx_extern_templates``    ``extern``
+# ``cxx_final``               ``final``
+# ``cxx_noexcept``            ``noexcept``
+# ``cxx_override``            ``override``
+# ========================== ===============
+#
+# Compatibility Implemetation Macros
+# ==================================
+#
+# Some features are suitable for wrapping in a macro with a backward
+# compatibility implementation if the compiler does not support the feature.
+#
+# When the ``cxx_static_assert`` feature is not provided by the compiler,
+# a compatibility implementation is available via the
+# ``${PREFIX}_STATIC_ASSERT`` and ``${PREFIX}_STATIC_ASSERT_MSG``
+# function-like macros. The macros expand to ``static_assert`` where that
+# compiler feature is available, and to a compatibility implementation
+# otherwise.
+#
+# ========================== ================================
+#         Feature                         Define
+# ========================== ================================
+# ``cxx_alignas``              ``@PREFIX at _ALIGNAS``
+# ``cxx_alignof``              ``@PREFIX at _ALIGNOF``
+# ``cxx_deleted_functions``    ``@PREFIX at _DISABLE_COPY``
+# ``cxx_noexcept``             ``@PREFIX at _NOEXCEPT_EXPR(X)``
+# ``cxx_nullptr``              ``@PREFIX at _NULLPTR``
+# ``cxx_static_assert``        ``@PREFIX at _STATIC_ASSERT``
+# ``cxx_static_assert``        ``@PREFIX at _STATIC_ASSERT_MSG``
+# ========================== ================================
+
+
+#=============================================================================
+# Copyright 2014 Stephen Kelly <steveire at gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake)
+
+function(_load_compiler_variables CompilerId lang)
+  include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-FeatureTests.cmake" OPTIONAL)
+  foreach(feature ${ARGN})
+    set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE)
+    if (_cmake_symbol_alternative_${feature})
+      set(_cmake_symbol_alternative_${CompilerId}_${feature} ${_cmake_symbol_alternative_${feature}} PARENT_SCOPE)
+      set(_cmake_symbol_alternative_test_${CompilerId}_${feature} ${_cmake_symbol_alternative_test_${feature}} PARENT_SCOPE)
+    endif()
+  endforeach()
+endfunction()
+
+function(write_compiler_detection_header
+    file_keyword file_arg
+    prefix_keyword prefix_arg
+    )
+  if (NOT file_keyword STREQUAL FILE)
+    message(FATAL_ERROR "write_compiler_detection_header: FILE parameter missing.")
+  endif()
+  if (NOT prefix_keyword STREQUAL PREFIX)
+    message(FATAL_ERROR "write_compiler_detection_header: PREFIX parameter missing.")
+  endif()
+  set(options)
+  set(oneValueArgs VERSION EPILOG PROLOG)
+  set(multiValueArgs COMPILERS FEATURES)
+  cmake_parse_arguments(_WCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+  if (NOT _WCD_COMPILERS)
+    message(FATAL_ERROR "Invalid arguments.  write_compiler_detection_header requires at least one compiler.")
+  endif()
+  if (NOT _WCD_FEATURES)
+    message(FATAL_ERROR "Invalid arguments.  write_compiler_detection_header requires at least one feature.")
+  endif()
+
+  if(_WCD_UNPARSED_ARGUMENTS)
+    message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}")
+  endif()
+
+  if(NOT _WCD_VERSION)
+    set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
+  endif()
+  if (_WCD_VERSION VERSION_LESS 3.1.0) # Version which introduced this function
+    message(FATAL_ERROR "VERSION parameter too low.")
+  endif()
+
+  set(compilers
+    GNU
+  )
+  foreach(_comp ${_WCD_COMPILERS})
+    list(FIND compilers ${_comp} idx)
+    if (idx EQUAL -1)
+      message(FATAL_ERROR "Unsupported compiler ${_comp}.")
+    endif()
+  endforeach()
+
+  file(WRITE ${file_arg} "
+// This is a generated file. Do not edit!
+
+#ifndef ${prefix_arg}_COMPILER_DETECTION_H
+#define ${prefix_arg}_COMPILER_DETECTION_H
+")
+
+  if (_WCD_PROLOG)
+    file(APPEND "${file_arg}" "\n${_WCD_PROLOG}\n")
+  endif()
+
+  foreach(feature ${_WCD_FEATURES})
+    if (feature MATCHES "^cxx_")
+      list(APPEND _langs CXX)
+    endif()
+    if (feature MATCHES "^c_")
+      list(APPEND _langs C)
+    endif()
+  endforeach()
+  list(REMOVE_DUPLICATES _langs)
+
+  foreach(_lang ${_langs})
+
+    if(_lang STREQUAL CXX)
+      file(APPEND "${file_arg}" "\n#ifdef __cplusplus\n")
+    endif()
+
+    compiler_id_detection(ID_CONTENT ${_lang} PREFIX ${prefix_arg}_
+      ID_DEFINE
+    )
+
+    file(APPEND "${file_arg}" "${ID_CONTENT}\n")
+
+    set(pp_if "if")
+    foreach(compiler ${_WCD_COMPILERS})
+      _load_compiler_variables(${compiler} ${_lang} ${_WCD_FEATURES})
+      file(APPEND "${file_arg}" "\n#  ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
+      set(pp_if "elif")
+      foreach(feature ${_WCD_FEATURES})
+        list(FIND CMAKE_${_lang}_KNOWN_FEATURES ${feature} idx)
+        if (NOT idx EQUAL -1)
+          set(_define_item "\n#    define ${prefix_arg}_${CMAKE_PP_NAME_${feature}} 0\n")
+          if (_cmake_feature_test_${compiler}_${feature} STREQUAL "1")
+            set(_define_item "\n#    define ${prefix_arg}_${CMAKE_PP_NAME_${feature}} 1\n")
+          elseif (_cmake_feature_test_${compiler}_${feature})
+            set(_define_item "\n#      define ${prefix_arg}_${CMAKE_PP_NAME_${feature}} 0\n")
+            set(_define_item "\n#    if ${_cmake_feature_test_${compiler}_${feature}}\n#      define ${prefix_arg}_${CMAKE_PP_NAME_${feature}} 1\n#    else${_define_item}#    endif\n")
+          endif()
+          file(APPEND "${file_arg}" "${_define_item}")
+        endif()
+      endforeach()
+    endforeach()
+    if(pp_if STREQUAL "elif")
+      file(APPEND "${file_arg}" "\n#  else\n#  error Unsupported compiler\n#  endif\n\n")
+    endif()
+    foreach(feature ${_WCD_FEATURES})
+      set(def_value ${CMAKE_SYMBOL_DEFINE_${feature}})
+      if (def_value)
+        set(def_name ${prefix_arg}_${CMAKE_PP_DECL_${feature}})
+        file(APPEND "${file_arg}" "
+#  if ${prefix_arg}_${CMAKE_PP_NAME_${feature}}
+#    define ${def_name} ${def_value}
+#  else
+#    define ${def_name}
+#  endif
+\n")
+      endif()
+    endforeach()
+    foreach(feature ${_WCD_FEATURES})
+      if (feature STREQUAL cxx_static_assert)
+        set(def_name ${prefix_arg}_${CMAKE_PP_NAME_cxx_static_assert})
+        set(def_value "${prefix_arg}_STATIC_ASSERT(X)")
+        set(def_value_msg "${prefix_arg}_STATIC_ASSERT_MSG(X, MSG)")
+        set(static_assert_struct "template<bool> struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert<true>{};\n")
+        set(def_standard "#    define ${def_value} static_assert(X, #X)\n#    define ${def_value_msg} static_assert(X, MSG)")
+        set(def_alternative "${static_assert_struct}#    define ${def_value} sizeof(CMakeStaticAssert<X>)\n#    define ${def_value_msg} sizeof(CMakeStaticAssert<X>)")
+        file(APPEND "${file_arg}" "#  if ${def_name}\n${def_standard}\n#  else\n${def_alternative}\n#  endif\n\n")
+      endif()
+      if (feature STREQUAL cxx_alignas)
+        set(def_name ${prefix_arg}_${CMAKE_PP_NAME_${feature}})
+        set(def_value "${prefix_arg}_ALIGNAS(X)")
+        file(APPEND "${file_arg}" "
+#  if ${def_name}
+#    define ${def_value} alignas(X)
+#  elif ${prefix_arg}_COMPILER_IS_GNU
+#    define ${def_value} __attribute__ ((__aligned__(X)))
+#  else
+#    define ${def_value}
+#  endif
+\n")
+      endif()
+      if (feature STREQUAL cxx_alignof)
+        set(def_name ${prefix_arg}_${CMAKE_PP_NAME_${feature}})
+        set(def_value "${prefix_arg}_ALIGNOF(X)")
+        file(APPEND "${file_arg}" "
+#  if ${def_name}
+#    define ${def_value} alignof(X)
+#  elif ${prefix_arg}_COMPILER_IS_GNU
+#    define ${def_value} __alignof__(X)
+#  endif
+\n")
+      endif()
+      if (feature STREQUAL cxx_deleted_functions)
+        set(def_name ${prefix_arg}_${CMAKE_PP_NAME_${feature}})
+        set(def_value "${prefix_arg}_DELETED_FUNCTION")
+        file(APPEND "${file_arg}" "
+#  if ${def_name}
+#    define ${def_value} = delete
+#  else
+#    define ${def_value}
+#  endif
+
+#  define ${prefix_arg}_DISABLE_COPY(X) \\
+private: \\
+     X(X const&) ${prefix_arg}_DELETED_FUNCTION; \\
+     X& operator=(X const&) ${prefix_arg}_DELETED_FUNCTION;
+\n")
+      endif()
+      if (feature STREQUAL cxx_extern_templates)
+        set(def_name ${prefix_arg}_${CMAKE_PP_NAME_${feature}})
+        set(def_value "${prefix_arg}_EXTERN_TEMPLATE")
+        file(APPEND "${file_arg}" "
+#  if ${def_name}
+#    define ${def_value} extern
+#  else
+#    define ${def_value}
+#  endif
+\n")
+      endif()
+      if (feature STREQUAL cxx_noexcept)
+        set(def_name ${prefix_arg}_${CMAKE_PP_NAME_${feature}})
+        set(def_value "${prefix_arg}_NOEXCEPT")
+        file(APPEND "${file_arg}" "
+#  if ${def_name}
+#    define ${def_value} noexcept
+#    define ${def_value}_EXPR(X) noexcept(X)
+#  else
+#    define ${def_value}
+#    define ${def_value}_EXPR(X)
+#  endif
+\n")
+      endif()
+      if (feature STREQUAL cxx_nullptr)
+        set(def_name ${prefix_arg}_${CMAKE_PP_NAME_${feature}})
+        set(def_value "${prefix_arg}_NULLPTR")
+        file(APPEND "${file_arg}" "
+#  if ${def_name}
+#    define ${def_value} nullptr
+#  else
+#    define ${def_value} (void*)0
+#  endif
+\n")
+      endif()
+    endforeach()
+    if(_lang STREQUAL CXX)
+      file(APPEND "${file_arg}" "#endif\n")
+    endif()
+
+  endforeach()
+
+  if (_WCD_EPILOG)
+    file(APPEND "${file_arg}" "\n${_WCD_EPILOG}\n")
+  endif()
+
+  file(APPEND ${file_arg} "\n#endif\n")
+endfunction()
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e758720..b06e6a1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2505,6 +2505,33 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
     return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1;
 #undef STRING_LIST_ELEMENT
     }
+#define PP_FEATURE_NAME(F) \
+  if (name == "CMAKE_PP_NAME_" #F) \
+    { \
+    static std::string val = ("COMPILER_" + cmSystemTools::UpperCase(#F)); \
+    return val.c_str(); \
+    }
+  FOR_EACH_CXX_FEATURE(PP_FEATURE_NAME)
+#undef PP_FEATURE_NAME
+
+#define FOR_EACH_CXX_DECL_FEATURE(F) \
+  F(final) \
+  F(override) \
+  F(constexpr)
+
+#define PP_DECL_NAME(F) \
+  if (name == "CMAKE_PP_DECL_cxx_" #F) \
+    { \
+    static std::string val = ("DECL_CXX_" + cmSystemTools::UpperCase(#F)); \
+    return val.c_str(); \
+    } \
+  if (name == "CMAKE_SYMBOL_DEFINE_cxx_" #F) \
+    { \
+    return #F; \
+    }
+  FOR_EACH_CXX_DECL_FEATURE(PP_DECL_NAME)
+#undef PP_DECL_NAME
+
   const char* def = this->Internal->VarStack.top().Get(name);
   if(!def)
     {
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 9d642cc..fbad2d9 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -411,6 +411,8 @@ if(BUILD_TESTING)
   ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader)
   ADD_TEST_MACRO(Module.FindDependency FindDependency)
 
+  ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader)
+
   if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
     include(CheckCXXCompilerFlag)
     check_cxx_compiler_flag(-fPIE run_pic_test)
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
new file mode 100644
index 0000000..4cc3155
--- /dev/null
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -0,0 +1,69 @@
+cmake_minimum_required(VERSION 3.0.0)
+project(WriteCompilerDetectionHeader)
+
+if (NOT CMAKE_CXX_COMPILER_ID STREQUAL GNU)
+  file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp"
+    "int main(int,char**) { return 0; }\n"
+  )
+  add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp")
+  return()
+endif()
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+  FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h"
+  PREFIX TEST
+  COMPILERS GNU
+  VERSION 3.1
+  PROLOG "// something"
+  EPILOG "// more"
+  FEATURES
+    ${CMAKE_CXX_KNOWN_FEATURES}
+)
+
+macro(set_defines target true_defs false_defs)
+  set(defines)
+  foreach(def ${true_defs})
+    list(APPEND defines ${def}=1)
+  endforeach()
+  foreach(def ${false_defs})
+    list(APPEND defines ${def}=0)
+  endforeach()
+  target_compile_definitions(${target}
+    PRIVATE
+      ${defines}
+  )
+endmacro()
+
+if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
+  # False for C++98 mode.
+  list(APPEND false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
+  list(APPEND false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
+endif()
+
+add_executable(WriteCompilerDetectionHeader main.cpp)
+set_property(TARGET WriteCompilerDetectionHeader PROPERTY CXX_STANDARD 98)
+set_defines(WriteCompilerDetectionHeader "${true_defs}" "${false_defs}")
+
+if(MSVC)
+  return() # MSVC has only one mode.
+endif()
+
+# Since GNU 4.7
+if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;")
+  list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
+  list(REMOVE_ITEM false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
+endif()
+
+# Since GNU 4.4
+if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_variadic_templates;")
+  list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
+  list(REMOVE_ITEM false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
+endif()
+
+add_executable(WriteCompilerDetectionHeader_11 main.cpp)
+set_property(TARGET WriteCompilerDetectionHeader_11 PROPERTY CXX_STANDARD 11)
+set_defines(WriteCompilerDetectionHeader_11 "${true_defs}" "${false_defs}")
diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.cpp b/Tests/Module/WriteCompilerDetectionHeader/main.cpp
new file mode 100644
index 0000000..628d26b
--- /dev/null
+++ b/Tests/Module/WriteCompilerDetectionHeader/main.cpp
@@ -0,0 +1,19 @@
+
+#include "test_compiler_detection.h"
+
+#define JOIN_IMPL(A, B) A ## B
+#define JOIN(A, B) JOIN_IMPL(A, B)
+#define CHECK(FEATURE) (JOIN(TEST_COMPILER_, FEATURE) == JOIN(EXPECTED_COMPILER_, FEATURE))
+
+#if !CHECK(CXX_DELEGATING_CONSTRUCTORS)
+#error cxx_delegating_constructors expected availability did not match.
+#endif
+
+#if !CHECK(CXX_VARIADIC_TEMPLATES)
+#error cxx_variadic_templates expected availability did not match.
+#endif
+
+int main(int argc, char **argv)
+{
+  return 0;
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e797a73..7f6ebf1 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -54,6 +54,7 @@ add_RunCMake_test(TargetObjects)
 add_RunCMake_test(TargetSources)
 add_RunCMake_test(find_dependency)
 add_RunCMake_test(CompileFeatures)
+add_RunCMake_test(WriteCompilerDetectionHeader)
 if(NOT WIN32)
   add_RunCMake_test(PositionIndependentCode)
   set(SKIP_VISIBILITY 0)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMakeLists.txt
new file mode 100644
index 0000000..872338d
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-stderr.txt
new file mode 100644
index 0000000..62c4ff1
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\):
+  Unparsed arguments: GarbageArg
+Call Stack \(most recent call first\):
+  ExtraArgs.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs.cmake
new file mode 100644
index 0000000..c2a21af
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/ExtraArgs.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+  FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+  PREFIX Pref
+  GarbageArg
+  COMPILERS GNU
+  FEATURES cxx_final
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-stderr.txt
new file mode 100644
index 0000000..eb94426
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:164 \(message\):
+  write_compiler_detection_header: FILE parameter missing.
+Call Stack \(most recent call first\):
+  FileTypo.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo.cmake
new file mode 100644
index 0000000..c90eda2
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/FileTypo.cmake
@@ -0,0 +1,7 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+  FILE_TYPO "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+  PREFIX Pref
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-stderr.txt
new file mode 100644
index 0000000..b4d7e08
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at InvalidArgs.cmake:4 \(write_compiler_detection_header\):
+  write_compiler_detection_header Function invoked with incorrect arguments
+  for function named: write_compiler_detection_header
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
++
+CMake Error at InvalidArgs.cmake:6 \(write_compiler_detection_header\):
+  write_compiler_detection_header Function invoked with incorrect arguments
+  for function named: write_compiler_detection_header
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs.cmake
new file mode 100644
index 0000000..cfebae1
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidArgs.cmake
@@ -0,0 +1,6 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header()
+
+write_compiler_detection_header(FILE)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-stderr.txt
new file mode 100644
index 0000000..9451348
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\):
+  Invalid arguments.  write_compiler_detection_header requires at least one
+  compiler.
+Call Stack \(most recent call first\):
+  NoCompiler.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler.cmake
new file mode 100644
index 0000000..2dc14e9
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoCompiler.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+    FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+    PREFIX PREF_
+    # COMPILERS
+    FEATURES cxx_final
+    VERSION 3.1
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-stderr.txt
new file mode 100644
index 0000000..193f297
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\):
+  Invalid arguments.  write_compiler_detection_header requires at least one
+  feature.
+Call Stack \(most recent call first\):
+  NoFeature.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature.cmake
new file mode 100644
index 0000000..1fbc129
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/NoFeature.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+    FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+    PREFIX PREF_
+    COMPILERS GNU
+    # FEATURES
+    VERSION 3.1
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt
new file mode 100644
index 0000000..842eb3f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\):
+  VERSION parameter too low.
+Call Stack \(most recent call first\):
+  OldVersion.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion.cmake
new file mode 100644
index 0000000..a6e3022
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+  FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+  PREFIX Pref
+  VERSION 3.0
+  COMPILERS GNU
+  FEATURES cxx_final
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-stderr.txt
new file mode 100644
index 0000000..5fdcdb8
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\):
+  write_compiler_detection_header: PREFIX parameter missing.
+Call Stack \(most recent call first\):
+  PrefixTypo.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo.cmake
new file mode 100644
index 0000000..8b6774c
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/PrefixTypo.cmake
@@ -0,0 +1,7 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+  FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+  PREFIX_TYPO Pref
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake
new file mode 100644
index 0000000..ea1f658
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(InvalidArgs)
+run_cmake(NoCompiler)
+run_cmake(NoFeature)
+run_cmake(FileTypo)
+run_cmake(PrefixTypo)
+run_cmake(ExtraArgs)
+run_cmake(OldVersion)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ab0cab2c6ccf61764c8a7390489545b0ff73e0b
commit 9ab0cab2c6ccf61764c8a7390489545b0ff73e0b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 23 11:00:28 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 30 18:48:28 2014 +0200

    CompilerId: Allow specifying a prefix for preprocessor defines.

diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 9a1f4ec..aa35274 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -44,6 +44,7 @@ function(compiler_id_detection outvar lang)
     endforeach()
 
     set(options ID_STRING VERSION_STRINGS ID_DEFINE PLATFORM_DEFAULT_COMPILER)
+    set(oneValueArgs PREFIX)
     cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${ARGN})
     if (CID_UNPARSED_ARGUMENTS)
       message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
@@ -79,7 +80,7 @@ function(compiler_id_detection outvar lang)
 
     if(CID_ID_DEFINE)
       foreach(Id ${ordered_compilers})
-        set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}# define COMPILER_IS_${Id} 0\n")
+        set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n")
       endforeach()
     endif()
 
@@ -95,14 +96,16 @@ function(compiler_id_detection outvar lang)
       endif()
       set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n")
       if (CID_ID_STRING)
-        set(id_content "${id_content}# define COMPILER_ID \"${Id}\"")
+        set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"")
       endif()
       if (CID_ID_DEFINE)
-        set(id_content "${id_content}# undef COMPILER_IS_${Id}\n")
-        set(id_content "${id_content}# define COMPILER_IS_${Id} 1\n")
+        set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n")
+        set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_IS_${Id} 1\n")
       endif()
       if (CID_VERSION_STRINGS)
-        set(id_content "${id_content}${_compiler_id_version_compute_${Id}}\n")
+        set(PREFIX ${CID_PREFIX})
+        string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY)
+        set(id_content "${id_content}${VERSION_BLOCK}\n")
       endif()
       set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${id_content}")
       set(pp_if "#elif")
@@ -114,13 +117,13 @@ function(compiler_id_detection outvar lang)
   identification macro.  Try to identify the platform and guess that
   it is the native compiler.  */
 #elif defined(__sgi)
-# define COMPILER_ID \"MIPSpro\"
+# define ${CID_PREFIX}COMPILER_ID \"MIPSpro\"
 
 #elif defined(__hpux) || defined(__hpua)
-# define COMPILER_ID \"HP\"
+# define ${CID_PREFIX}COMPILER_ID \"HP\"
 
 #else /* unknown compiler */
-# define COMPILER_ID \"\"")
+# define ${CID_PREFIX}COMPILER_ID \"\"")
     endif()
 
     set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif")
diff --git a/Modules/Compiler/ADSP-CXX-DetermineCompiler.cmake b/Modules/Compiler/ADSP-CXX-DetermineCompiler.cmake
index fc0fd6e..0b5af0d 100644
--- a/Modules/Compiler/ADSP-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/ADSP-CXX-DetermineCompiler.cmake
@@ -4,7 +4,7 @@ set(_compiler_id_pp_test "defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFI
 set(_compiler_id_version_compute "
 #if defined(__VISUALDSPVERSION__)
   /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
-# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
-# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8  & 0xFF)
+# define @PREFIX at COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
+# define @PREFIX at COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
+# define @PREFIX at COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8  & 0xFF)
 #endif")
diff --git a/Modules/Compiler/AppleClang-CXX-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-CXX-DetermineCompiler.cmake
index 853fe14..14fff5a 100644
--- a/Modules/Compiler/AppleClang-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/AppleClang-CXX-DetermineCompiler.cmake
@@ -4,4 +4,4 @@ set(_compiler_id_pp_test "defined(__clang__) && defined(__apple_build_version__)
 include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-DetermineCompilerInternal.cmake")
 
 set(_compiler_id_version_compute "${_compiler_id_version_compute}
-# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)")
+# define @PREFIX at COMPILER_VERSION_TWEAK DEC(__apple_build_version__)")
diff --git a/Modules/Compiler/Borland-CXX-DetermineCompiler.cmake b/Modules/Compiler/Borland-CXX-DetermineCompiler.cmake
index 8b46830..2e8a948 100644
--- a/Modules/Compiler/Borland-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Borland-CXX-DetermineCompiler.cmake
@@ -3,5 +3,5 @@ set(_compiler_id_pp_test "defined(__BORLANDC__)")
 
 set(_compiler_id_version_compute "
   /* __BORLANDC__ = 0xVRR */
-# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
-# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)")
+# define @PREFIX at COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
+# define @PREFIX at COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)")
diff --git a/Modules/Compiler/Clang-CXX-DetermineCompilerInternal.cmake b/Modules/Compiler/Clang-CXX-DetermineCompilerInternal.cmake
index 615032d..9a37a63 100644
--- a/Modules/Compiler/Clang-CXX-DetermineCompilerInternal.cmake
+++ b/Modules/Compiler/Clang-CXX-DetermineCompilerInternal.cmake
@@ -1,11 +1,11 @@
 
 set(_compiler_id_version_compute "
-# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
-# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
-# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define @PREFIX at COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
 # if defined(_MSC_VER)
-#  define SIMULATE_ID \"MSVC\"
+#  define @PREFIX at SIMULATE_ID \"MSVC\"
    /* _MSC_VER = VVRR */
-#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+#  define @PREFIX at SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define @PREFIX at SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
 # endif")
diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
index 78f2671..e4def4d 100644
--- a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
@@ -3,5 +3,5 @@ set(_compiler_id_pp_test "defined(__COMO__)")
 
 set(_compiler_id_version_compute "
   /* __COMO_VERSION__ = VRR */
-# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)")
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)")
diff --git a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
index 2b09102..5855c24 100644
--- a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
@@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__DECCXX)")
 
 set(_compiler_id_version_compute "
   /* __DECCXX_VER = VVRRTPPPP */
-# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
-# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000  % 100)
-# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER         % 10000)")
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000  % 100)
+# define @PREFIX at COMPILER_VERSION_PATCH DEC(__DECCXX_VER         % 10000)")
diff --git a/Modules/Compiler/Cray-CXX-DetermineCompiler.cmake b/Modules/Compiler/Cray-CXX-DetermineCompiler.cmake
index cf55d2d..6e4eaf9 100644
--- a/Modules/Compiler/Cray-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Cray-CXX-DetermineCompiler.cmake
@@ -2,5 +2,5 @@
 set(_compiler_id_pp_test "defined(_CRAYC)")
 
 set(_compiler_id_version_compute "
-# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
-# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)")
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(_RELEASE)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)")
diff --git a/Modules/Compiler/Embarcadero-CXX-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-CXX-DetermineCompiler.cmake
index 4b85940..f52d79b 100644
--- a/Modules/Compiler/Embarcadero-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Embarcadero-CXX-DetermineCompiler.cmake
@@ -2,6 +2,6 @@
 set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)")
 
 set(_compiler_id_version_compute "
-# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
-# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
-# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__     & 0xFFFF)")
+# define @PREFIX at COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define @PREFIX at COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define @PREFIX at COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__     & 0xFFFF)")
diff --git a/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake b/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake
index abb19e7..f0c25dd 100644
--- a/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake
@@ -2,8 +2,8 @@
 set(_compiler_id_pp_test "defined(__GNUC__)")
 
 set(_compiler_id_version_compute "
-# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
-# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__GNUC__)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
 # if defined(__GNUC_PATCHLEVEL__)
-#  define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
 # endif")
diff --git a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
index 2506e06..6999492 100644
--- a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
@@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__HP_aCC)")
 
 set(_compiler_id_version_compute "
   /* __HP_aCC = VVRRPP */
-# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
-# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
-# define COMPILER_VERSION_PATCH DEC(__HP_aCC     % 100)")
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
+# define @PREFIX at COMPILER_VERSION_PATCH DEC(__HP_aCC     % 100)")
diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
index 9db0663..f673d72 100644
--- a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
+++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
@@ -1,6 +1,6 @@
 
 set(_compiler_id_version_compute "
   /* __IBMCPP__ = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
-# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)")
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+# define @PREFIX at COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)")
diff --git a/Modules/Compiler/Intel-CXX-DetermineCompiler.cmake b/Modules/Compiler/Intel-CXX-DetermineCompiler.cmake
index 6171ba9..6fada1c 100644
--- a/Modules/Compiler/Intel-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Intel-CXX-DetermineCompiler.cmake
@@ -3,20 +3,20 @@ set(_compiler_id_pp_test "defined(__INTEL_COMPILER) || defined(__ICC)")
 
 set(_compiler_id_version_compute "
   /* __INTEL_COMPILER = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
-# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
 # if defined(__INTEL_COMPILER_UPDATE)
-#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
 # else
-#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
 # endif
 # if defined(__INTEL_COMPILER_BUILD_DATE)
   /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
-#  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+#  define @PREFIX at COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
 # endif
 # if defined(_MSC_VER)
-#  define SIMULATE_ID \"MSVC\"
+#  define @PREFIX at SIMULATE_ID \"MSVC\"
    /* _MSC_VER = VVRR */
-#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+#  define @PREFIX at SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define @PREFIX at SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
 # endif")
diff --git a/Modules/Compiler/MIPSpro-CXX-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-CXX-DetermineCompiler.cmake
index 12cf1db..31eb345 100644
--- a/Modules/Compiler/MIPSpro-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/MIPSpro-CXX-DetermineCompiler.cmake
@@ -4,12 +4,12 @@ set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VE
 set(_compiler_id_version_compute "
 # if defined(_SGI_COMPILER_VERSION)
   /* _SGI_COMPILER_VERSION = VRP */
-#  define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
-#  define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
-#  define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION    % 10)
+#  define @PREFIX at COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
+#  define @PREFIX at COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION    % 10)
 # else
   /* _COMPILER_VERSION = VRP */
-#  define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
-#  define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
-#  define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
+#  define @PREFIX at COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
+#  define @PREFIX at COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
 # endif")
diff --git a/Modules/Compiler/MSVC-CXX-DetermineCompiler.cmake b/Modules/Compiler/MSVC-CXX-DetermineCompiler.cmake
index 342476a..d462d07 100644
--- a/Modules/Compiler/MSVC-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/MSVC-CXX-DetermineCompiler.cmake
@@ -3,17 +3,17 @@ set(_compiler_id_pp_test "defined(_MSC_VER)")
 
 set(_compiler_id_version_compute "
   /* _MSC_VER = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
 # if defined(_MSC_FULL_VER)
 #  if _MSC_VER >= 1400
     /* _MSC_FULL_VER = VVRRPPPPP */
-#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+#   define @PREFIX at COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
 #  else
     /* _MSC_FULL_VER = VVRRPPPP */
-#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+#   define @PREFIX at COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
 #  endif
 # endif
 # if defined(_MSC_BUILD)
-#  define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+#  define @PREFIX at COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
 # endif")
diff --git a/Modules/Compiler/OpenWatcom-CXX-DetermineCompiler.cmake b/Modules/Compiler/OpenWatcom-CXX-DetermineCompiler.cmake
index 97dd16c..6d416c1 100644
--- a/Modules/Compiler/OpenWatcom-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/OpenWatcom-CXX-DetermineCompiler.cmake
@@ -3,8 +3,8 @@ set(_compiler_id_pp_test "defined(__WATCOMC__)")
 
 set(_compiler_id_version_compute "
    /* __WATCOMC__ = VVRP + 1100 */
-# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
-# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
 # if (__WATCOMC__ % 10) > 0
-#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
 # endif")
diff --git a/Modules/Compiler/PGI-CXX-DetermineCompiler.cmake b/Modules/Compiler/PGI-CXX-DetermineCompiler.cmake
index 6647f15..8e68bd6 100644
--- a/Modules/Compiler/PGI-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/PGI-CXX-DetermineCompiler.cmake
@@ -2,8 +2,8 @@
 set(_compiler_id_pp_test "defined(__PGI)")
 
 set(_compiler_id_version_compute "
-# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
-# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
 # if defined(__PGIC_PATCHLEVEL__)
-#  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
 # endif")
diff --git a/Modules/Compiler/PathScale-CXX-DetermineCompiler.cmake b/Modules/Compiler/PathScale-CXX-DetermineCompiler.cmake
index 40199e6..3335e26 100644
--- a/Modules/Compiler/PathScale-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/PathScale-CXX-DetermineCompiler.cmake
@@ -2,8 +2,8 @@
 set(_compiler_id_pp_test "defined(__PATHCC__)")
 
 set(_compiler_id_version_compute "
-# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
 # if defined(__PATHCC_PATCHLEVEL__)
-#  define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
 # endif")
diff --git a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
index 044f0fa..0a48cc6 100644
--- a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
@@ -4,12 +4,12 @@ set(_compiler_id_pp_test "defined(__SUNPRO_CC)")
 set(_compiler_id_version_compute "
 # if __SUNPRO_CC >= 0x5100
    /* __SUNPRO_CC = 0xVRRP */
-#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
-#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
-#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
+#  define @PREFIX at COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
+#  define @PREFIX at COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
+#  define @PREFIX at COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
 # else
    /* __SUNPRO_CC = 0xVRP */
-#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
-#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
-#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
+#  define @PREFIX at COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
+#  define @PREFIX at COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
+#  define @PREFIX at COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
 # endif")
diff --git a/Modules/Compiler/TI-CXX-DetermineCompiler.cmake b/Modules/Compiler/TI-CXX-DetermineCompiler.cmake
index d05e5bd..1856c9b 100644
--- a/Modules/Compiler/TI-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/TI-CXX-DetermineCompiler.cmake
@@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__TI_COMPILER_VERSION__)")
 
 set(_compiler_id_version_compute "
   /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
-# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
-# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000   % 1000)
-# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__        % 1000)")
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000   % 1000)
+# define @PREFIX at COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__        % 1000)")
diff --git a/Modules/Compiler/Watcom-CXX-DetermineCompiler.cmake b/Modules/Compiler/Watcom-CXX-DetermineCompiler.cmake
index 2a08277..cc59abf 100644
--- a/Modules/Compiler/Watcom-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Watcom-CXX-DetermineCompiler.cmake
@@ -3,8 +3,8 @@ set(_compiler_id_pp_test "defined(__WATCOMC__) && __WATCOMC__ < 1200")
 
 set(_compiler_id_version_compute "
    /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# define @PREFIX at COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define @PREFIX at COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
 # if (__WATCOMC__ % 10) > 0
-#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+#  define @PREFIX at COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
 # endif")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=37ec7cdbe2434ae02480e712b5add3a77d51c8a3
commit 37ec7cdbe2434ae02480e712b5add3a77d51c8a3
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 23 12:10:04 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 30 18:48:28 2014 +0200

    CompilerId: Guard the platform-default compiler code with a parameter.

diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index b0e346c..9a1f4ec 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -43,7 +43,7 @@ function(compiler_id_detection outvar lang)
       _readFile(${file})
     endforeach()
 
-    set(options ID_STRING VERSION_STRINGS ID_DEFINE)
+    set(options ID_STRING VERSION_STRINGS ID_DEFINE PLATFORM_DEFAULT_COMPILER)
     cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${ARGN})
     if (CID_UNPARSED_ARGUMENTS)
       message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
@@ -108,7 +108,8 @@ function(compiler_id_detection outvar lang)
       set(pp_if "#elif")
     endforeach()
 
-    set(platform_compiler_detection "
+    if (CID_PLATFORM_DEFAULT_COMPILER)
+      set(platform_compiler_detection "
 /* These compilers are either not known or too old to define an
   identification macro.  Try to identify the platform and guess that
   it is the native compiler.  */
@@ -119,11 +120,10 @@ function(compiler_id_detection outvar lang)
 # define COMPILER_ID \"HP\"
 
 #else /* unknown compiler */
-# define COMPILER_ID \"\"
-
-#endif")
+# define COMPILER_ID \"\"")
+    endif()
 
-    set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${platform_compiler_detection}")
+    set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif")
   endif()
 
   set(${outvar} ${CMAKE_CXX_COMPILER_ID_CONTENT} PARENT_SCOPE)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 22e4439..cc246e1 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -108,6 +108,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
   compiler_id_detection(CMAKE_CXX_COMPILER_ID_CONTENT ${lang}
     ID_STRING
     VERSION_STRINGS
+    PLATFORM_DEFAULT_COMPILER
   )
 
   unset(src_in CACHE)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5db4e315808e0492c79cb74eddb0274673972b7f
commit 5db4e315808e0492c79cb74eddb0274673972b7f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 23 10:51:33 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 30 18:48:28 2014 +0200

    CompilerId: Add option to generate compiler-id-specific defines.

diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index cdf8ac1..b0e346c 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -43,7 +43,7 @@ function(compiler_id_detection outvar lang)
       _readFile(${file})
     endforeach()
 
-    set(options ID_STRING VERSION_STRINGS)
+    set(options ID_STRING VERSION_STRINGS ID_DEFINE)
     cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${ARGN})
     if (CID_UNPARSED_ARGUMENTS)
       message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
@@ -77,9 +77,15 @@ function(compiler_id_detection outvar lang)
       IAR
       MIPSpro)
 
+    if(CID_ID_DEFINE)
+      foreach(Id ${ordered_compilers})
+        set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}# define COMPILER_IS_${Id} 0\n")
+      endforeach()
+    endif()
+
     set(pp_if "#if")
     if (CID_VERSION_STRINGS)
-      set(CMAKE_CXX_COMPILER_ID_CONTENT "/* Version number components: V=Version, R=Revision, P=Patch
+      set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n/* Version number components: V=Version, R=Revision, P=Patch
    Version date components:   YYYY=Year, MM=Month,   DD=Day  */\n")
     endif()
 
@@ -91,6 +97,10 @@ function(compiler_id_detection outvar lang)
       if (CID_ID_STRING)
         set(id_content "${id_content}# define COMPILER_ID \"${Id}\"")
       endif()
+      if (CID_ID_DEFINE)
+        set(id_content "${id_content}# undef COMPILER_IS_${Id}\n")
+        set(id_content "${id_content}# define COMPILER_IS_${Id} 1\n")
+      endif()
       if (CID_VERSION_STRINGS)
         set(id_content "${id_content}${_compiler_id_version_compute_${Id}}\n")
       endif()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65a7046fa27b091a3401977221f25e0590eacf4a
commit 65a7046fa27b091a3401977221f25e0590eacf4a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 23 10:46:47 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 30 18:48:28 2014 +0200

    CompilerId: Allow specifying the compiler-specific components to generate.

diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 56508aa..cdf8ac1 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -31,6 +31,8 @@ function(_readFile file)
   set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
 endfunction()
 
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+
 function(compiler_id_detection outvar lang)
 
   file(GLOB files
@@ -41,6 +43,12 @@ function(compiler_id_detection outvar lang)
       _readFile(${file})
     endforeach()
 
+    set(options ID_STRING VERSION_STRINGS)
+    cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${ARGN})
+    if (CID_UNPARSED_ARGUMENTS)
+      message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
+    endif()
+
     set(ordered_compilers
       # Order is relevant here. For example, compilers which pretend to be
       # GCC must appear before the actual GCC.
@@ -70,14 +78,22 @@ function(compiler_id_detection outvar lang)
       MIPSpro)
 
     set(pp_if "#if")
-    set(CMAKE_CXX_COMPILER_ID_CONTENT "/* Version number components: V=Version, R=Revision, P=Patch
+    if (CID_VERSION_STRINGS)
+      set(CMAKE_CXX_COMPILER_ID_CONTENT "/* Version number components: V=Version, R=Revision, P=Patch
    Version date components:   YYYY=Year, MM=Month,   DD=Day  */\n")
+    endif()
 
     foreach(Id ${ordered_compilers})
       if (NOT _compiler_id_pp_test_${Id})
         message(FATAL_ERROR "No preprocessor test for \"${Id}\"")
       endif()
-      set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n# define COMPILER_ID \"${Id}\"${_compiler_id_version_compute_${Id}}\n")
+      set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n")
+      if (CID_ID_STRING)
+        set(id_content "${id_content}# define COMPILER_ID \"${Id}\"")
+      endif()
+      if (CID_VERSION_STRINGS)
+        set(id_content "${id_content}${_compiler_id_version_compute_${Id}}\n")
+      endif()
       set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${id_content}")
       set(pp_if "#elif")
     endforeach()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index dfed249..22e4439 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -105,7 +105,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
   find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
   file(READ ${src_in} ID_CONTENT_IN)
 
-  compiler_id_detection(CMAKE_CXX_COMPILER_ID_CONTENT ${lang})
+  compiler_id_detection(CMAKE_CXX_COMPILER_ID_CONTENT ${lang}
+    ID_STRING
+    VERSION_STRINGS
+  )
 
   unset(src_in CACHE)
   string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0f8c612fa5a56dec83502d5cc8788aadb0e5766
commit b0f8c612fa5a56dec83502d5cc8788aadb0e5766
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 23 10:33:16 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 30 18:48:28 2014 +0200

    Project: Split the compiler id detection into a separate function.
    
    This can be extended with parameters to control the output and re-used
    in other contexts.

diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
new file mode 100644
index 0000000..56508aa
--- /dev/null
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -0,0 +1,104 @@
+#.rst:
+# CMakeCompilerIdDetection
+# ------------------------
+#
+# This module provides the function compiler_id_detection().
+#
+# The ``COMPILER_ID_DETECTION`` function can be used to generate
+# a string of preprocessor code for compiler detection.
+#
+# This is for internal use only.
+
+
+#=============================================================================
+# Copyright 2014 Stephen Kelly <steveire at gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+function(_readFile file)
+  include(${file})
+  get_filename_component(name ${file} NAME_WE)
+  string(REGEX REPLACE "-.*" "" CompilerId ${name})
+  set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
+  set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
+endfunction()
+
+function(compiler_id_detection outvar lang)
+
+  file(GLOB files
+    "${CMAKE_ROOT}/Modules/Compiler/*-${lang}-DetermineCompiler.cmake")
+
+  if (files)
+    foreach(file ${files})
+      _readFile(${file})
+    endforeach()
+
+    set(ordered_compilers
+      # Order is relevant here. For example, compilers which pretend to be
+      # GCC must appear before the actual GCC.
+      Comeau
+      Intel
+      PathScale
+      AppleClang
+      Clang
+      Embarcadero
+      Borland
+      Watcom
+      OpenWatcom
+      SunPro
+      HP
+      Compaq
+      zOS
+      XL
+      VisualAge
+      PGI
+      Cray
+      TI
+      SCO
+      GNU
+      MSVC
+      ADSP
+      IAR
+      MIPSpro)
+
+    set(pp_if "#if")
+    set(CMAKE_CXX_COMPILER_ID_CONTENT "/* Version number components: V=Version, R=Revision, P=Patch
+   Version date components:   YYYY=Year, MM=Month,   DD=Day  */\n")
+
+    foreach(Id ${ordered_compilers})
+      if (NOT _compiler_id_pp_test_${Id})
+        message(FATAL_ERROR "No preprocessor test for \"${Id}\"")
+      endif()
+      set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n# define COMPILER_ID \"${Id}\"${_compiler_id_version_compute_${Id}}\n")
+      set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${id_content}")
+      set(pp_if "#elif")
+    endforeach()
+
+    set(platform_compiler_detection "
+/* These compilers are either not known or too old to define an
+  identification macro.  Try to identify the platform and guess that
+  it is the native compiler.  */
+#elif defined(__sgi)
+# define COMPILER_ID \"MIPSpro\"
+
+#elif defined(__hpux) || defined(__hpua)
+# define COMPILER_ID \"HP\"
+
+#else /* unknown compiler */
+# define COMPILER_ID \"\"
+
+#endif")
+
+    set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${platform_compiler_detection}")
+  endif()
+
+  set(${outvar} ${CMAKE_CXX_COMPILER_ID_CONTENT} PARENT_SCOPE)
+endfunction()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index b21ddfe..dfed249 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -97,13 +97,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
   set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
 endfunction()
 
-function(_readFile file)
-  include(${file})
-  get_filename_component(name ${file} NAME_WE)
-  string(REGEX REPLACE "-.*" "" CompilerId ${name})
-  set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
-  set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
-endfunction()
+include(CMakeCompilerIdDetection)
 
 #-----------------------------------------------------------------------------
 # Function to write the compiler id source file.
@@ -111,67 +105,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
   find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
   file(READ ${src_in} ID_CONTENT_IN)
 
-  file(GLOB files
-    "${CMAKE_ROOT}/Modules/Compiler/*-${lang}-DetermineCompiler.cmake")
-
-  if (files)
-    foreach(file ${files})
-      _readFile(${file})
-    endforeach()
-    set(pp_if "#if")
-    set(CMAKE_CXX_COMPILER_ID_CONTENT "/* Version number components: V=Version, R=Revision, P=Patch
-   Version date components:   YYYY=Year, MM=Month,   DD=Day  */\n")
-
-    foreach(Id
-        Comeau
-        Intel
-        PathScale
-        AppleClang
-        Clang
-        Embarcadero
-        Borland
-        Watcom
-        OpenWatcom
-        SunPro
-        HP
-        Compaq
-        zOS
-        XL
-        VisualAge
-        PGI
-        Cray
-        TI
-        SCO
-        GNU
-        MSVC
-        ADSP
-        IAR
-        MIPSpro)
-      if (NOT _compiler_id_pp_test_${Id})
-        message(FATAL_ERROR "No test for \"${Id}\"")
-      endif()
-      set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n# define COMPILER_ID \"${Id}\"${_compiler_id_version_compute_${Id}}\n")
-      set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${id_content}")
-      set(pp_if "#elif")
-    endforeach()
-
-    set(platform_compiler_detection "
-/* These compilers are either not known or too old to define an
-  identification macro.  Try to identify the platform and guess that
-  it is the native compiler.  */
-#elif defined(__sgi)
-# define COMPILER_ID \"MIPSpro\"
-
-#elif defined(__hpux) || defined(__hpua)
-# define COMPILER_ID \"HP\"
-
-#else /* unknown compiler */
-# define COMPILER_ID \"\"
-
-#endif")
-
-    set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${platform_compiler_detection}")
-  endif()
+  compiler_id_detection(CMAKE_CXX_COMPILER_ID_CONTENT ${lang})
 
   unset(src_in CACHE)
   string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a6e962c1bbdb0c3b7469b7e553c405a24582c4c
commit 4a6e962c1bbdb0c3b7469b7e553c405a24582c4c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Apr 22 16:34:47 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 30 18:48:28 2014 +0200

    Project: Generate the CXX compiler Id test from multiple files.
    
    This will allow sharing of the logic of the order to test compilers in
    and the preprocessor macros used to do that and to determine the
    version components.

diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index f7ad80e..9ece26d 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -5,224 +5,7 @@
 # error "A C compiler has been selected for C++."
 #endif
 
-/* Version number components: V=Version, R=Revision, P=Patch
-   Version date components:   YYYY=Year, MM=Month,   DD=Day  */
-
-#if defined(__COMO__)
-# define COMPILER_ID "Comeau"
-  /* __COMO_VERSION__ = VRR */
-# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
-
-#elif defined(__INTEL_COMPILER) || defined(__ICC)
-# define COMPILER_ID "Intel"
-  /* __INTEL_COMPILER = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
-# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
-# if defined(__INTEL_COMPILER_UPDATE)
-#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
-# else
-#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
-# endif
-# if defined(__INTEL_COMPILER_BUILD_DATE)
-  /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
-#  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
-# endif
-# if defined(_MSC_VER)
-#  define SIMULATE_ID "MSVC"
-   /* _MSC_VER = VVRR */
-#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
-# endif
-
-#elif defined(__PATHCC__)
-# define COMPILER_ID "PathScale"
-# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
-# if defined(__PATHCC_PATCHLEVEL__)
-#  define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
-# endif
-
-#elif defined(__clang__)
-# if defined(__apple_build_version__)
-#  define COMPILER_ID "AppleClang"
-#  define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
-# else
-#  define COMPILER_ID "Clang"
-# endif
-# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
-# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
-# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
-# if defined(_MSC_VER)
-#  define SIMULATE_ID "MSVC"
-   /* _MSC_VER = VVRR */
-#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
-# endif
-
-#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
-# define COMPILER_ID "Embarcadero"
-# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
-# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
-# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__     & 0xFFFF)
-
-#elif defined(__BORLANDC__)
-# define COMPILER_ID "Borland"
-  /* __BORLANDC__ = 0xVRR */
-# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
-# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
-
-#elif defined(__WATCOMC__)
-# if __WATCOMC__ < 1200
-#  define COMPILER_ID "Watcom"
-   /* __WATCOMC__ = VVRP */
-#  define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# else
-#  define COMPILER_ID "OpenWatcom"
-   /* __WATCOMC__ = VVRP + 1100 */
-#  define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
-# endif
-# define COMPILER_VERSION_MINOR  DEC((__WATCOMC__ / 10) % 10)
-# if (__WATCOMC__ % 10) > 0
-#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
-# endif
-
-#elif defined(__SUNPRO_CC)
-# define COMPILER_ID "SunPro"
-# if __SUNPRO_CC >= 0x5100
-   /* __SUNPRO_CC = 0xVRRP */
-#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
-#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
-#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
-# else
-   /* __SUNPRO_CC = 0xVRP */
-#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
-#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
-#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
-# endif
-
-#elif defined(__HP_aCC)
-# define COMPILER_ID "HP"
-  /* __HP_aCC = VVRRPP */
-# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
-# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
-# define COMPILER_VERSION_PATCH DEC(__HP_aCC     % 100)
-
-#elif defined(__DECCXX)
-# define COMPILER_ID "Compaq"
-  /* __DECCXX_VER = VVRRTPPPP */
-# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
-# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000  % 100)
-# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER         % 10000)
-
-#elif defined(__IBMCPP__)
-# if defined(__COMPILER_VER__)
-#  define COMPILER_ID "zOS"
-# else
-#  if __IBMCPP__ >= 800
-#   define COMPILER_ID "XL"
-#  else
-#   define COMPILER_ID "VisualAge"
-#  endif
-   /* __IBMCPP__ = VRP */
-#  define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
-#  define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
-#  define COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)
-# endif
-
-#elif defined(__PGI)
-# define COMPILER_ID "PGI"
-# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
-# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
-# if defined(__PGIC_PATCHLEVEL__)
-#  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
-# endif
-
-#elif defined(_CRAYC)
-# define COMPILER_ID "Cray"
-# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
-# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
-
-#elif defined(__TI_COMPILER_VERSION__)
-# define COMPILER_ID "TI"
-  /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
-# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
-# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000   % 1000)
-# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__        % 1000)
-
-#elif defined(__SCO_VERSION__)
-# define COMPILER_ID "SCO"
-
-#elif defined(__GNUC__)
-# define COMPILER_ID "GNU"
-# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
-# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
-# if defined(__GNUC_PATCHLEVEL__)
-#  define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
-# endif
-
-#elif defined(_MSC_VER)
-# define COMPILER_ID "MSVC"
-  /* _MSC_VER = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
-# if defined(_MSC_FULL_VER)
-#  if _MSC_VER >= 1400
-    /* _MSC_FULL_VER = VVRRPPPPP */
-#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
-#  else
-    /* _MSC_FULL_VER = VVRRPPPP */
-#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
-#  endif
-# endif
-# if defined(_MSC_BUILD)
-#  define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
-# endif
-
-/* Analog VisualDSP++ >= 4.5.6 */
-#elif defined(__VISUALDSPVERSION__)
-# define COMPILER_ID "ADSP"
-  /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
-# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
-# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8  & 0xFF)
-
-/* Analog VisualDSP++ < 4.5.6 */
-#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
-# define COMPILER_ID "ADSP"
-
-/* IAR Systems compiler for embedded systems.
-   http://www.iar.com */
-#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
-# define COMPILER_ID "IAR"
-
-#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
-# define COMPILER_ID "MIPSpro"
-# if defined(_SGI_COMPILER_VERSION)
-  /* _SGI_COMPILER_VERSION = VRP */
-#  define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
-#  define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
-#  define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION    % 10)
-# else
-  /* _COMPILER_VERSION = VRP */
-#  define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
-#  define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
-#  define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
-# endif
-
-/* These compilers are either not known or too old to define an
-   identification macro.  Try to identify the platform and guess that
-   it is the native compiler.  */
-#elif defined(__sgi)
-# define COMPILER_ID "MIPSpro"
-
-#elif defined(__hpux) || defined(__hpua)
-# define COMPILER_ID "HP"
-
-#else /* unknown compiler */
-# define COMPILER_ID ""
-
-#endif
+ at CMAKE_CXX_COMPILER_ID_CONTENT@
 
 /* Construct the string literal in pieces to prevent the source from
    getting matched.  Store it in a pointer rather than an array
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 17f27b3..b21ddfe 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -97,11 +97,82 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
   set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
 endfunction()
 
+function(_readFile file)
+  include(${file})
+  get_filename_component(name ${file} NAME_WE)
+  string(REGEX REPLACE "-.*" "" CompilerId ${name})
+  set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
+  set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
+endfunction()
+
 #-----------------------------------------------------------------------------
 # Function to write the compiler id source file.
 function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
   find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
   file(READ ${src_in} ID_CONTENT_IN)
+
+  file(GLOB files
+    "${CMAKE_ROOT}/Modules/Compiler/*-${lang}-DetermineCompiler.cmake")
+
+  if (files)
+    foreach(file ${files})
+      _readFile(${file})
+    endforeach()
+    set(pp_if "#if")
+    set(CMAKE_CXX_COMPILER_ID_CONTENT "/* Version number components: V=Version, R=Revision, P=Patch
+   Version date components:   YYYY=Year, MM=Month,   DD=Day  */\n")
+
+    foreach(Id
+        Comeau
+        Intel
+        PathScale
+        AppleClang
+        Clang
+        Embarcadero
+        Borland
+        Watcom
+        OpenWatcom
+        SunPro
+        HP
+        Compaq
+        zOS
+        XL
+        VisualAge
+        PGI
+        Cray
+        TI
+        SCO
+        GNU
+        MSVC
+        ADSP
+        IAR
+        MIPSpro)
+      if (NOT _compiler_id_pp_test_${Id})
+        message(FATAL_ERROR "No test for \"${Id}\"")
+      endif()
+      set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n# define COMPILER_ID \"${Id}\"${_compiler_id_version_compute_${Id}}\n")
+      set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${id_content}")
+      set(pp_if "#elif")
+    endforeach()
+
+    set(platform_compiler_detection "
+/* These compilers are either not known or too old to define an
+  identification macro.  Try to identify the platform and guess that
+  it is the native compiler.  */
+#elif defined(__sgi)
+# define COMPILER_ID \"MIPSpro\"
+
+#elif defined(__hpux) || defined(__hpua)
+# define COMPILER_ID \"HP\"
+
+#else /* unknown compiler */
+# define COMPILER_ID \"\"
+
+#endif")
+
+    set(CMAKE_CXX_COMPILER_ID_CONTENT "${CMAKE_CXX_COMPILER_ID_CONTENT}\n${platform_compiler_detection}")
+  endif()
+
   unset(src_in CACHE)
   string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)
   file(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}")
diff --git a/Modules/Compiler/ADSP-CXX-DetermineCompiler.cmake b/Modules/Compiler/ADSP-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..fc0fd6e
--- /dev/null
+++ b/Modules/Compiler/ADSP-CXX-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)")
+
+set(_compiler_id_version_compute "
+#if defined(__VISUALDSPVERSION__)
+  /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
+# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
+# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
+# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8  & 0xFF)
+#endif")
diff --git a/Modules/Compiler/AppleClang-CXX-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..853fe14
--- /dev/null
+++ b/Modules/Compiler/AppleClang-CXX-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__clang__) && defined(__apple_build_version__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-DetermineCompilerInternal.cmake")
+
+set(_compiler_id_version_compute "${_compiler_id_version_compute}
+# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)")
diff --git a/Modules/Compiler/Borland-CXX-DetermineCompiler.cmake b/Modules/Compiler/Borland-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..8b46830
--- /dev/null
+++ b/Modules/Compiler/Borland-CXX-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__BORLANDC__)")
+
+set(_compiler_id_version_compute "
+  /* __BORLANDC__ = 0xVRR */
+# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
+# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)")
diff --git a/Modules/Compiler/Clang-CXX-DetermineCompiler.cmake b/Modules/Compiler/Clang-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..a28d083
--- /dev/null
+++ b/Modules/Compiler/Clang-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__clang__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-DetermineCompilerInternal.cmake")
diff --git a/Modules/Compiler/Clang-CXX-DetermineCompilerInternal.cmake b/Modules/Compiler/Clang-CXX-DetermineCompilerInternal.cmake
new file mode 100644
index 0000000..615032d
--- /dev/null
+++ b/Modules/Compiler/Clang-CXX-DetermineCompilerInternal.cmake
@@ -0,0 +1,11 @@
+
+set(_compiler_id_version_compute "
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+#  define SIMULATE_ID \"MSVC\"
+   /* _MSC_VER = VVRR */
+#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif")
diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..78f2671
--- /dev/null
+++ b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__COMO__)")
+
+set(_compiler_id_version_compute "
+  /* __COMO_VERSION__ = VRR */
+# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
+# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)")
diff --git a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..2b09102
--- /dev/null
+++ b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__DECCXX)")
+
+set(_compiler_id_version_compute "
+  /* __DECCXX_VER = VVRRTPPPP */
+# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
+# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000  % 100)
+# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER         % 10000)")
diff --git a/Modules/Compiler/Cray-CXX-DetermineCompiler.cmake b/Modules/Compiler/Cray-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..cf55d2d
--- /dev/null
+++ b/Modules/Compiler/Cray-CXX-DetermineCompiler.cmake
@@ -0,0 +1,6 @@
+
+set(_compiler_id_pp_test "defined(_CRAYC)")
+
+set(_compiler_id_version_compute "
+# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
+# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)")
diff --git a/Modules/Compiler/Embarcadero-CXX-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..4b85940
--- /dev/null
+++ b/Modules/Compiler/Embarcadero-CXX-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)")
+
+set(_compiler_id_version_compute "
+# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__     & 0xFFFF)")
diff --git a/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake b/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..abb19e7
--- /dev/null
+++ b/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__GNUC__)")
+
+set(_compiler_id_version_compute "
+# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
+# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
+# if defined(__GNUC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..2506e06
--- /dev/null
+++ b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__HP_aCC)")
+
+set(_compiler_id_version_compute "
+  /* __HP_aCC = VVRRPP */
+# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
+# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
+# define COMPILER_VERSION_PATCH DEC(__HP_aCC     % 100)")
diff --git a/Modules/Compiler/IAR-CXX-DetermineCompiler.cmake b/Modules/Compiler/IAR-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..c39810a
--- /dev/null
+++ b/Modules/Compiler/IAR-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+# IAR Systems compiler for embedded systems.
+#   http://www.iar.com
+set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)")
diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
new file mode 100644
index 0000000..9db0663
--- /dev/null
+++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
@@ -0,0 +1,6 @@
+
+set(_compiler_id_version_compute "
+  /* __IBMCPP__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)")
diff --git a/Modules/Compiler/Intel-CXX-DetermineCompiler.cmake b/Modules/Compiler/Intel-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..6171ba9
--- /dev/null
+++ b/Modules/Compiler/Intel-CXX-DetermineCompiler.cmake
@@ -0,0 +1,22 @@
+
+set(_compiler_id_pp_test "defined(__INTEL_COMPILER) || defined(__ICC)")
+
+set(_compiler_id_version_compute "
+  /* __INTEL_COMPILER = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# if defined(__INTEL_COMPILER_UPDATE)
+#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+# else
+#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
+# endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+  /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
+#  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+# endif
+# if defined(_MSC_VER)
+#  define SIMULATE_ID \"MSVC\"
+   /* _MSC_VER = VVRR */
+#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif")
diff --git a/Modules/Compiler/MIPSpro-CXX-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..12cf1db
--- /dev/null
+++ b/Modules/Compiler/MIPSpro-CXX-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)")
+
+set(_compiler_id_version_compute "
+# if defined(_SGI_COMPILER_VERSION)
+  /* _SGI_COMPILER_VERSION = VRP */
+#  define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
+#  define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION    % 10)
+# else
+  /* _COMPILER_VERSION = VRP */
+#  define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
+#  define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
+# endif")
diff --git a/Modules/Compiler/MSVC-CXX-DetermineCompiler.cmake b/Modules/Compiler/MSVC-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..342476a
--- /dev/null
+++ b/Modules/Compiler/MSVC-CXX-DetermineCompiler.cmake
@@ -0,0 +1,19 @@
+
+set(_compiler_id_pp_test "defined(_MSC_VER)")
+
+set(_compiler_id_version_compute "
+  /* _MSC_VER = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+#  if _MSC_VER >= 1400
+    /* _MSC_FULL_VER = VVRRPPPPP */
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+#  else
+    /* _MSC_FULL_VER = VVRRPPPP */
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+#  endif
+# endif
+# if defined(_MSC_BUILD)
+#  define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+# endif")
diff --git a/Modules/Compiler/OpenWatcom-CXX-DetermineCompiler.cmake b/Modules/Compiler/OpenWatcom-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..97dd16c
--- /dev/null
+++ b/Modules/Compiler/OpenWatcom-CXX-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__WATCOMC__)")
+
+set(_compiler_id_version_compute "
+   /* __WATCOMC__ = VVRP + 1100 */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif")
diff --git a/Modules/Compiler/PGI-CXX-DetermineCompiler.cmake b/Modules/Compiler/PGI-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..6647f15
--- /dev/null
+++ b/Modules/Compiler/PGI-CXX-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__PGI)")
+
+set(_compiler_id_version_compute "
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/PathScale-CXX-DetermineCompiler.cmake b/Modules/Compiler/PathScale-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..40199e6
--- /dev/null
+++ b/Modules/Compiler/PathScale-CXX-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__PATHCC__)")
+
+set(_compiler_id_version_compute "
+# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/SCO-CXX-DetermineCompiler.cmake b/Modules/Compiler/SCO-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..a44b22b
--- /dev/null
+++ b/Modules/Compiler/SCO-CXX-DetermineCompiler.cmake
@@ -0,0 +1,2 @@
+
+set(_compiler_id_pp_test "defined(__SCO_VERSION__)")
diff --git a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..044f0fa
--- /dev/null
+++ b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(__SUNPRO_CC)")
+
+set(_compiler_id_version_compute "
+# if __SUNPRO_CC >= 0x5100
+   /* __SUNPRO_CC = 0xVRRP */
+#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
+#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
+#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
+# else
+   /* __SUNPRO_CC = 0xVRP */
+#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
+#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
+#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
+# endif")
diff --git a/Modules/Compiler/TI-CXX-DetermineCompiler.cmake b/Modules/Compiler/TI-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..d05e5bd
--- /dev/null
+++ b/Modules/Compiler/TI-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__TI_COMPILER_VERSION__)")
+
+set(_compiler_id_version_compute "
+  /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
+# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
+# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000   % 1000)
+# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__        % 1000)")
diff --git a/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake b/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..cd53499
--- /dev/null
+++ b/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/Watcom-CXX-DetermineCompiler.cmake b/Modules/Compiler/Watcom-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..2a08277
--- /dev/null
+++ b/Modules/Compiler/Watcom-CXX-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__WATCOMC__) && __WATCOMC__ < 1200")
+
+set(_compiler_id_version_compute "
+   /* __WATCOMC__ = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif")
diff --git a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..dffa4bc
--- /dev/null
+++ b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake b/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..a08ff57
--- /dev/null
+++ b/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && defined(__COMPILER_VER__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66d424e5a43e04f35e2b8d0ed9959188b443b76e
commit 66d424e5a43e04f35e2b8d0ed9959188b443b76e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Apr 22 16:38:31 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 30 18:48:28 2014 +0200

    Project: Clarify comment about platform-native compilers.

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 16e19cd..78d7c47 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -217,7 +217,7 @@
 #  define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
 # endif
 
-/* This compiler is either not known or is too old to define an
+/* These compilers are either not known or too old to define an
    identification macro.  Try to identify the platform and guess that
    it is the native compiler.  */
 #elif defined(__sgi)
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index d81df77..f7ad80e 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -210,7 +210,7 @@
 #  define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
 # endif
 
-/* This compiler is either not known or is too old to define an
+/* These compilers are either not known or too old to define an
    identification macro.  Try to identify the platform and guess that
    it is the native compiler.  */
 #elif defined(__sgi)

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list