aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTimothy D. Prime <tdprime@teleosmedia.com>2017-02-08 12:38:41 -0800
committerTimothy D. Prime <tdprime@teleosmedia.com>2017-02-08 12:38:41 -0800
commit32d7d048588feda34bcb61995860850763468579 (patch)
tree22a9e88886691a74ec23933b9ee208d2cf1b3d0b /tests
parentMerge pull request #1679 (diff)
downloadmonero-32d7d048588feda34bcb61995860850763468579.tar.xz
fixes #1688 protect make debug-test from gtest
In simple terms, add_subdirectory() is replaced with ExternalProject_Add(). This change is inspired by https://crascit.com/2015/07/25/cmake-gtest/ with one difference, no download, using the source we already have. Before this change, make debug-test must be preceded by make clean. Otherwise, a subsequent build would be polluted by cmake options made by tests/gtest/. Also removed the changed compiler flags. My test build did not have the affected warnings.
Diffstat (limited to '')
-rw-r--r--tests/CMakeLists.txt38
1 files changed, 22 insertions, 16 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 60b7a4dba..a2e53dda1 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -43,24 +43,30 @@ if (GTest_FOUND)
include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
else ()
message(STATUS "GTest not found on the system: will use GTest bundled with this source")
- add_subdirectory(gtest)
- include_directories(SYSTEM "${gtest_SOURCE_DIR}/include" "${gtest_SOURCE_DIR}")
- # Emulate the FindGTest module's variable.
- set(GTEST_LIBRARIES gtest)
-
- # Ignore some warnings when building gtest binaries.
- if(NOT MSVC)
- set_property(TARGET gtest
- APPEND_STRING
- PROPERTY
- COMPILE_FLAGS " -Wno-undef -Wno-sign-compare")
- endif()
+ include(ExternalProject)
+ ExternalProject_Add(googletest
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gtest
+ BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/gtest
+ DOWNLOAD_COMMAND ""
+ UPDATE_COMMAND ""
+ INSTALL_COMMAND ""
+ )
+ add_library(gtest UNKNOWN IMPORTED)
+ add_library(gtest_main UNKNOWN IMPORTED)
+ set_target_properties(gtest PROPERTIES
+ IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/gtest/libgtest.a
+ )
+ set_target_properties(gtest_main PROPERTIES
+ IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/gtest/libgtest_main.a
+ )
+ add_dependencies(gtest googletest)
+ add_dependencies(gtest_main googletest)
- set_property(TARGET gtest
- PROPERTY
- FOLDER "${folder}")
-endif ()
+ # Emulate the FindGTest module's variable.
+ set(GTEST_LIBRARIES gtest gtest_main)
+ include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/gtest/include")
+endif (GTest_FOUND)
file(COPY
data/wallet_9svHk1.keys