diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 74c38034bc67f3fc8f3018a62c55f0c76b61448a..5f29c8af3cfda3da6eedefa90f8bfdeb86c04e2c 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 74db45c34f8d375ff91a4447f522bdb5f581a9c0..278e555439c00415b0e1ab691dd65955ba433335 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()