From fe18173600d478071c6ee1aad23f4b7f02e00993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu> Date: Tue, 17 May 2022 14:17:41 +0200 Subject: [PATCH] disabling gtest pthreads in cmake<3.11 --- test/CMakeLists.txt | 3 +-- test/gtest/CMakeLists.txt | 18 ++++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a9fc8fb77..1d3f41289 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,7 +4,7 @@ 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_example gtest_example.cpp) # # # ########################################################### @@ -12,7 +12,6 @@ wolf_add_gtest(gtest_landmark_polyline gtest_landmark_polyline.cpp) if(csm_FOUND) wolf_add_gtest(gtest_processor_odom_icp gtest_processor_odom_icp.cpp) - wolf_add_gtest(gtest_processor_loop_closure_icp gtest_processor_loop_closure_icp.cpp) endif(csm_FOUND) diff --git a/test/gtest/CMakeLists.txt b/test/gtest/CMakeLists.txt index 9450a2925..5c21fa2c3 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() -- GitLab