CompilerId: Guard the platform-default compiler code with a parameter.
This commit is contained in:
parent
30a99f5c06
commit
23f451bb33
|
@ -38,7 +38,7 @@ function(compiler_id_detection outvar lang)
|
||||||
_readFile(${file})
|
_readFile(${file})
|
||||||
endforeach()
|
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})
|
cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
if (CID_UNPARSED_ARGUMENTS)
|
if (CID_UNPARSED_ARGUMENTS)
|
||||||
message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
|
message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
|
||||||
|
@ -103,6 +103,7 @@ function(compiler_id_detection outvar lang)
|
||||||
set(pp_if "#elif")
|
set(pp_if "#elif")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
if (CID_PLATFORM_DEFAULT_COMPILER)
|
||||||
set(platform_compiler_detection "
|
set(platform_compiler_detection "
|
||||||
/* These compilers are either not known or 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
|
identification macro. Try to identify the platform and guess that
|
||||||
|
@ -114,11 +115,10 @@ function(compiler_id_detection outvar lang)
|
||||||
# define COMPILER_ID \"HP\"
|
# define COMPILER_ID \"HP\"
|
||||||
|
|
||||||
#else /* unknown compiler */
|
#else /* unknown compiler */
|
||||||
# define COMPILER_ID \"\"
|
# define COMPILER_ID \"\"")
|
||||||
|
endif()
|
||||||
|
|
||||||
#endif")
|
set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif")
|
||||||
|
|
||||||
set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE)
|
set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE)
|
||||||
|
|
|
@ -108,6 +108,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
|
||||||
compiler_id_detection(CMAKE_${lang}_COMPILER_ID_CONTENT ${lang}
|
compiler_id_detection(CMAKE_${lang}_COMPILER_ID_CONTENT ${lang}
|
||||||
ID_STRING
|
ID_STRING
|
||||||
VERSION_STRINGS
|
VERSION_STRINGS
|
||||||
|
PLATFORM_DEFAULT_COMPILER
|
||||||
)
|
)
|
||||||
|
|
||||||
unset(src_in CACHE)
|
unset(src_in CACHE)
|
||||||
|
|
Loading…
Reference in New Issue