cmake: tests: gtest target is not always defined #983

This commit is contained in:
redfish 2016-08-29 12:12:19 -04:00
parent 69f200c7fb
commit dbd9a2606c
1 changed files with 9 additions and 2 deletions

View File

@ -28,6 +28,9 @@
# #
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers # Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
# The docs say this only affects grouping in IDEs
set(folder "tests")
if (WIN32 AND STATIC) if (WIN32 AND STATIC)
add_definitions(-DSTATICLIB) add_definitions(-DSTATICLIB)
# miniupnp changed their static define # miniupnp changed their static define
@ -52,6 +55,10 @@ else ()
PROPERTY PROPERTY
COMPILE_FLAGS " -Wno-undef -Wno-sign-compare") COMPILE_FLAGS " -Wno-undef -Wno-sign-compare")
endif() endif()
set_property(TARGET gtest gtest_main
PROPERTY
FOLDER "${folder}")
endif () endif ()
if (NOT DEFINED ENV{TRAVIS}) if (NOT DEFINED ENV{TRAVIS})
@ -84,7 +91,7 @@ target_link_libraries(hash-target-tests
cryptonote_core) cryptonote_core)
set_property(TARGET hash-target-tests set_property(TARGET hash-target-tests
PROPERTY PROPERTY
FOLDER "tests") FOLDER "${folder}")
add_test( add_test(
NAME hash-target NAME hash-target
@ -97,4 +104,4 @@ else ()
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)
endif () endif ()
set_property(TARGET gtest gtest_main hash-target-tests tests PROPERTY FOLDER "tests") set_property(TARGET tests PROPERTY FOLDER "${folder}")