|
1 |
| -cmake_minimum_required(VERSION 2.8) |
| 1 | +cmake_minimum_required(VERSION 2.8.2) |
| 2 | + |
| 3 | +# Download and unpack googletest at configure time |
| 4 | +configure_file(CMakeListsGTest.txt.in googletest-download/CMakeLists.txt) |
| 5 | +execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . |
| 6 | + RESULT_VARIABLE result |
| 7 | + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download ) |
| 8 | +if(result) |
| 9 | + message(FATAL_ERROR "CMake step for googletest failed: ${result}") |
| 10 | +endif() |
| 11 | +execute_process(COMMAND ${CMAKE_COMMAND} --build . |
| 12 | + RESULT_VARIABLE result |
| 13 | + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download ) |
| 14 | +if(result) |
| 15 | + message(FATAL_ERROR "Build step for googletest failed: ${result}") |
| 16 | +endif() |
| 17 | + |
| 18 | +# Prevent overriding the parent project's compiler/linker |
| 19 | +# settings on Windows |
| 20 | +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) |
| 21 | + |
| 22 | +# Add googletest directly to our build. This defines |
| 23 | +# the gtest and gtest_main targets. |
| 24 | +add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src |
| 25 | + ${CMAKE_CURRENT_BINARY_DIR}/googletest-build |
| 26 | + EXCLUDE_FROM_ALL) |
| 27 | + |
| 28 | +# The gtest/gtest_main targets carry header search path |
| 29 | +# dependencies automatically when using CMake 2.8.11 or |
| 30 | +# later. Otherwise we have to add them here ourselves. |
| 31 | +if (CMAKE_VERSION VERSION_LESS 2.8.11) |
| 32 | + include_directories("${gtest_SOURCE_DIR}/include") |
| 33 | +endif() |
| 34 | + |
| 35 | +#target_link_libraries(example gtest_main) |
| 36 | +#add_test(NAME example_test COMMAND example) |
2 | 37 |
|
3 | 38 | include_directories(${EXPRPARSE_INCLUDE_DIR})
|
4 | 39 | add_executable(exprtests main.cpp)
|
|
0 commit comments