diff --git a/llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake b/llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake --- a/llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake +++ b/llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake @@ -22,8 +22,9 @@ string(TOUPPER ${FILE} VAR) string(TOUPPER "HAVE_${VAR}" FEATURE) if (DEFINED HAVE_${VAR}) - set(HAVE_${VAR} 1 PARENT_SCOPE) - add_definitions(-DHAVE_${VAR}) + if(HAVE_${VAR}) + add_definitions(-DHAVE_${VAR}) + endif() return() endif() @@ -52,7 +53,7 @@ if(RUN_${FEATURE} EQUAL 0) message("-- Performing Test ${FEATURE} -- success") - set(HAVE_${VAR} 1 PARENT_SCOPE) + set(HAVE_${VAR} ON CACHE BOOL "CXX feature test") add_definitions(-DHAVE_${VAR}) else() if(NOT COMPILE_${FEATURE}) @@ -60,5 +61,6 @@ else() message("-- Performing Test ${FEATURE} -- compiled but failed to run") endif() + set(HAVE_${VAR} OFF CACHE BOOL "CXX feature test") endif() endfunction()