CompilerId: Add option to generate compiler-id-specific defines.
This commit is contained in:
parent
36ed589484
commit
30a99f5c06
|
@ -38,7 +38,7 @@ function(compiler_id_detection outvar lang)
|
||||||
_readFile(${file})
|
_readFile(${file})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(options ID_STRING VERSION_STRINGS)
|
set(options ID_STRING VERSION_STRINGS ID_DEFINE)
|
||||||
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}\"")
|
||||||
|
@ -72,9 +72,15 @@ function(compiler_id_detection outvar lang)
|
||||||
IAR
|
IAR
|
||||||
MIPSpro)
|
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")
|
set(pp_if "#if")
|
||||||
if (CID_VERSION_STRINGS)
|
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")
|
Version date components: YYYY=Year, MM=Month, DD=Day */\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -86,6 +92,10 @@ function(compiler_id_detection outvar lang)
|
||||||
if (CID_ID_STRING)
|
if (CID_ID_STRING)
|
||||||
set(id_content "${id_content}# define COMPILER_ID \"${Id}\"")
|
set(id_content "${id_content}# define COMPILER_ID \"${Id}\"")
|
||||||
endif()
|
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)
|
if (CID_VERSION_STRINGS)
|
||||||
set(id_content "${id_content}${_compiler_id_version_compute_${Id}}\n")
|
set(id_content "${id_content}${_compiler_id_version_compute_${Id}}\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue