mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
GHS: Add Compiler ID detection
-- Detect GHS compiler and version Detect ARCHITECTURE_ID for PPC / ARM / 86 targets Detect PLATFORM_ID for Integrity and Integrity178 platforms Using defines specified in the documents for the compilers: 201416 PPC / 201754 ARM / 201714 86 -- Fallback C/CXX compiler ID to GHS if not otherwise detected and using GHS MULTI generator Works around issue with some GHS compilers not setting __ghs__ compiler define -- Tweak Compiler ID checking so major id of 002017 is not replaced with 217 -- Prefer try_compile() library targets when testing for working GHS compilers -- Avoid CMake errors if reading past end of file for checking if file is PE executable
This commit is contained in:
@@ -5,3 +5,23 @@
|
||||
function(PrintTestCompilerStatus LANG MSG)
|
||||
message(STATUS "Check for working ${LANG} compiler: ${CMAKE_${LANG}_COMPILER}${MSG}")
|
||||
endfunction()
|
||||
|
||||
# if required set the target type if not already explicitly set
|
||||
macro(__TestCompiler_setTryCompileTargetType)
|
||||
if(NOT CMAKE_TRY_COMPILE_TARGET_TYPE)
|
||||
if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
|
||||
#prefer static libraries to avoid linking issues
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
set(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE 1)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# restore the original value
|
||||
# -- not necessary if __TestCompiler_setTryCompileTargetType() was used in function scope
|
||||
macro(__TestCompiler_restoreTryCompileTargetType)
|
||||
if(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE)
|
||||
unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
|
||||
unset(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
Reference in New Issue
Block a user