[compiler-rt] r269230 - [CMake] Cache check results and avoid duplicate checks

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 13:37:44 PDT 2016


Author: cbieneman
Date: Wed May 11 15:37:43 2016
New Revision: 269230

URL: http://llvm.org/viewvc/llvm-project?rev=269230&view=rev
Log:
[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.

Modified:
    compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake
    compiler-rt/trunk/cmake/config-ix.cmake

Modified: compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake?rev=269230&r1=269229&r2=269230&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake Wed May 11 15:37:43 2016
@@ -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()

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=269230&r1=269229&r2=269230&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Wed May 11 15:37:43 2016
@@ -29,7 +29,6 @@ check_cxx_compiler_flag(-std=c++11
 check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
 check_cxx_compiler_flag(-fno-lto             COMPILER_RT_HAS_FNO_LTO_FLAG)
 check_cxx_compiler_flag("-Werror -msse3" COMPILER_RT_HAS_MSSE3_FLAG)
-check_cxx_compiler_flag(-std=c99             COMPILER_RT_HAS_STD_C99_FLAG)
 check_cxx_compiler_flag(--sysroot=.          COMPILER_RT_HAS_SYSROOT_FLAG)
 
 if(NOT WIN32 AND NOT CYGWIN)




More information about the llvm-commits mailing list