1# Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2# file Copyright.txt or https://cmake.org/licensing for details. 3 4 5function(PrintTestCompilerStatus LANG) 6 # ARGN shouldn't be needed now, but it is there to preserve backward 7 # compatibility in case this function is called from project code or 8 # custom toolchains (they shouldn't, but we can easily support it) 9 message(CHECK_START "Check for working ${LANG} compiler: ${CMAKE_${LANG}_COMPILER}${ARGN}") 10endfunction() 11 12function(PrintTestCompilerResult TYPE MSG) 13 message(${TYPE} "${MSG}") 14endfunction() 15 16# if required set the target type if not already explicitly set 17macro(__TestCompiler_setTryCompileTargetType) 18 if(NOT CMAKE_TRY_COMPILE_TARGET_TYPE) 19 if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") 20 #prefer static libraries to avoid linking issues 21 set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 22 set(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE 1) 23 endif() 24 endif() 25endmacro() 26 27# restore the original value 28# -- not necessary if __TestCompiler_setTryCompileTargetType() was used in function scope 29macro(__TestCompiler_restoreTryCompileTargetType) 30 if(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE) 31 unset(CMAKE_TRY_COMPILE_TARGET_TYPE) 32 unset(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE) 33 endif() 34endmacro() 35