Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: third_party/google_benchmark/cmake/CXXFeatureCheck.cmake

Issue 2865663003: Adding Google benchmarking library. (Closed)
Patch Set: Sketch. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # - Compile and run code to check for C++ features
2 #
3 # This functions compiles a source file under the `cmake` folder
4 # and adds the corresponding `HAVE_[FILENAME]` flag to the CMake
5 # environment
6 #
7 # cxx_feature_check(<FLAG> [<VARIANT>])
8 #
9 # - Example
10 #
11 # include(CXXFeatureCheck)
12 # cxx_feature_check(STD_REGEX)
13 # Requires CMake 2.8.12+
14
15 if(__cxx_feature_check)
16 return()
17 endif()
18 set(__cxx_feature_check INCLUDED)
19
20 function(cxx_feature_check FILE)
21 string(TOLOWER ${FILE} FILE)
22 string(TOUPPER ${FILE} VAR)
23 string(TOUPPER "HAVE_${VAR}" FEATURE)
24 if (DEFINED HAVE_${VAR})
25 return()
26 endif()
27 message("-- Performing Test ${FEATURE}")
28 try_run(RUN_${FEATURE} COMPILE_${FEATURE}
29 ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
30 CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
31 LINK_LIBRARIES ${BENCHMARK_CXX_LIBRARIES})
32 if(RUN_${FEATURE} EQUAL 0)
33 message("-- Performing Test ${FEATURE} -- success")
34 set(HAVE_${VAR} 1 CACHE INTERNAL "Feature test for ${FILE}" PARENT_SCOPE)
35 add_definitions(-DHAVE_${VAR})
36 else()
37 if(NOT COMPILE_${FEATURE})
38 message("-- Performing Test ${FEATURE} -- failed to compile")
39 else()
40 message("-- Performing Test ${FEATURE} -- compiled but failed to run")
41 endif()
42 endif()
43 endfunction()
44
OLDNEW
« no previous file with comments | « third_party/google_benchmark/cmake/AddCXXCompilerFlag.cmake ('k') | third_party/google_benchmark/cmake/Config.cmake.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698