diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7e2209c52900a9292198a5a436974059cdc153a4..7beb4a968d006ebfe9e2e5f75b1790d53668f8be 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,13 @@ # Retrieve googletest from github & compile add_subdirectory(gtest) +############# USE THIS TEST AS AN EXAMPLE ################# +# # +# Create a specific test executable for gtest_example # +# wolf_add_gtest(gtest_example gtest_example.cpp) # +# # +########################################################### + wolf_add_gtest(gtest_pinhole gtest_pinhole.cpp) wolf_add_gtest(gtest_capture_image gtest_capture_image.cpp) diff --git a/test/gtest/CMakeLists.txt b/test/gtest/CMakeLists.txt index 0fe7d7a08d4d323f4171f9a210fb547914e894c2..d7b68ba07d1748de3b6ff1a8af18b75f55a54c9d 100644 --- a/test/gtest/CMakeLists.txt +++ b/test/gtest/CMakeLists.txt @@ -5,15 +5,7 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.0") include(ExternalProject) set(GTEST_FORCE_SHARED_CRT ON) - set(GTEST_DISABLE_PTHREADS OFF) - - # For some reason I need to disable PTHREADS - # with g++ (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3 - # This is a known issue for MinGW : - # https://github.com/google/shaderc/pull/174 - #if(MINGW) - # set(GTEST_DISABLE_PTHREADS ON) - #endif() + set(GTEST_DISABLE_PTHREADS ON) # without this in ubuntu 18.04 we get linking errors # Download GoogleTest ExternalProject_Add(googletest @@ -63,7 +55,13 @@ else() GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG main) - FetchContent_MakeAvailable(googletest) + #FetchContent_MakeAvailable(googletest) + # Disable installation of googletest: https://stackoverflow.com/questions/65527126/disable-install-for-fetchcontent + FetchContent_GetProperties(googletest) + if(NOT googletest_POPULATED) + FetchContent_Populate(googletest) + add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() endif()