From e1782cf9b9ce14e238cdd0bb0b44e2c97df718f8 Mon Sep 17 00:00:00 2001 From: ArthurSonzogni Date: Thu, 16 Apr 2020 23:36:37 +0200 Subject: [PATCH] Fix travis on Windows with gtests. --- .travis.yml | 10 +++++++++- CMakeLists.txt | 14 ++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45af851..636f867 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ script: - cd build - cmake .. -DFTXUI_BUILD_TESTS=ON - cmake --build . - - ./tests --gtest_color=yes + - "${FTXUI_TEST_EXE}" notifications: email: false @@ -19,14 +19,22 @@ jobs: - os: linux dist: bionic compiler: gcc + env: + - FTXUI_TEST_EXE="./tests --gtest_color=yes" # Ubuntu - os: linux dist: bionic compiler: clang + env: + - FTXUI_TEST_EXE="./tests --gtest_color=yes" # OS X - os: osx + env: + - FTXUI_TEST_EXE="./tests --gtest_color=yes" # Windows - os: windows + env: + - FTXUI_TEST_EXE="./Debug/tests.exe --gtest_color=yes" diff --git a/CMakeLists.txt b/CMakeLists.txt index c7c7f14..276fdf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,13 +152,14 @@ export(TARGETS screen dom component NAMESPACE ftxui:: if (FTXUI_BUILD_TESTS AND ${CMAKE_VERSION} VERSION_GREATER "3.11.4") + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE) include(FetchContent) - FetchContent_Declare( - googletest - GIT_REPOSITORY "https://github.com/google/googletest" - GIT_TAG master + FetchContent_Declare( googletest + GIT_REPOSITORY "https://github.com/google/googletest" + GIT_TAG release-1.10.0 ) FetchContent_GetProperties(googletest) @@ -185,11 +186,12 @@ if (FTXUI_BUILD_TESTS AND ${CMAKE_VERSION} VERSION_GREATER "3.11.4") target_link_libraries(tests PRIVATE component - PRIVATE gtest gtest_main + PRIVATE gtest + PRIVATE gmock + PRIVATE gtest_main ) set_property(TARGET tests PROPERTY CXX_STANDARD 17) - add_test(tests tests) endif() if(FTXUI_BUILD_EXAMPLES)