From e76243e08f80fab97fa5abdb79b19726719047cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu> Date: Mon, 2 May 2022 21:10:02 +0200 Subject: [PATCH] trying guilhem proposal --- test/CMakeLists.txt | 8 ++++---- test/gtest/CMakeLists.txt | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 74c38034b..5f29c8af3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,10 +2,10 @@ add_subdirectory(gtest) # Include gtest directory. -if(${CMAKE_VERSION} VERSION_LESS "3.11.0") - message("CMake version less than 3.11.0") - include_directories(${GTEST_INCLUDE_DIRS}) -endif() +# if(${CMAKE_VERSION} VERSION_LESS "3.11.0") +# message("CMake version less than 3.11.0") +# include_directories(${GTEST_INCLUDE_DIRS}) +# endif() ############# USE THIS TEST AS AN EXAMPLE ################# # # diff --git a/test/gtest/CMakeLists.txt b/test/gtest/CMakeLists.txt index 74db45c34..278e55543 100644 --- a/test/gtest/CMakeLists.txt +++ b/test/gtest/CMakeLists.txt @@ -69,6 +69,12 @@ endif() function(wolf_add_gtest target) add_executable(${target} ${ARGN}) - target_link_libraries(${target} PUBLIC gtest_main) + if(${CMAKE_VERSION} VERSION_LESS "3.11.0") + add_dependencies(${target} libgtest) + target_link_libraries(${target} libgtest) + target_include_directories(${target} ${GTEST_INCLUDE_DIRS}) + else() + target_link_libraries(${target} PUBLIC gtest_main) + endif() add_test(NAME ${target} COMMAND ${target}) endfunction() -- GitLab