diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-04-23 12:10:04 +0200 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-05-07 14:00:00 +0200 |
commit | 23f451bb33c384d19ec29934b2811e081ff3e685 (patch) | |
tree | 3f4630f6bd0868b88b8dc19a81557d5d8e2caaf0 | |
parent | 30a99f5c063d1d66a40b57554a7beec5d8fbf54c (diff) | |
download | cmake-23f451bb33c384d19ec29934b2811e081ff3e685.tar.gz |
CompilerId: Guard the platform-default compiler code with a parameter.
-rw-r--r-- | Modules/CMakeCompilerIdDetection.cmake | 12 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 1 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 4316c41610..13e420c173 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 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}\"") @@ -103,7 +103,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. */ @@ -114,11 +115,10 @@ function(compiler_id_detection outvar lang) # define COMPILER_ID \"HP\" #else /* unknown compiler */ -# define COMPILER_ID \"\" - -#endif") +# define COMPILER_ID \"\"") + endif() - set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}") + set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif") endif() set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 712b7488b9..025d296560 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_${lang}_COMPILER_ID_CONTENT ${lang} ID_STRING VERSION_STRINGS + PLATFORM_DEFAULT_COMPILER ) unset(src_in CACHE) |