Project: Separate simulated compiler id from version detection.

This commit is contained in:
Stephen Kelly 2014-06-05 13:05:20 +02:00
parent 567af1a596
commit 78acaafebe
3 changed files with 14 additions and 3 deletions

View File

@ -17,6 +17,7 @@ function(_readFile file)
get_filename_component(name ${file} NAME_WE) get_filename_component(name ${file} NAME_WE)
string(REGEX REPLACE "-.*" "" CompilerId ${name}) string(REGEX REPLACE "-.*" "" CompilerId ${name})
set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
set(_compiler_id_simulate_${CompilerId} ${_compiler_id_simulate} PARENT_SCOPE)
set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE) set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
endfunction() endfunction()
@ -114,7 +115,9 @@ function(compiler_id_detection outvar lang)
endif() endif()
set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n") set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n")
if (CID_ID_STRING) if (CID_ID_STRING)
set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"") set(PREFIX ${CID_PREFIX})
string(CONFIGURE "${_compiler_id_simulate_${Id}}" SIMULATE_BLOCK @ONLY)
set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}")
endif() endif()
if (CID_ID_DEFINE) if (CID_ID_DEFINE)
set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n") set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n")

View File

@ -4,8 +4,12 @@ set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MINOR DEC(__clang_minor__) # define @PREFIX@COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define @PREFIX@COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) # define @PREFIX@COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER) # if defined(_MSC_VER)
# define @PREFIX@SIMULATE_ID \"MSVC\"
/* _MSC_VER = VVRR */ /* _MSC_VER = VVRR */
# define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) # define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) # define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif") # endif")
set(_compiler_id_simulate "
# if defined(_MSC_VER)
# define @PREFIX@SIMULATE_ID \"MSVC\"
# endif")

View File

@ -15,8 +15,12 @@ set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) # define @PREFIX@COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif # endif
# if defined(_MSC_VER) # if defined(_MSC_VER)
# define @PREFIX@SIMULATE_ID \"MSVC\"
/* _MSC_VER = VVRR */ /* _MSC_VER = VVRR */
# define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) # define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) # define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif") # endif")
set(_compiler_id_simulate "
# if defined(_MSC_VER)
# define @PREFIX@SIMULATE_ID \"MSVC\"
# endif")