diff options
author | Chris Bieneman <beanz@apple.com> | 2016-05-11 20:37:43 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2016-05-11 20:37:43 +0000 |
commit | 8512db2a1b2bacb8b142109f3e177a3f14d6ca6f (patch) | |
tree | 897a8ff815a5dd860290b8fe9c29912c73cc8fef /cmake/Modules/BuiltinTests.cmake | |
parent | cd7d3f38dff07d375aca12cd63dab21a6b9d063a (diff) |
[CMake] Cache check results and avoid duplicate checks
This caches the result of builtin_check_c_compiler_flag, and removes a duplicate check for C99 flag support.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules/BuiltinTests.cmake')
-rw-r--r-- | cmake/Modules/BuiltinTests.cmake | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/cmake/Modules/BuiltinTests.cmake b/cmake/Modules/BuiltinTests.cmake index fde5f7590..1b03e94ac 100644 --- a/cmake/Modules/BuiltinTests.cmake +++ b/cmake/Modules/BuiltinTests.cmake @@ -49,12 +49,14 @@ function(try_compile_only output) endfunction() function(builtin_check_c_compiler_flag flag output) - message(STATUS "Performing Test ${output}") - try_compile_only(result ${flag}) - set(${output} ${result} PARENT_SCOPE) - if(${result}) - message(STATUS "Performing Test ${output} - Success") - else() - message(STATUS "Performing Test ${output} - Failed") + if(NOT DEFINED ${output}) + message(STATUS "Performing Test ${output}") + try_compile_only(result ${flag}) + set(${output} ${result} CACHE INTERNAL "Compiler supports ${flag}") + if(${result}) + message(STATUS "Performing Test ${output} - Success") + else() + message(STATUS "Performing Test ${output} - Failed") + endif() endif() endfunction() |