mirror of
https://github.com/google/benchmark.git
synced 2025-01-15 06:10:15 +08:00
Prevent re-execution of slow feature tests.
This commit is contained in:
parent
c7108df977
commit
9fcdd6fc25
@ -21,12 +21,15 @@ function(cxx_feature_check FILE)
|
|||||||
string(TOLOWER ${FILE} FILE)
|
string(TOLOWER ${FILE} FILE)
|
||||||
string(TOUPPER ${FILE} VAR)
|
string(TOUPPER ${FILE} VAR)
|
||||||
string(TOUPPER "HAVE_${VAR}" FEATURE)
|
string(TOUPPER "HAVE_${VAR}" FEATURE)
|
||||||
|
if (DEFINED HAVE_${VAR})
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
message("-- Performing Test ${FEATURE}")
|
message("-- Performing Test ${FEATURE}")
|
||||||
try_run(RUN_${FEATURE} COMPILE_${FEATURE}
|
try_run(RUN_${FEATURE} COMPILE_${FEATURE}
|
||||||
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp)
|
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp)
|
||||||
if(RUN_${FEATURE} EQUAL 0)
|
if(RUN_${FEATURE} EQUAL 0)
|
||||||
message("-- Performing Test ${FEATURE} -- success")
|
message("-- Performing Test ${FEATURE} -- success")
|
||||||
set(HAVE_${VAR} 1 PARENT_SCOPE)
|
set(HAVE_${VAR} 1 CACHE INTERNAL "Feature test for ${FILE}" PARENT_SCOPE)
|
||||||
add_definitions(-DHAVE_${VAR})
|
add_definitions(-DHAVE_${VAR})
|
||||||
else()
|
else()
|
||||||
if(NOT COMPILE_${FEATURE})
|
if(NOT COMPILE_${FEATURE})
|
||||||
|
Loading…
Reference in New Issue
Block a user