diff options
author | biao716.wang <biao716.wang@samsung.com> | 2020-03-19 01:04:30 +0900 |
---|---|---|
committer | biao716.wang <biao716.wang@samsung.com> | 2020-03-19 01:04:30 +0900 |
commit | 1d6613f4446f69f63beddf2d97c201154fb35e33 (patch) | |
tree | f32eae75900a0df14ab8fa1e2bd436af159ef91d /Modules/CMakeTestCompilerCommon.cmake | |
parent | aabcd8e66e3268a232efe2e416635d5b6bf84ad5 (diff) | |
download | cmake-1d6613f4446f69f63beddf2d97c201154fb35e33.tar.gz cmake-1d6613f4446f69f63beddf2d97c201154fb35e33.tar.bz2 cmake-1d6613f4446f69f63beddf2d97c201154fb35e33.zip |
Imported Upstream version 3.16.4upstream/3.16.4
Change-Id: Ic5262ea6c0872b353ea2dc35fe1e944063ae8409
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
Diffstat (limited to 'Modules/CMakeTestCompilerCommon.cmake')
-rw-r--r-- | Modules/CMakeTestCompilerCommon.cmake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Modules/CMakeTestCompilerCommon.cmake b/Modules/CMakeTestCompilerCommon.cmake index f76076fe2..6ee5175dd 100644 --- a/Modules/CMakeTestCompilerCommon.cmake +++ b/Modules/CMakeTestCompilerCommon.cmake @@ -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() |