diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-04-23 08:51:33 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-05-07 12:00:00 (GMT) |
commit | 30a99f5c063d1d66a40b57554a7beec5d8fbf54c (patch) | |
tree | 8e7cb538b27031a52a187e0abd1ee917dc93741d /Modules | |
parent | 36ed5894840f40f6859710d44be607c929e5d38c (diff) | |
download | CMake-30a99f5c063d1d66a40b57554a7beec5d8fbf54c.zip CMake-30a99f5c063d1d66a40b57554a7beec5d8fbf54c.tar.gz CMake-30a99f5c063d1d66a40b57554a7beec5d8fbf54c.tar.bz2 |
CompilerId: Add option to generate compiler-id-specific defines.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeCompilerIdDetection.cmake | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 5df525f..4316c41 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -38,7 +38,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}\"") @@ -72,9 +72,15 @@ function(compiler_id_detection outvar lang) IAR MIPSpro) + if(CID_ID_DEFINE) + foreach(Id ${ordered_compilers}) + set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}# define COMPILER_IS_${Id} 0\n") + endforeach() + endif() + set(pp_if "#if") if (CID_VERSION_STRINGS) - set(CMAKE_${lang}_COMPILER_ID_CONTENT "/* Version number components: V=Version, R=Revision, P=Patch + set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n/* Version number components: V=Version, R=Revision, P=Patch Version date components: YYYY=Year, MM=Month, DD=Day */\n") endif() @@ -86,6 +92,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() |