From 8512db2a1b2bacb8b142109f3e177a3f14d6ca6f Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 11 May 2016 20:37:43 +0000 Subject: [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 --- cmake/Modules/BuiltinTests.cmake | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'cmake/Modules/BuiltinTests.cmake') 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() -- cgit v1.2.3