mirror of https://github.com/google/benchmark.git
Add caching for cxx_feature_check (#573)
This commit is contained in:
parent
64d4805dd7
commit
105ac14b2f
|
@ -27,25 +27,27 @@ function(cxx_feature_check FILE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message("-- Performing Test ${FEATURE}")
|
if (NOT DEFINED COMPILE_${FEATURE})
|
||||||
if(CMAKE_CROSSCOMPILING)
|
|
||||||
try_compile(COMPILE_${FEATURE}
|
|
||||||
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
|
|
||||||
CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
|
|
||||||
LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES})
|
|
||||||
if(COMPILE_${FEATURE})
|
|
||||||
message(WARNING
|
|
||||||
"If you see build failures due to cross compilation, try setting HAVE_${VAR} to 0")
|
|
||||||
set(RUN_${FEATURE} 0)
|
|
||||||
else()
|
|
||||||
set(RUN_${FEATURE} 1)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message("-- Performing Test ${FEATURE}")
|
message("-- Performing Test ${FEATURE}")
|
||||||
try_run(RUN_${FEATURE} COMPILE_${FEATURE}
|
if(CMAKE_CROSSCOMPILING)
|
||||||
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
|
try_compile(COMPILE_${FEATURE}
|
||||||
CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
|
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
|
||||||
LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES})
|
CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
|
||||||
|
LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES})
|
||||||
|
if(COMPILE_${FEATURE})
|
||||||
|
message(WARNING
|
||||||
|
"If you see build failures due to cross compilation, try setting HAVE_${VAR} to 0")
|
||||||
|
set(RUN_${FEATURE} 0)
|
||||||
|
else()
|
||||||
|
set(RUN_${FEATURE} 1)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message("-- Performing Test ${FEATURE}")
|
||||||
|
try_run(RUN_${FEATURE} COMPILE_${FEATURE}
|
||||||
|
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
|
||||||
|
CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
|
||||||
|
LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(RUN_${FEATURE} EQUAL 0)
|
if(RUN_${FEATURE} EQUAL 0)
|
||||||
|
|
Loading…
Reference in New Issue