mirror of
https://github.com/monero-project/monero.git
synced 2024-12-12 19:36:31 +02:00
gtest: support an external gtest
This commit is contained in:
parent
7bfcffadb9
commit
fa3ff75862
@ -32,8 +32,25 @@ add_definitions(-DSTATICLIB)
|
|||||||
# miniupnp changed their static define
|
# miniupnp changed their static define
|
||||||
add_definitions(-DMINIUPNP_STATICLIB)
|
add_definitions(-DMINIUPNP_STATICLIB)
|
||||||
|
|
||||||
add_subdirectory(gtest)
|
find_package(GTest)
|
||||||
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
|
|
||||||
|
if (GTest_FOUND)
|
||||||
|
include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
|
||||||
|
else ()
|
||||||
|
add_subdirectory(gtest)
|
||||||
|
include_directories(SYSTEM "${gtest_SOURCE_DIR}/include" "${gtest_SOURCE_DIR}")
|
||||||
|
|
||||||
|
# Emulate the FindGTest module's variable.
|
||||||
|
set(GTEST_MAIN_LIBRARIES gtest_main)
|
||||||
|
|
||||||
|
# Ignore some warnings when building gtest binaries.
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_property(TARGET gtest gtest_main
|
||||||
|
APPEND_STRING
|
||||||
|
PROPERTY
|
||||||
|
COMPILE_FLAGS " -Wno-undef -Wno-sign-compare")
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_subdirectory(core_tests)
|
add_subdirectory(core_tests)
|
||||||
add_subdirectory(crypto)
|
add_subdirectory(crypto)
|
||||||
@ -66,9 +83,5 @@ add_test(
|
|||||||
NAME hash-target
|
NAME hash-target
|
||||||
COMMAND hash-target-tests)
|
COMMAND hash-target-tests)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
set_property(TARGET gtest gtest_main APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-sign-compare")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_target(tests DEPENDS coretests difficulty hash performance_tests core_proxy unit_tests)
|
add_custom_target(tests DEPENDS coretests difficulty hash performance_tests core_proxy unit_tests)
|
||||||
set_property(TARGET gtest gtest_main hash-target-tests tests PROPERTY FOLDER "tests")
|
set_property(TARGET gtest gtest_main hash-target-tests tests PROPERTY FOLDER "tests")
|
||||||
|
@ -37,7 +37,7 @@ add_executable(net_load_tests_clt
|
|||||||
${clt_headers})
|
${clt_headers})
|
||||||
target_link_libraries(net_load_tests_clt
|
target_link_libraries(net_load_tests_clt
|
||||||
PRIVATE
|
PRIVATE
|
||||||
gtest_main
|
${GTEST_MAIN_LIBRARIES}
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_DATE_TIME_LIBRARY}
|
${Boost_DATE_TIME_LIBRARY}
|
||||||
${Boost_FILESYSTEM_LIBRARY}
|
${Boost_FILESYSTEM_LIBRARY}
|
||||||
@ -56,7 +56,7 @@ add_executable(net_load_tests_srv
|
|||||||
${srv_headers})
|
${srv_headers})
|
||||||
target_link_libraries(net_load_tests_srv
|
target_link_libraries(net_load_tests_srv
|
||||||
PRIVATE
|
PRIVATE
|
||||||
gtest_main
|
${GTEST_MAIN_LIBRARIES}
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_DATE_TIME_LIBRARY}
|
${Boost_DATE_TIME_LIBRARY}
|
||||||
${Boost_FILESYSTEM_LIBRARY}
|
${Boost_FILESYSTEM_LIBRARY}
|
||||||
|
@ -58,7 +58,7 @@ target_link_libraries(unit_tests
|
|||||||
cryptonote_core
|
cryptonote_core
|
||||||
rpc
|
rpc
|
||||||
wallet
|
wallet
|
||||||
gtest_main
|
${GTEST_MAIN_LIBRARIES}
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_REGEX_LIBRARY}
|
${Boost_REGEX_LIBRARY}
|
||||||
${Boost_SYSTEM_LIBRARY}
|
${Boost_SYSTEM_LIBRARY}
|
||||||
|
Loading…
Reference in New Issue
Block a user