[llvm] [third-party][cmake] Check compile result first then run result in the try_run function call (NFC) (PR #154177)

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 9 20:54:47 PST 2025


================
@@ -64,19 +64,19 @@ function(cxx_feature_check FILE)
     endif()
   endif()
 
-  if(RUN_${FEATURE} EQUAL 0)
-    message(STATUS "Performing Test ${FEATURE} -- success")
-    set(HAVE_${VAR} 1 PARENT_SCOPE)
-    add_definitions(-DHAVE_${VAR})
-  else()
-    if(NOT COMPILE_${FEATURE})
-      if(CXXFEATURECHECK_DEBUG)
-        message(STATUS "Performing Test ${FEATURE} -- failed to compile: ${COMPILE_OUTPUT_VAR}")
-      else()
-        message(STATUS "Performing Test ${FEATURE} -- failed to compile")
-      endif()
+  if(COMPILE_${FEATURE})
+    if(RUN_${FEATURE} EQUAL 0)
----------------
hubert-reinterpretcast wrote:

>From https://github.com/google/benchmark/pull/2046:
```suggestion
    if(DEFINED RUN_${FEATURE} AND RUN_${FEATURE} EQUAL 0)
```

https://github.com/llvm/llvm-project/pull/154177


More information about the llvm-commits mailing list